feat: redesign weight summary legend and add currency selector
Redesign WeightSummaryCard stats from a disconnected 4-column grid to a compact legend-style list with color dots, percentages, and a divider before the total row. Switch chart and legend colors to a neutral gray palette. Add a currency selector to settings (USD, EUR, GBP, JPY, CAD, AUD) that changes the displayed symbol across the app. This is visual only — no value conversion is performed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
|
||||
import { useState } from "react";
|
||||
import { CategoryHeader } from "../../components/CategoryHeader";
|
||||
import { ClassificationBadge } from "../../components/ClassificationBadge";
|
||||
import { ItemCard } from "../../components/ItemCard";
|
||||
import { ItemPicker } from "../../components/ItemPicker";
|
||||
import { WeightSummaryCard } from "../../components/WeightSummaryCard";
|
||||
@@ -11,6 +10,7 @@ import {
|
||||
useSetup,
|
||||
useUpdateItemClassification,
|
||||
} from "../../hooks/useSetups";
|
||||
import { useCurrency } from "../../hooks/useCurrency";
|
||||
import { useWeightUnit } from "../../hooks/useWeightUnit";
|
||||
import { formatPrice, formatWeight } from "../../lib/formatters";
|
||||
import { LucideIcon } from "../../lib/iconData";
|
||||
@@ -22,6 +22,7 @@ export const Route = createFileRoute("/setups/$setupId")({
|
||||
function SetupDetailPage() {
|
||||
const { setupId } = Route.useParams();
|
||||
const unit = useWeightUnit();
|
||||
const currency = useCurrency();
|
||||
const navigate = useNavigate();
|
||||
const numericId = Number(setupId);
|
||||
const { data: setup, isLoading } = useSetup(numericId);
|
||||
@@ -107,9 +108,18 @@ function SetupDetailPage() {
|
||||
{/* Setup-specific sticky bar */}
|
||||
<div className="sticky top-14 z-[9] bg-gray-50 border-b border-gray-100 -mx-4 sm:-mx-6 lg:-mx-8 px-4 sm:px-6 lg:px-8">
|
||||
<div className="flex items-center justify-between h-12">
|
||||
<h2 className="text-base font-semibold text-gray-900 truncate">
|
||||
{setup.name}
|
||||
</h2>
|
||||
<div className="flex items-center gap-3 min-w-0">
|
||||
<Link
|
||||
to="/collection"
|
||||
search={{ tab: "setups" }}
|
||||
className="text-sm text-gray-500 hover:text-gray-700 shrink-0"
|
||||
>
|
||||
←
|
||||
</Link>
|
||||
<h2 className="text-base font-semibold text-gray-900 truncate">
|
||||
{setup.name}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="flex items-center gap-4 text-sm text-gray-500">
|
||||
<span>
|
||||
<span className="font-medium text-gray-700">{itemCount}</span>{" "}
|
||||
@@ -123,7 +133,7 @@ function SetupDetailPage() {
|
||||
</span>
|
||||
<span>
|
||||
<span className="font-medium text-gray-700">
|
||||
{formatPrice(totalCost)}
|
||||
{formatPrice(totalCost, currency)}
|
||||
</span>{" "}
|
||||
cost
|
||||
</span>
|
||||
@@ -219,32 +229,27 @@ function SetupDetailPage() {
|
||||
/>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{categoryItems.map((item) => (
|
||||
<div key={item.id}>
|
||||
<ItemCard
|
||||
id={item.id}
|
||||
name={item.name}
|
||||
weightGrams={item.weightGrams}
|
||||
priceCents={item.priceCents}
|
||||
categoryName={categoryName}
|
||||
categoryIcon={categoryIcon}
|
||||
imageFilename={item.imageFilename}
|
||||
productUrl={item.productUrl}
|
||||
onRemove={() => removeItem.mutate(item.id)}
|
||||
/>
|
||||
<div className="px-4 pb-3 -mt-1">
|
||||
<ClassificationBadge
|
||||
classification={item.classification}
|
||||
onCycle={() =>
|
||||
updateClassification.mutate({
|
||||
itemId: item.id,
|
||||
classification: nextClassification(
|
||||
item.classification,
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<ItemCard
|
||||
key={item.id}
|
||||
id={item.id}
|
||||
name={item.name}
|
||||
weightGrams={item.weightGrams}
|
||||
priceCents={item.priceCents}
|
||||
categoryName={categoryName}
|
||||
categoryIcon={categoryIcon}
|
||||
imageFilename={item.imageFilename}
|
||||
productUrl={item.productUrl}
|
||||
onRemove={() => removeItem.mutate(item.id)}
|
||||
classification={item.classification}
|
||||
onClassificationCycle={() =>
|
||||
updateClassification.mutate({
|
||||
itemId: item.id,
|
||||
classification: nextClassification(
|
||||
item.classification,
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user