From bcd6d97ff42fed26dc14aeae3621913d65a3199d Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Sun, 6 Sep 2026 01:24:21 -0400 Subject: [PATCH] refactor(market): pass currency config through negotiation panel Renders negotiation amounts from the full CurrencyConfig, matching the other market components. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .../frontend/market/NegotiationPanel.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/frontend/market/NegotiationPanel.tsx b/src/components/frontend/market/NegotiationPanel.tsx index d90dc9e..6e4085c 100644 --- a/src/components/frontend/market/NegotiationPanel.tsx +++ b/src/components/frontend/market/NegotiationPanel.tsx @@ -6,7 +6,7 @@ import type { Asset, MarketListing, MarketNegotiation } from "@/payload-types"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { formatAmount } from "@/lib/banking/format"; +import { formatAmount, type CurrencyConfig } from "@/lib/banking/format"; import { acceptMarketOffer, cancelMarketOffer, @@ -70,11 +70,11 @@ function counterpartyLabel(negotiation: MarketNegotiation, role: "buyer" | "sell function NegotiationRow({ negotiation, role, - currencyLabel, + currencyConfig, }: { negotiation: MarketNegotiation; role: "buyer" | "seller"; - currencyLabel: string | null; + currencyConfig: CurrencyConfig; }) { const router = useRouter(); const [busy, setBusy] = useState(null); @@ -87,7 +87,7 @@ function NegotiationRow({ const theirProposal = (role === "buyer" && negotiation.proposedBy === "seller") || (role === "seller" && negotiation.proposedBy === "buyer"); - const fmt = (n: number) => formatAmount(n, { name: currencyLabel ?? undefined }); + const fmt = (n: number) => formatAmount(n, currencyConfig); async function run(action: () => Promise<{ success: boolean; error?: string }>, key: string) { setBusy(key); @@ -116,8 +116,6 @@ function NegotiationRow({ void run(() => counterMarketOffer(negotiation.id, value), "counter"); } - const showActions = isOpen && theirProposal; - return (
@@ -221,13 +219,13 @@ function NegotiationRow({ interface NegotiationPanelProps { negotiations: MarketNegotiation[]; currentUserId: number; - currencyLabel: string | null; + currencyConfig: CurrencyConfig; } export function NegotiationPanel({ negotiations, currentUserId, - currencyLabel, + currencyConfig, }: NegotiationPanelProps) { const open = negotiations.filter((n) => n.status === "open"); const closed = negotiations.filter((n) => n.status !== "open"); @@ -250,7 +248,7 @@ export function NegotiationPanel({
@@ -269,7 +267,7 @@ export function NegotiationPanel({ key={negotiation.id} negotiation={negotiation} role={role} - currencyLabel={currencyLabel} + currencyConfig={currencyConfig} /> ); })}