"use client";
import { cn } from "@/lib/utils/ui";
import {
RiArrowLeftRightLine,
RiDeleteBin5Line,
RiEyeOffLine,
RiFileList2Line,
RiPencilLine,
} from "@remixicon/react";
import type React from "react";
import MoneyValues from "../money-values";
import { Card, CardContent, CardFooter } from "../ui/card";
interface AccountCardProps {
accountName: string;
accountType: string;
balance: number;
status?: string;
icon?: React.ReactNode;
excludeFromBalance?: boolean;
onViewStatement?: () => void;
onEdit?: () => void;
onRemove?: () => void;
onTransfer?: () => void;
className?: string;
}
export function AccountCard({
accountName,
accountType,
balance,
status,
icon,
excludeFromBalance,
onViewStatement,
onEdit,
onRemove,
onTransfer,
className,
}: AccountCardProps) {
const isInactive = status?.toLowerCase() === "inativa";
const actions = [
{
label: "editar",
icon: ,
onClick: onEdit,
variant: "default" as const,
},
{
label: "extrato",
icon: ,
onClick: onViewStatement,
variant: "default" as const,
},
{
label: "transferir",
icon: ,
onClick: onTransfer,
variant: "default" as const,
},
{
label: "remover",
icon: ,
onClick: onRemove,
variant: "destructive" as const,
},
].filter((action) => typeof action.onClick === "function");
return (
{icon ? (
{icon}
) : null}
{accountName}
{excludeFromBalance ? (
) : null}
{actions.length > 0 ? (
{actions.map(({ label, icon, onClick, variant }) => (
))}
) : null}
);
}