feat(06-02): display item_tier badge in tracker table rows

- Add Badge import to BillsTracker, VariableExpenses, DebtTracker
- Render outline Badge after category name showing tier (Fixed/Variable/One-off)
- Use i18n keys template.fixed, template.variable, template.oneOff
- Badge is purely informational with variant="outline" for subtle appearance
This commit is contained in:
2026-03-12 13:09:27 +01:00
parent 7dfd04f31b
commit 234a7d913a
3 changed files with 21 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import type { BudgetDetail } from '@/lib/api'
import { formatCurrency } from '@/lib/format' import { formatCurrency } from '@/lib/format'
import { headerGradient, amountColorClass, palette } from '@/lib/palette' import { headerGradient, amountColorClass, palette } from '@/lib/palette'
import { InlineEditCell } from '@/components/InlineEditCell' import { InlineEditCell } from '@/components/InlineEditCell'
import { Badge } from '@/components/ui/badge'
interface Props { interface Props {
budget: BudgetDetail budget: BudgetDetail
@@ -76,7 +77,12 @@ export function BillsTracker({ budget, onUpdate }: Props) {
: undefined : undefined
} }
> >
<TableCell>{item.category_name}</TableCell> <TableCell>
{item.category_name}
<Badge variant="outline" className="ml-2 text-xs font-normal">
{t(`template.${item.item_tier === 'one_off' ? 'oneOff' : item.item_tier}`)}
</Badge>
</TableCell>
<TableCell className="text-right"> <TableCell className="text-right">
{formatCurrency(item.budgeted_amount, budget.currency)} {formatCurrency(item.budgeted_amount, budget.currency)}
</TableCell> </TableCell>

View File

@@ -7,6 +7,7 @@ import type { BudgetDetail } from '@/lib/api'
import { formatCurrency } from '@/lib/format' import { formatCurrency } from '@/lib/format'
import { headerGradient, amountColorClass, palette } from '@/lib/palette' import { headerGradient, amountColorClass, palette } from '@/lib/palette'
import { InlineEditCell } from '@/components/InlineEditCell' import { InlineEditCell } from '@/components/InlineEditCell'
import { Badge } from '@/components/ui/badge'
interface Props { interface Props {
budget: BudgetDetail budget: BudgetDetail
@@ -76,7 +77,12 @@ export function DebtTracker({ budget, onUpdate }: Props) {
: undefined : undefined
} }
> >
<TableCell>{item.category_name}</TableCell> <TableCell>
{item.category_name}
<Badge variant="outline" className="ml-2 text-xs font-normal">
{t(`template.${item.item_tier === 'one_off' ? 'oneOff' : item.item_tier}`)}
</Badge>
</TableCell>
<TableCell className="text-right"> <TableCell className="text-right">
{formatCurrency(item.budgeted_amount, budget.currency)} {formatCurrency(item.budgeted_amount, budget.currency)}
</TableCell> </TableCell>

View File

@@ -8,6 +8,7 @@ import type { BudgetDetail } from '@/lib/api'
import { formatCurrency } from '@/lib/format' import { formatCurrency } from '@/lib/format'
import { headerGradient, amountColorClass, palette } from '@/lib/palette' import { headerGradient, amountColorClass, palette } from '@/lib/palette'
import { InlineEditCell } from '@/components/InlineEditCell' import { InlineEditCell } from '@/components/InlineEditCell'
import { Badge } from '@/components/ui/badge'
interface Props { interface Props {
budget: BudgetDetail budget: BudgetDetail
@@ -86,7 +87,12 @@ export function VariableExpenses({ budget, onUpdate }: Props) {
: undefined : undefined
} }
> >
<TableCell>{item.category_name}</TableCell> <TableCell>
{item.category_name}
<Badge variant="outline" className="ml-2 text-xs font-normal">
{t(`template.${item.item_tier === 'one_off' ? 'oneOff' : item.item_tier}`)}
</Badge>
</TableCell>
<TableCell className="text-right"> <TableCell className="text-right">
{formatCurrency(item.budgeted_amount, budget.currency)} {formatCurrency(item.budgeted_amount, budget.currency)}
</TableCell> </TableCell>