feat: Add economy value to dashboard
Add economy value and percentage to the dashboard summary card.
This commit is contained in:
parent
f3b00231de
commit
db6468b4cc
@ -6,6 +6,7 @@ import { cn } from '@/lib/utils';
|
||||
interface SummaryCardProps {
|
||||
title: string;
|
||||
value: string;
|
||||
secondaryValue?: string;
|
||||
icon: React.ReactNode;
|
||||
trend?: number;
|
||||
className?: string;
|
||||
@ -16,6 +17,7 @@ interface SummaryCardProps {
|
||||
const SummaryCard: React.FC<SummaryCardProps> = ({
|
||||
title,
|
||||
value,
|
||||
secondaryValue,
|
||||
icon,
|
||||
trend,
|
||||
className,
|
||||
@ -41,6 +43,9 @@ const SummaryCard: React.FC<SummaryCardProps> = ({
|
||||
<div className="space-y-1">
|
||||
<p className="text-sm font-medium text-muted-foreground">{title}</p>
|
||||
<p className={cn("text-2xl font-bold", valueClass)}>{value}</p>
|
||||
{secondaryValue && (
|
||||
<p className="text-sm text-muted-foreground">{secondaryValue}</p>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@ -5,7 +5,7 @@ import SummaryCard from '@/components/dashboard/SummaryCard';
|
||||
import TransactionsTable from '@/components/dashboard/TransactionsTable';
|
||||
import CategoryChart from '@/components/dashboard/CategoryChart';
|
||||
import MonthlyChart from '@/components/dashboard/MonthlyChart';
|
||||
import { Wallet, ArrowUp, ArrowDown, PiggyBank } from 'lucide-react';
|
||||
import { Wallet, ArrowUp, ArrowDown, PiggyBank, Percent, DollarSign } from 'lucide-react';
|
||||
import { Transaction, CategorySummary, MonthlyData } from '@/types/financialTypes';
|
||||
import { useToast } from "@/components/ui/use-toast";
|
||||
import { getTransacoes, getTransactionSummary, getCategorySummary, getMonthlyData } from '@/services/transacaoService';
|
||||
@ -120,6 +120,7 @@ const Dashboard = () => {
|
||||
<SummaryCard
|
||||
title="Economia"
|
||||
value={`${totals.receitas > 0 ? ((totals.saldo / totals.receitas) * 100).toFixed(1) : 0}%`}
|
||||
secondaryValue={formatCurrency(totals.saldo)}
|
||||
icon={<PiggyBank size={20} className="text-finance-purple" />}
|
||||
iconClass="bg-finance-purple/10"
|
||||
valueClass="text-finance-purple"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user