forked from git.gladyson/openmonetis
Adiciona sistema de customização de fontes por usuário via CSS custom properties, com preview ao vivo e persistência no banco. Corrige lógica de cores invertida na tabela de receitas em tendências. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { cn } from "@/lib/utils/ui";
|
|
import { usePrivacyMode } from "./privacy-provider";
|
|
|
|
type Props = {
|
|
amount: number;
|
|
className?: string;
|
|
showPositiveSign?: boolean;
|
|
};
|
|
|
|
function MoneyValues({ amount, className, showPositiveSign = false }: Props) {
|
|
const { privacyMode } = usePrivacyMode();
|
|
|
|
const formattedValue = amount.toLocaleString("pt-BR", {
|
|
style: "currency",
|
|
currency: "BRL",
|
|
maximumFractionDigits: 2,
|
|
});
|
|
|
|
const displayValue =
|
|
showPositiveSign && amount > 0 ? `+${formattedValue}` : formattedValue;
|
|
|
|
return (
|
|
<span
|
|
style={{ fontFamily: "var(--font-money)" }}
|
|
className={cn(
|
|
"inline-flex items-baseline transition-all duration-200 tracking-tighter",
|
|
privacyMode &&
|
|
"blur-[6px] select-none hover:blur-none focus-within:blur-none",
|
|
className,
|
|
)}
|
|
aria-label={privacyMode ? "Valor oculto" : displayValue}
|
|
data-privacy={privacyMode ? "hidden" : undefined}
|
|
title={
|
|
privacyMode ? "Valor oculto - passe o mouse para revelar" : undefined
|
|
}
|
|
>
|
|
{displayValue}
|
|
</span>
|
|
);
|
|
}
|
|
|
|
export default MoneyValues;
|