Fix: Calendar negative sign issue

Corrects the calendar view to display revenue transactions with positive values.
This commit is contained in:
gpt-engineer-app[bot] 2025-05-18 02:38:08 +00:00
parent eccb0a6cb6
commit f14cc08652

View File

@ -123,16 +123,16 @@ const CalendarioPage = () => {
<div key={transaction.id} className="p-4 border rounded-md hover:bg-muted/50 transition-colors">
<div className="flex justify-between items-center mb-1">
<div className="font-medium">{transaction.estabelecimento}</div>
<Badge variant={transaction.tipo.toLowerCase() === 'entrada' ? "success" : "destructive"}>
{transaction.tipo.toLowerCase() === 'entrada' ? 'Receita' : 'Despesa'}
<Badge variant={transaction.tipo.toLowerCase() === 'receita' || transaction.tipo.toLowerCase() === 'entrada' ? "success" : "destructive"}>
{transaction.tipo.toLowerCase() === 'receita' || transaction.tipo.toLowerCase() === 'entrada' ? 'Receita' : 'Despesa'}
</Badge>
</div>
<div className="text-sm text-muted-foreground mb-2">{transaction.detalhes}</div>
<div className="flex justify-between">
<Badge variant="outline">{transaction.categoria}</Badge>
<span className={transaction.tipo.toLowerCase() === 'entrada' ? "text-finance-green font-medium" : "text-finance-red font-medium"}>
{transaction.tipo.toLowerCase() === 'entrada'
? formatCurrency(transaction.valor)
<span className={transaction.tipo.toLowerCase() === 'receita' || transaction.tipo.toLowerCase() === 'entrada' ? "text-finance-green font-medium" : "text-finance-red font-medium"}>
{transaction.tipo.toLowerCase() === 'receita' || transaction.tipo.toLowerCase() === 'entrada'
? formatCurrency(Math.abs(transaction.valor))
: `-${formatCurrency(Math.abs(transaction.valor))}`}
</span>
</div>