fix(i18n): localize /katalog filters, /katalog/[id] full rewrite, /portal/subscriptions

Three missed files from the i18n pass:
- /katalog: FILTERS had hardcoded Swedish labels (Alla/Bolag/Beslutsfattare/Fordon/Finansiellt)
- /katalog/[id]: entire page was Swedish — CATALOG data, TABS (with variable-shadowing bug
  where map((t) shadowed useT()), SectionHead, all 5 tab bodies, order rail, PROVENANCE_LEGEND
  rendered as raw Loc object. Converted to stable TabKey enum + all Loc.
- /portal/subscriptions: useT imported but never called; title/labels/options all Swedish.

tsc 0 + build green.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-06-25 16:31:07 +02:00
co-authored by Claude Sonnet 4.6
parent f4beca3f76
commit a928ae4e98
3 changed files with 207 additions and 202 deletions
+163 -184
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -22,12 +22,12 @@ interface CatalogItem {
confidence: number;
}
const FILTERS: { key: string; label: string }[] = [
{ key: "all", label: "Alla" },
{ key: "company", label: "Bolag" },
{ key: "contact", label: "Beslutsfattare" },
{ key: "vehicle", label: "Fordon" },
{ key: "financials", label: "Finansiellt" },
const FILTERS: { key: string; label: { en: string; sv: string } }[] = [
{ key: "all", label: { en: "All", sv: "Alla" } },
{ key: "company", label: { en: "Companies", sv: "Bolag" } },
{ key: "contact", label: { en: "Decision-makers", sv: "Beslutsfattare" } },
{ key: "vehicle", label: { en: "Vehicles", sv: "Fordon" } },
{ key: "financials", label: { en: "Financials", sv: "Finansiellt" } },
];
function level(c: number): ProvLevel {
@@ -97,7 +97,7 @@ export default function CatalogPage() {
color: filter === f.key ? "var(--background)" : "var(--foreground)",
}}
>
{f.label}
{t(f.label)}
</button>
))}
</div>
+37 -11
View File
@@ -14,6 +14,7 @@ interface Sub {
}
export default function SubscriptionsPage() {
const t = useT();
const [subs, setSubs] = useState<Sub[] | null>(null);
const [error, setError] = useState(false);
const [orderId, setOrderId] = useState("");
@@ -37,28 +38,53 @@ export default function SubscriptionsPage() {
}
return (
<PortalShell variant="customer" title="Prenumerationer & flöden">
<PortalShell variant="customer" title={t({ en: "Subscriptions & flows", sv: "Prenumerationer & flöden" })}>
<div className="border border-border p-5">
<p className="font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground">Gör om en order till ett flöde</p>
<p className="font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground">
{t({ en: "Convert an order into a flow", sv: "Gör om en order till ett flöde" })}
</p>
<div className="mt-4 flex flex-wrap items-end gap-3">
<input value={orderId} onChange={(e) => setOrderId(e.target.value)} placeholder="order_id" className="border border-border bg-input px-3 py-2 font-mono text-xs outline-none focus:border-foreground" />
<select value={cadence} onChange={(e) => setCadence(e.target.value)} className="border border-border bg-input px-3 py-2 font-mono text-xs outline-none focus:border-foreground">
<option value="weekly">Veckovis</option>
<option value="daily">Dagligt</option>
<input
value={orderId}
onChange={(e) => setOrderId(e.target.value)}
placeholder="order_id"
className="border border-border bg-input px-3 py-2 font-mono text-xs outline-none focus:border-foreground"
/>
<select
value={cadence}
onChange={(e) => setCadence(e.target.value)}
className="border border-border bg-input px-3 py-2 font-mono text-xs outline-none focus:border-foreground"
>
<option value="weekly">{t({ en: "Weekly", sv: "Veckovis" })}</option>
<option value="daily">{t({ en: "Daily", sv: "Dagligt" })}</option>
</select>
<button onClick={create} disabled={busy || !orderId} className="bg-foreground px-5 py-2 font-mono text-[11px] uppercase tracking-[0.1em] text-background transition-colors hover:bg-[var(--accent-red)] disabled:opacity-50">
{busy ? "Skapar…" : "Skapa flöde"}
<button
onClick={create}
disabled={busy || !orderId}
className="bg-foreground px-5 py-2 font-mono text-[11px] uppercase tracking-[0.1em] text-background transition-colors hover:bg-[var(--accent-red)] disabled:opacity-50"
>
{busy ? t({ en: "Creating…", sv: "Skapar…" }) : t({ en: "Create flow", sv: "Skapa flöde" })}
</button>
</div>
</div>
<div className="mt-8">
{error ? <ErrorState onRetry={load} /> : !subs ? <LoadingSkeleton rows={4} /> : subs.length === 0 ? (
<EmptyState title="Inga flöden än." line="Gör om en order till ett återkommande flöde." />
{error ? (
<ErrorState onRetry={load} />
) : !subs ? (
<LoadingSkeleton rows={4} />
) : subs.length === 0 ? (
<EmptyState
title={t({ en: "No flows yet.", sv: "Inga flöden än." })}
line={t({ en: "Convert an order into a recurring flow.", sv: "Gör om en order till ett återkommande flöde." })}
/>
) : (
<div className="border border-border">
<div className="grid grid-cols-[1.6fr_1fr_1fr_1fr] border-b border-border bg-secondary/50 px-4 py-2.5 font-mono text-[10px] uppercase tracking-[0.1em] text-muted-foreground">
<span>Order</span><span>Kadens</span><span>Status</span><span>Webhook</span>
<span>{t({ en: "Order", sv: "Order" })}</span>
<span>{t({ en: "Cadence", sv: "Kadens" })}</span>
<span>{t({ en: "Status", sv: "Status" })}</span>
<span>{t({ en: "Webhook", sv: "Webhook" })}</span>
</div>
{subs.map((s) => (
<div key={s.sub_id} className="grid grid-cols-[1.6fr_1fr_1fr_1fr] items-center border-b border-border px-4 py-3 text-sm last:border-b-0">