feat: add initial balance support to accounts, enhancing account management and balance calculations across components
This commit is contained in:
@@ -7,6 +7,7 @@ import { Building2, GripVertical, Pencil } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import Link from "next/link";
|
||||
import type { Account } from "@/lib/types";
|
||||
import { getAccountBalance } from "@/lib/account-utils";
|
||||
|
||||
interface DraggableAccountItemProps {
|
||||
account: Account;
|
||||
@@ -19,6 +20,7 @@ export function DraggableAccountItem({
|
||||
onEditAccount,
|
||||
formatCurrency,
|
||||
}: DraggableAccountItemProps) {
|
||||
const realBalance = getAccountBalance(account);
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
@@ -71,10 +73,10 @@ export function DraggableAccountItem({
|
||||
<span
|
||||
className={cn(
|
||||
"text-sm tabular-nums",
|
||||
account.balance >= 0 ? "text-emerald-600" : "text-red-600"
|
||||
realBalance >= 0 ? "text-emerald-600" : "text-red-600"
|
||||
)}
|
||||
>
|
||||
{formatCurrency(account.balance)}
|
||||
{formatCurrency(realBalance)}
|
||||
</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
|
||||
Reference in New Issue
Block a user