import { AmountDisplay } from '@/components/ui/amount-display';
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '@/components/ui/card';
import { CashflowSummary } from '@/hooks/use-cashflow-data';
import { cn } from '@/lib/utils';
import { __ } from '@/utils/i18n';
import { ArrowDown, ArrowUp, TrendingDown, TrendingUp } from 'lucide-react';
interface NetCashflowCardProps {
current: CashflowSummary;
previous: CashflowSummary;
loading?: boolean;
currency?: string;
}
export function NetCashflowCard({
current,
previous,
loading,
currency = 'USD',
}: NetCashflowCardProps) {
if (loading) {
return (
{__('Net Cashflow')}
);
}
const isPositive = current.net >= 0;
const diff = current.net - previous.net;
const diffIsPositive = diff >= 0;
const hasPreviousData = previous.income > 0 || previous.expense > 0;
return (
{__('Net Cashflow')}
{__('Income minus expenses')}
{hasPreviousData && (
{diffIsPositive ? (
) : (
)}
{diffIsPositive ? '+' : ''}
{__('vs last period')}
)}
);
}