"use client"; import { RiInformationLine } from "@remixicon/react"; import Image from "next/image"; import type { ReactNode } from "react"; import MoneyValues from "@/shared/components/money-values"; import { Badge } from "@/shared/components/ui/badge"; import { Card, CardContent } from "@/shared/components/ui/card"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/shared/components/ui/tooltip"; import { resolveLogoSrc } from "@/shared/lib/logo"; import { formatCurrency } from "@/shared/utils/currency"; import { cn } from "@/shared/utils/ui"; type AccountStatementCardProps = { accountName: string; accountType: string; status: string; periodLabel: string; currentBalance: number; openingBalance: number; totalIncomes: number; totalExpenses: number; logo?: string | null; actions?: React.ReactNode; }; const getAccountStatusBadgeVariant = ( status: string, ): "success" | "outline" => { return status.toLowerCase() === "ativa" ? "success" : "outline"; }; export function AccountStatementCard({ accountName, accountType, status, periodLabel, currentBalance, openingBalance, totalIncomes, totalExpenses, logo, actions, }: AccountStatementCardProps) { const logoPath = resolveLogoSrc(logo); const resultado = totalIncomes - totalExpenses; return (
{/* Linha 1 — identidade */}
{logoPath ? (
{`Logo
) : null}

{accountName}

Extrato de {periodLabel}

{actions ?
{actions}
: null}
{/* Linha 2 — saldo final (hero) */}

Saldo ao final do período

{status} {accountType}
{/* Linha 3 — breakdown financeiro */}
{formatCurrency(openingBalance)} {formatCurrency(totalIncomes)} {formatCurrency(totalExpenses)} = 0 ? "text-success" : "text-destructive", )} > {resultado >= 0 ? "+" : ""} {formatCurrency(resultado)}
); } function MetaItem({ label, tooltip, children, }: { label: string; tooltip: string; children: ReactNode; }) { return (
{label} {tooltip}
{children}
); }