fix(arayüz): erişilebilirlik ve telefon düzeni taraması (kontrast, dokunma alanı, taşma, %80 bütçe uyarısı, boş durumlar)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { formatMoney } from '@/lib/format'
|
||||
import { TriangleAlert } from 'lucide-react'
|
||||
import { budgetLevel } from '@/lib/budget-level'
|
||||
import { formatMoney, formatPercent } from '@/lib/format'
|
||||
import { group } from '@/lib/groups'
|
||||
import { t } from '@/lib/strings'
|
||||
import { cn } from '@/lib/utils'
|
||||
@@ -20,6 +22,7 @@ export function WeekSummary({ budget, index }: { budget: GroupBudget[]; index: n
|
||||
const planned = index === 'month' ? b.monthly : (w?.amount ?? 0)
|
||||
const spent = index === 'month' ? b.spent : (w?.spent ?? 0)
|
||||
const left = planned - spent
|
||||
const level = budgetLevel(spent, planned)
|
||||
const over = left < 0
|
||||
const ratio = planned > 0 ? Math.min(spent / planned, 1) : spent > 0 ? 1 : 0
|
||||
return (
|
||||
@@ -41,10 +44,19 @@ export function WeekSummary({ budget, index }: { budget: GroupBudget[]; index: n
|
||||
aria-valuenow={Math.round(ratio * 100)}
|
||||
>
|
||||
<div
|
||||
className={cn('h-full rounded-full', over ? 'bg-expense' : g.className.fill)}
|
||||
className={cn(
|
||||
'h-full rounded-full',
|
||||
over ? 'bg-expense' : level === 'near' ? 'bg-warning' : g.className.fill,
|
||||
)}
|
||||
style={{ width: `${ratio * 100}%` }}
|
||||
/>
|
||||
</div>
|
||||
{level === 'near' && (
|
||||
<p className="mb-1 flex items-center gap-1 text-xs font-medium text-warning">
|
||||
<TriangleAlert className="size-3.5 shrink-0" aria-hidden />
|
||||
{s.near(formatPercent(spent / planned, 0))}
|
||||
</p>
|
||||
)}
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{s.spent} <span className="money">{formatMoney(spent)}</span> / {s.budget}{' '}
|
||||
<span className="money">{formatMoney(planned)}</span>
|
||||
|
||||
Reference in New Issue
Block a user