diff --git a/app/bestall/forskott/page.tsx b/app/bestall/forskott/page.tsx index 6f07b07..db93b98 100644 --- a/app/bestall/forskott/page.tsx +++ b/app/bestall/forskott/page.tsx @@ -6,7 +6,10 @@ import { useEffect, useState } from "react"; import { OrderStepper } from "@/components/order-stepper"; import { useT } from "@/components/locale-provider"; import { useReveal } from "@/hooks/use-reveal"; -import { formatSEK, computeEstimate, type Estimate } from "@/lib/data"; +import { + formatSEK, computeEstimate, entityLabel, FREQUENCY_LABEL, + type Estimate, type EntityType, type Frequency, +} from "@/lib/data"; const FALLBACK: Estimate = computeEstimate({ markets: ["SE", "NO", "DK", "FI"], @@ -50,7 +53,9 @@ const RECAP_LABELS: Record = { export default function DepositPage() { const t = useT(); const [est, setEst] = useState(FALLBACK); - const [recap, setRecap] = useState>({}); + const [recap, setRecap] = useState<{ markets: string; type: EntityType; volume: string; frequency: Frequency }>({ + markets: "SE · NO · DK · FI", type: "Bolag", volume: "5 000", frequency: "Engångs", + }); const [orderId, setOrderId] = useState(null); const [paying, setPaying] = useState(false); const reveal = useReveal(); @@ -64,9 +69,9 @@ export default function DepositPage() { if (o.est) setEst(o.est); setRecap({ markets: (o.markets || []).join(" · "), - type: o.type, + type: (o.type as EntityType) || "Bolag", volume: new Intl.NumberFormat("sv-SE").format(o.volume || 0), - frequency: o.frequency, + frequency: (o.frequency as Frequency) || "Engångs", }); } } catch {} @@ -86,9 +91,9 @@ export default function DepositPage() { const c = o.config || {}; setRecap({ markets: (c.markets || []).join(" · "), - type: c.type, + type: (c.type as EntityType) || "Bolag", volume: new Intl.NumberFormat("sv-SE").format(c.volume || 0), - frequency: c.frequency, + frequency: (c.frequency as Frequency) || "Engångs", }); }) .catch(() => {}); @@ -234,16 +239,22 @@ export default function DepositPage() { {t({ en: "Your order", sv: "Din beställning" })}

- {Object.entries(recap).map(([k, v]) => ( -
-
- {RECAP_LABELS[k] ? t(RECAP_LABELS[k]) : k} -
-
- {v || "—"} -
-
- ))} +
+
{t(RECAP_LABELS.markets)}
+
{recap.markets || "—"}
+
+
+
{t(RECAP_LABELS.type)}
+
{t(entityLabel(recap.type))}
+
+
+
{t(RECAP_LABELS.volume)}
+
{recap.volume || "—"}
+
+
+
{t(RECAP_LABELS.frequency)}
+
{t(FREQUENCY_LABEL[recap.frequency] ?? { en: recap.frequency, sv: recap.frequency })}
+