Fix budget SelectValue showing ID instead of name in edit dialog

Pass budget name as explicit children to SelectValue so the selected
label renders correctly. Also handle TRANSFER type display in the header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 20:28:36 -04:00
parent 6f1376cc53
commit 3c13ae3597

View File

@@ -80,8 +80,8 @@ export function EditTransactionDialog({ transaction, onOpenChange, budgets }: Pr
{transaction.description} {transaction.description}
</DialogTitle> </DialogTitle>
<p className="text-sm text-muted-foreground"> <p className="text-sm text-muted-foreground">
{date} · <span className={transaction.type === 'CREDIT' ? 'text-green-600' : ''}> {date} · <span className={transaction.type === 'CREDIT' ? 'text-green-600' : transaction.type === 'TRANSFER' ? 'text-muted-foreground' : ''}>
{transaction.type === 'CREDIT' ? '+' : '-'}{formatCents(transaction.amountCents)} {transaction.type === 'TRANSFER' ? '⇄ ' : transaction.type === 'CREDIT' ? '+' : '-'}{formatCents(transaction.amountCents)}
</span> </span>
</p> </p>
</DialogHeader> </DialogHeader>
@@ -101,7 +101,11 @@ export function EditTransactionDialog({ transaction, onOpenChange, budgets }: Pr
<Label htmlFor="budget">Budget</Label> <Label htmlFor="budget">Budget</Label>
<Select value={budgetId} onValueChange={(v) => setBudgetId(v ?? '')}> <Select value={budgetId} onValueChange={(v) => setBudgetId(v ?? '')}>
<SelectTrigger id="budget"> <SelectTrigger id="budget">
<SelectValue placeholder="No budget" /> <SelectValue placeholder="No budget">
{budgetId
? (budgets.find((b) => b.id === budgetId)?.name ?? 'No budget')
: 'No budget'}
</SelectValue>
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="">No budget</SelectItem> <SelectItem value="">No budget</SelectItem>