feat(07-02): add weight unit toggle and wire all formatWeight call sites
- Add segmented g/oz/lb/kg toggle to TotalsBar with settings persistence - Pass unit parameter to all 8 formatWeight call sites across components and routes - Import useWeightUnit hook in ItemCard, CandidateCard, CategoryHeader, SetupCard, ItemPicker, Dashboard, SetupDetail Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useWeightUnit } from "../hooks/useWeightUnit";
|
||||
import { formatPrice, formatWeight } from "../lib/formatters";
|
||||
import { LucideIcon } from "../lib/iconData";
|
||||
import { useUIStore } from "../stores/uiStore";
|
||||
@@ -27,6 +28,7 @@ export function CandidateCard({
|
||||
threadId,
|
||||
isActive,
|
||||
}: CandidateCardProps) {
|
||||
const unit = useWeightUnit();
|
||||
const openCandidateEditPanel = useUIStore((s) => s.openCandidateEditPanel);
|
||||
const openConfirmDeleteCandidate = useUIStore(
|
||||
(s) => s.openConfirmDeleteCandidate,
|
||||
@@ -88,7 +90,7 @@ export function CandidateCard({
|
||||
<div className="flex flex-wrap gap-1.5 mb-3">
|
||||
{weightGrams != null && (
|
||||
<span className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-50 text-blue-400">
|
||||
{formatWeight(weightGrams)}
|
||||
{formatWeight(weightGrams, unit)}
|
||||
</span>
|
||||
)}
|
||||
{priceCents != null && (
|
||||
|
||||
Reference in New Issue
Block a user