Move UI to BoardUI with slate + salmon theme; add PDF plan export
- Adopt BoardUI (Pro init): theme tokens, Inter, .dark mode, Button,
SegmentedControl, Meter, Skeleton and ThemeToggle; remap the app's
color aliases onto BoardUI tokens and swap lucide for Remix icons
- Retint BoardUI's neutral ramp to cool slate with a salmon accent;
drop the dotted background; raise muted text contrast
- Simplify the landing page and remove the overlap explorer
- Planner: explicit "I have this" toggle on grocery lines, pantry panel
above the menu with the staples list spelled out, sticky aisle
header fix, and a "Download PDF" plan export (jsPDF, lazy-loaded)
- Recipes: replace the family cabbage soup with Cade's Cabbage Soup
(adds Bone-In Ham Steak to the catalog); remove Ham, Bean & Cabbage Soup
- Remove unused BoardUI components, dependencies and exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:36:33 -06:00
|
|
|
import { Meter, type MeterTone } from "@/components/base/meter/meter";
|
2026-10-31 20:44:29 -05:00
|
|
|
import { formatUsd } from "@/app/lib/units";
|
|
|
|
|
|
Move UI to BoardUI with slate + salmon theme; add PDF plan export
- Adopt BoardUI (Pro init): theme tokens, Inter, .dark mode, Button,
SegmentedControl, Meter, Skeleton and ThemeToggle; remap the app's
color aliases onto BoardUI tokens and swap lucide for Remix icons
- Retint BoardUI's neutral ramp to cool slate with a salmon accent;
drop the dotted background; raise muted text contrast
- Simplify the landing page and remove the overlap explorer
- Planner: explicit "I have this" toggle on grocery lines, pantry panel
above the menu with the staples list spelled out, sticky aisle
header fix, and a "Download PDF" plan export (jsPDF, lazy-loaded)
- Recipes: replace the family cabbage soup with Cade's Cabbage Soup
(adds Bone-In Ham Steak to the catalog); remove Ham, Bean & Cabbage Soup
- Remove unused BoardUI components, dependencies and exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:36:33 -06:00
|
|
|
/** Success under 85%, warning up to 100%, error over budget. */
|
|
|
|
|
function budgetTone(spent: number, budget: number): { tone: MeterTone; text: string; label: string } {
|
2026-10-31 20:44:29 -05:00
|
|
|
const ratio = budget > 0 ? spent / budget : 0;
|
Move UI to BoardUI with slate + salmon theme; add PDF plan export
- Adopt BoardUI (Pro init): theme tokens, Inter, .dark mode, Button,
SegmentedControl, Meter, Skeleton and ThemeToggle; remap the app's
color aliases onto BoardUI tokens and swap lucide for Remix icons
- Retint BoardUI's neutral ramp to cool slate with a salmon accent;
drop the dotted background; raise muted text contrast
- Simplify the landing page and remove the overlap explorer
- Planner: explicit "I have this" toggle on grocery lines, pantry panel
above the menu with the staples list spelled out, sticky aisle
header fix, and a "Download PDF" plan export (jsPDF, lazy-loaded)
- Recipes: replace the family cabbage soup with Cade's Cabbage Soup
(adds Bone-In Ham Steak to the catalog); remove Ham, Bean & Cabbage Soup
- Remove unused BoardUI components, dependencies and exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:36:33 -06:00
|
|
|
if (ratio > 1) return { tone: "error", text: "text-status-danger", label: "Over budget" };
|
|
|
|
|
if (ratio > 0.85) return { tone: "warning", text: "text-status-warn", label: "Close to budget" };
|
|
|
|
|
return { tone: "success", text: "text-status-ok", label: "Under budget" };
|
2026-10-31 20:44:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface BudgetMeterProps {
|
|
|
|
|
spent: number;
|
|
|
|
|
budget: number;
|
|
|
|
|
compact?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function BudgetMeter({ spent, budget, compact = false }: BudgetMeterProps) {
|
|
|
|
|
const tone = budgetTone(spent, budget);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={compact ? "w-full" : "w-full min-w-48"}>
|
Move UI to BoardUI with slate + salmon theme; add PDF plan export
- Adopt BoardUI (Pro init): theme tokens, Inter, .dark mode, Button,
SegmentedControl, Meter, Skeleton and ThemeToggle; remap the app's
color aliases onto BoardUI tokens and swap lucide for Remix icons
- Retint BoardUI's neutral ramp to cool slate with a salmon accent;
drop the dotted background; raise muted text contrast
- Simplify the landing page and remove the overlap explorer
- Planner: explicit "I have this" toggle on grocery lines, pantry panel
above the menu with the staples list spelled out, sticky aisle
header fix, and a "Download PDF" plan export (jsPDF, lazy-loaded)
- Recipes: replace the family cabbage soup with Cade's Cabbage Soup
(adds Bone-In Ham Steak to the catalog); remove Ham, Bean & Cabbage Soup
- Remove unused BoardUI components, dependencies and exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:36:33 -06:00
|
|
|
<div className="flex items-baseline justify-between gap-2">
|
|
|
|
|
<span className={`text-body-medium tabular-nums ${tone.text}`}>{formatUsd(spent)}</span>
|
|
|
|
|
<span className="text-caption-1-medium text-text-secondary tabular-nums">/ {formatUsd(budget)}</span>
|
2026-10-31 20:44:29 -05:00
|
|
|
</div>
|
Move UI to BoardUI with slate + salmon theme; add PDF plan export
- Adopt BoardUI (Pro init): theme tokens, Inter, .dark mode, Button,
SegmentedControl, Meter, Skeleton and ThemeToggle; remap the app's
color aliases onto BoardUI tokens and swap lucide for Remix icons
- Retint BoardUI's neutral ramp to cool slate with a salmon accent;
drop the dotted background; raise muted text contrast
- Simplify the landing page and remove the overlap explorer
- Planner: explicit "I have this" toggle on grocery lines, pantry panel
above the menu with the staples list spelled out, sticky aisle
header fix, and a "Download PDF" plan export (jsPDF, lazy-loaded)
- Recipes: replace the family cabbage soup with Cade's Cabbage Soup
(adds Bone-In Ham Steak to the catalog); remove Ham, Bean & Cabbage Soup
- Remove unused BoardUI components, dependencies and exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:36:33 -06:00
|
|
|
<Meter
|
|
|
|
|
className="mt-1.5"
|
2026-10-31 20:44:29 -05:00
|
|
|
aria-label="Budget used"
|
Move UI to BoardUI with slate + salmon theme; add PDF plan export
- Adopt BoardUI (Pro init): theme tokens, Inter, .dark mode, Button,
SegmentedControl, Meter, Skeleton and ThemeToggle; remap the app's
color aliases onto BoardUI tokens and swap lucide for Remix icons
- Retint BoardUI's neutral ramp to cool slate with a salmon accent;
drop the dotted background; raise muted text contrast
- Simplify the landing page and remove the overlap explorer
- Planner: explicit "I have this" toggle on grocery lines, pantry panel
above the menu with the staples list spelled out, sticky aisle
header fix, and a "Download PDF" plan export (jsPDF, lazy-loaded)
- Recipes: replace the family cabbage soup with Cade's Cabbage Soup
(adds Bone-In Ham Steak to the catalog); remove Ham, Bean & Cabbage Soup
- Remove unused BoardUI components, dependencies and exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 16:36:33 -06:00
|
|
|
tone={tone.tone}
|
|
|
|
|
minValue={0}
|
|
|
|
|
maxValue={budget > 0 ? budget : 1}
|
|
|
|
|
value={Math.min(spent, budget > 0 ? budget : 0)}
|
|
|
|
|
valueLabel={`${formatUsd(spent)} of ${formatUsd(budget)}, ${tone.label.toLowerCase()}`}
|
|
|
|
|
/>
|
2026-10-31 20:44:29 -05:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|