This commit is contained in:
MatejGhub committed 2026-09-13 20:23:36 +02:00
1 parent 90abd6846c
commit ab0e80db18
16 files changed
+542 -527

No files matched your search

@@ -312,8 +312,8 @@
<div class="sr-only" aria-live="polite" aria-atomic="true">{announce}</div>
{#if navUi.commandPaletteOpen}
<div class="fixed inset-0 z-[60] bg-black/80" aria-hidden="true"></div>
<div class="fixed inset-0 z-[60] flex items-start justify-center p-4 pt-[min(20vh,8rem)] sm:p-6">
<div class="fixed inset-0 z-[120] bg-black/80" aria-hidden="true"></div>
<div class="fixed inset-0 z-[120] flex items-start justify-center p-4 pt-[min(20vh,8rem)] sm:p-6">
<button
type="button"
class="absolute inset-0 cursor-default"
@@ -327,7 +327,7 @@
aria-modal="true"
aria-label={i18n.t("commandPalette.ariaLabel")}
tabindex="-1"
class="relative z-[61] flex w-full max-w-lg flex-col overflow-hidden rounded-lg border bg-background shadow-lg lg:fixed lg:left-[17.5rem] lg:top-[4.5rem] lg:w-80 lg:max-w-none"
class="relative z-[121] flex w-full max-w-lg flex-col overflow-hidden rounded-lg border bg-background shadow-lg lg:fixed lg:left-[17.5rem] lg:top-[4.5rem] lg:w-80 lg:max-w-none"
onkeydown={onPanelKeydown}
onclick={(event) => event.stopPropagation()}
>
@@ -1,7 +1,7 @@
<script lang="ts">
import { i18n } from "$lib/i18n";
import { trackEvent } from "$lib/analytics";
import { Badge, Button, Label, Select } from "$lib/components/ui";
import { Button, Label, Select } from "$lib/components/ui";
import {
CONTENT_LANGUAGES,
parseContentLanguage,
@@ -14,7 +14,6 @@
languages = $bindable([] as string[]),
available = CONTENT_LANGUAGES,
configured = [] as string[],
hasOverride = (_code: string) => false,
primary = "",
allowAdd = true,
class: className = "",
@@ -26,7 +25,6 @@
available?: ContentLanguage[];
/** Company content languages (preferred order). */
configured?: string[];
hasOverride?: (code: string) => boolean;
primary?: string;
allowAdd?: boolean;
class?: string;
@@ -98,30 +96,40 @@
<Label>{i18n.t("contentLang.switcherLabel")}</Label>
<div class="flex flex-wrap items-center gap-2">
{#each tabs as code}
<Button
type="button"
size="sm"
variant={value === code ? "default" : "outline"}
onclick={() => select(code)}
>
{labelFor(code)}
{#if hasOverride(code)}
<Badge variant="secondary" class="ml-1">{i18n.t("contentLang.hasOverride")}</Badge>
{/if}
{#if code === primaryCode}
<span class="ml-1 text-xs opacity-70">{i18n.t("contentLang.primary")}</span>
{/if}
</Button>
{#if allowAdd && code !== primaryCode && languages.includes(code)}
{@const removable = allowAdd && code !== primaryCode && languages.includes(code)}
{#if removable}
<div class="inline-flex items-stretch overflow-hidden rounded-md">
<Button
type="button"
size="sm"
variant={value === code ? "default" : "outline"}
class="rounded-r-none"
onclick={() => select(code)}
>
{labelFor(code)}
</Button>
<Button
type="button"
size="sm"
variant={value === code ? "default" : "outline"}
class="rounded-l-none border-l-0 px-2"
onclick={() => remove(code)}
aria-label={i18n.t("contentLang.removeLanguage", { lang: labelFor(code) })}
>
<X class="h-3.5 w-3.5 opacity-70" />
</Button>
</div>
{:else}
<Button
type="button"
size="sm"
variant="ghost"
class="h-8 w-8 p-0"
onclick={() => remove(code)}
aria-label={i18n.t("contentLang.removeLanguage", { lang: labelFor(code) })}
variant={value === code ? "default" : "outline"}
onclick={() => select(code)}
>
<X class="h-3.5 w-3.5" />
{labelFor(code)}
{#if code === primaryCode}
<span class="ml-1 text-xs opacity-70">{i18n.t("contentLang.primary")}</span>
{/if}
</Button>
{/if}
{/each}
@@ -1,11 +1,10 @@
<script lang="ts">
import { i18n } from "$lib/i18n";
import CategoryTreeNode from "./CategoryTreeNode.svelte";
import { ChevronRight, MoreVertical } from "@lucide/svelte";
import CategoryTreeNode from "./CategoryTreeNode.svelte";
import { ChevronRight, Folder, FolderOpen, MoreVertical, Sparkles } from "@lucide/svelte";
import type { Cat } from "$lib/categories/types";
import { cn } from "$lib/utils";
import { Badge, Button } from "$lib/components/ui";
import { Button } from "$lib/components/ui";
type TreeNode = Cat & {
children: TreeNode[];
@@ -39,58 +38,71 @@ import CategoryTreeNode from "./CategoryTreeNode.svelte";
const nodeKey = $derived(String(node.id));
const menuOpen = $derived(menuOpenId === nodeKey);
const FolderIcon = $derived(node.hasChildren && node.isExpanded ? FolderOpen : Folder);
</script>
<div>
<div
class="group flex min-w-0 items-center gap-2 rounded-lg px-2 py-2 hover:bg-accent/50 sm:gap-3 sm:px-4"
class={cn(
"group relative flex min-w-0 items-center gap-2 rounded-md border border-transparent px-1.5 py-2 transition-colors sm:gap-2 sm:px-2",
"hover:border-border/70 hover:bg-muted/40",
menuOpen && "border-border/70 bg-muted/40",
node.is_active === false && "opacity-70"
)}
style={depth > 0 ? `margin-left: ${Math.min(depth, 4) * 0.75}rem` : undefined}
>
{#if depth > 0}
<span
class="pointer-events-none absolute -left-2 top-1/2 h-px w-2 -translate-y-1/2 bg-border sm:-left-2.5 sm:w-2.5"
aria-hidden="true"
></span>
{/if}
<div class="flex min-w-0 flex-1 items-center gap-2">
{#if node.hasChildren}
<Button
variant="ghost"
size="icon"
class="h-8 w-8 shrink-0 p-0"
class="h-7 w-7 shrink-0 p-0 text-muted-foreground"
onclick={() => onToggleExpand(node)}
aria-label={node.isExpanded ? i18n.t("catalog.collapse") : i18n.t("catalog.expand")}
>
<ChevronRight class={cn("h-4 w-4 transition-transform", node.isExpanded && "rotate-90")} />
</Button>
{:else}
<div class="h-8 w-8 shrink-0"></div>
{/if}
<div class="flex min-w-0 flex-1 items-center gap-2">
<span
class={cn(
"min-w-0 truncate font-medium",
node.is_active === false && "text-muted-foreground"
)}
title={node.name}
>
{node.name}
</span>
<Badge
variant="outline"
class="max-w-[9rem] min-w-0 shrink truncate text-xs sm:max-w-[14rem]"
title={String(node.unique_id ?? "")}
>
{node.unique_id}
</Badge>
{#if node.has_prompt}
<Badge variant="secondary" class="shrink-0 text-xs" title={i18n.t("categories.aiPromptSet")}>
AI prompt
</Badge>
{/if}
{#if node.has_title_formula}
<Badge variant="outline" class="hidden shrink-0 text-xs sm:inline-flex" title={i18n.t("categories.titleFormula")}>
Title
</Badge>
{/if}
{#if node.has_description_formula}
<Badge variant="outline" class="hidden shrink-0 text-xs sm:inline-flex" title={i18n.t("categories.descriptionFormula")}>
Desc
</Badge>
<div
class={cn(
"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-border/60 bg-muted/50 text-muted-foreground",
node.hasChildren && node.isExpanded && "border-primary/20 bg-primary/5 text-primary"
)}
aria-hidden="true"
>
<FolderIcon class="h-3.5 w-3.5" />
</div>
<div class="min-w-0 flex-1">
<div class="flex min-w-0 items-center gap-2">
<span class="min-w-0 truncate text-sm font-medium" title={node.name}>
{node.name}
</span>
{#if node.has_prompt}
<span
class="inline-flex shrink-0 items-center gap-1 rounded-md bg-card-blue px-1.5 py-0.5 text-[10px] font-medium text-foreground"
title={i18n.t("categories.aiPromptSet")}
>
<Sparkles class="h-3 w-3" aria-hidden="true" />
AI
</span>
{/if}
</div>
{#if node.unique_id}
<div
class="mt-0.5 truncate font-mono text-[11px] text-muted-foreground"
title={String(node.unique_id)}
>
{node.unique_id}
</div>
{/if}
</div>
</div>
@@ -106,7 +118,7 @@ import CategoryTreeNode from "./CategoryTreeNode.svelte";
<Button
variant="ghost"
size="icon"
class="h-9 w-9 sm:h-8 sm:w-8"
class="h-8 w-8"
aria-label={i18n.t("categories.actions")}
onclick={(e) => {
e.stopPropagation();
@@ -1,19 +1,14 @@
<script lang="ts">
import { i18n } from "$lib/i18n";
import { Badge } from "$lib/components/ui";
import type { FieldMappingRow, SchemaField, TargetField } from "./types";
import { STANDARD_FIELDS } from "./standard-fields";
import {
confidenceBadgeVariant,
type MappingSuggestion
} from "./suggest-mappings";
import type { MappingSuggestion } from "./suggest-mappings";
let {
itemPath = "",
rows = [],
fields = STANDARD_FIELDS,
fields: _fields = [],
schemaFields = [],
suggestions = [],
suggestions: _suggestions = [],
format = "xml",
samplePreview = ""
}: {
@@ -28,12 +23,6 @@
const mapped = $derived(rows.filter((r) => r.source.trim() && r.target && r.target !== "none"));
const suggestionByPair = $derived.by(() => {
const m = new Map<string, MappingSuggestion>();
for (const s of suggestions) m.set(`${s.source}\0${s.target}`, s);
return m;
});
const sampleByPath = $derived.by(() => {
const m = new Map<string, string>();
for (const f of schemaFields) {
@@ -44,23 +33,9 @@
return m;
});
function labelFor(target: string): string {
return fields.find((f) => f.value === target)?.label ?? target;
}
function sampleFor(source: string): string {
return sampleByPath.get(source) ?? sampleByPath.get(source.split("/").pop() ?? "") ?? source;
}
function formatSource(source: string): string {
const parts = source.split("/").filter(Boolean);
if (parts.length <= 1) return source;
return parts.join(" › ");
}
function suggestionFor(row: FieldMappingRow): MappingSuggestion | undefined {
return suggestionByPair.get(`${row.source.trim()}\0${row.target}`);
}
</script>
<div class="space-y-4">
@@ -103,24 +78,10 @@
<div class="mb-2 text-muted-foreground">&lt;product&gt;</div>
{#each mapped as row}
{@const sample = sampleFor(row.source)}
{@const suggestion = suggestionFor(row)}
<div class="ml-3 flex flex-wrap items-baseline gap-2 py-1">
<div class="ml-3 py-1">
<span class="text-primary">&lt;{row.target}&gt;</span>
<span class="text-foreground/80" title={`source: ${row.source}`}>{sample}</span>
<span class="text-primary">&lt;/{row.target}&gt;</span>
<Badge variant="outline" class="font-sans text-[10px]">{labelFor(row.target)}</Badge>
{#if suggestion}
<Badge
variant={confidenceBadgeVariant(suggestion.confidence)}
class="font-sans text-[10px] capitalize"
title={`${suggestion.confidence} · ${Math.round(suggestion.score * 100)}%`}
>
{suggestion.confidence}
</Badge>
{/if}
{#if row.source.includes("/")}
<span class="font-sans text-[10px] text-muted-foreground">{formatSource(row.source)}</span>
{/if}
</div>
{/each}
<div class="mt-2 text-muted-foreground">&lt;/product&gt;</div>
@@ -113,18 +113,17 @@
<Table shellClass="max-h-[480px]">
<TableHeader>
<TableRow>
<TableHead class="w-[36%]"
<TableHead class="w-[28%]"
>{isCsv ? i18n.t("mapping.table.fieldName") : i18n.t("mapping.table.sourcePath")}</TableHead
>
<TableHead class="w-[28%]">{i18n.t("mapping.table.sampleValues")}</TableHead>
<TableHead class="w-[12%]">{i18n.t("mapping.table.type")}</TableHead>
<TableHead class="w-[24%]">{i18n.t("mapping.table.mapTo")}</TableHead>
<TableHead class="w-[30%]">{i18n.t("mapping.table.sampleValues")}</TableHead>
<TableHead class="w-[42%]">{i18n.t("mapping.table.mapTo")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{#if filtered.length === 0}
<TableRow>
<TableCell colspan={4} class="py-10 text-center text-muted-foreground">
<TableCell colspan={3} class="py-10 text-center text-muted-foreground">
{#if schemaFields.length === 0}
{i18n.t("mapping.table.emptySchema")}
{:else}
@@ -139,7 +138,7 @@
{@const depth = pathDepth(field.path)}
{@const parent = pathParent(field.path)}
<TableRow>
<TableCell class="align-top">
<TableCell class="py-3 align-middle">
{#if isCsv && depth === 0}
<div class="text-sm font-medium">{field.field_name || field.path}</div>
{#if field.path !== field.field_name}
@@ -161,23 +160,29 @@
{/if}
</div>
{/if}
<div class="mt-1" style="padding-left: {Math.min(depth, 6) * 0.75}rem">
<div
class="mt-1.5 flex flex-wrap items-center gap-1.5"
style="padding-left: {Math.min(depth, 6) * 0.75}rem"
>
<Badge variant="outline" class="text-[10px]">
{i18n.t("mapping.table.unique", {
count: field.unique_values_count ?? samples.length
})}
</Badge>
<Badge variant="secondary" class={`text-[10px] ${typeClass(field.data_type || "string")}`}>
{field.data_type || "string"}
</Badge>
{#if depth > 0}
<Badge variant="secondary" class="ml-1 text-[10px]"
<Badge variant="secondary" class="text-[10px]"
>{i18n.t("mapping.table.nested")}</Badge
>
{/if}
</div>
</TableCell>
<TableCell class="align-top">
<div class="max-h-20 space-y-1 overflow-y-auto text-xs">
{#each samples.slice(0, 5) as val, i (i)}
<div class="break-all border-b border-border/60 pb-1 last:border-0">
<TableCell class="py-3 align-middle">
<div class="min-w-0 space-y-1 text-xs">
{#each samples.slice(0, 2) as val}
<div class="truncate" title={val}>
{val}
</div>
{/each}
@@ -186,12 +191,7 @@
{/if}
</div>
</TableCell>
<TableCell class="align-top">
<Badge variant="secondary" class={typeClass(field.data_type || "string")}>
{field.data_type || "string"}
</Badge>
</TableCell>
<TableCell class="align-top">
<TableCell class="py-3 align-middle">
{@const suggestion = suggestionBySource.get(field.path)}
{@const suggestionApplied = Boolean(
suggestion && current !== "none" && current === suggestion.target
@@ -520,12 +520,12 @@
</script>
{#if open}
<div class="fixed inset-0 z-[60] flex items-end justify-center sm:items-center sm:p-4 md:p-6">
<div class="fixed inset-0 z-[120] flex items-end justify-center sm:items-center sm:p-4 md:p-6">
<button type="button" class="absolute inset-0 bg-black/55" aria-label={i18n.t("catalog.closePanel")} onclick={close}
></button>
<div
bind:this={panelEl}
class="relative z-[60] flex h-[100dvh] w-full flex-col overflow-hidden border-border bg-background shadow-2xl sm:h-[min(92dvh,900px)] sm:max-w-5xl sm:rounded-xl sm:border lg:max-w-6xl"
class="relative z-[120] flex h-[100dvh] w-full flex-col overflow-hidden border-border bg-background shadow-2xl sm:h-[min(92dvh,900px)] sm:max-w-5xl sm:rounded-xl sm:border lg:max-w-6xl"
role="dialog"
aria-modal="true"
aria-labelledby="product-edit-title"
@@ -644,11 +644,6 @@
configured={contentLanguages}
primary={contentLanguages[0] || DEFAULT_CONTENT_LANGUAGE}
allowAdd={false}
hasOverride={(code) => {
const primary = contentLanguages[0] || DEFAULT_CONTENT_LANGUAGE;
if (code === primary) return false;
return Boolean(product?.localized_content?.[code]);
}}
onChange={(code) => applyContentLang(code)}
/>
<p class="text-xs text-muted-foreground">{i18n.t("contentLang.resultsHint")}</p>
@@ -9,11 +9,11 @@
</script>
{#if label === "completed"}
<Badge variant="success">{i18n.t("products.status.processed")}</Badge>
<Badge variant="success" class="whitespace-nowrap">{i18n.t("products.status.processed")}</Badge>
{:else if label === "processed" || label === "needs_review"}
<Badge variant="warning">{i18n.t("products.status.needsReview")}</Badge>
<Badge variant="warning" class="whitespace-nowrap">{i18n.t("products.status.needsReview")}</Badge>
{:else if label === "processing" || label === "in_progress"}
<Badge class="border-chart-sky/40 bg-card-blue text-foreground hover:bg-card-blue">
<Badge class="whitespace-nowrap border-chart-sky/40 bg-card-blue text-foreground hover:bg-card-blue">
<span class="flex items-center">
{i18n.t("products.status.processing")}
<span class="ml-1 flex space-x-1">
@@ -30,13 +30,13 @@
</span>
</Badge>
{:else if label === "error"}
<Badge variant="destructive">{i18n.t("products.status.error")}</Badge>
<Badge variant="destructive" class="whitespace-nowrap">{i18n.t("products.status.error")}</Badge>
{:else if label === "failed"}
<Badge variant="destructive">{i18n.t("products.status.failed")}</Badge>
<Badge variant="destructive" class="whitespace-nowrap">{i18n.t("products.status.failed")}</Badge>
{:else if label === "unprocessed"}
<Badge variant="warning">{i18n.t("products.status.unprocessed")}</Badge>
<Badge variant="warning" class="whitespace-nowrap">{i18n.t("products.status.unprocessed")}</Badge>
{:else if label === "pending"}
<Badge class="border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80">
<Badge class="whitespace-nowrap border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80">
<span class="flex items-center">
{i18n.t("products.status.pending")}
<span class="ml-1 flex space-x-1">
@@ -53,5 +53,5 @@
</span>
</Badge>
{:else}
<Badge variant="outline">{i18n.t("products.status.unknown")}</Badge>
<Badge variant="outline" class="whitespace-nowrap">{i18n.t("products.status.unknown")}</Badge>
{/if}
@@ -299,9 +299,9 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
]
: categoryOptions}
<div class="flex min-w-0 flex-col gap-1">
<div class="flex min-w-0 items-center gap-1">
<div class="flex min-w-0 items-center gap-0.5">
<Select
class="h-8 min-w-0 flex-1 py-1 text-xs"
class="h-8 min-w-[12rem] flex-1 py-1 text-xs"
bind:value={editCategoryValue}
onkeydown={(e) => onCategoryKey(e, product)}
disabled={savingCategory || optionsForSelect.length === 0}
@@ -326,21 +326,21 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
<Button
variant="ghost"
size="icon"
class="h-10 w-10 shrink-0 touch-manipulation text-primary sm:h-7 sm:w-7"
class="h-7 w-7 shrink-0 text-primary"
aria-label={i18n.t("products.table.saveCategory")}
data-testid="product-category-save"
onclick={() => void saveCategory(product)}
>
<Check class="h-4 w-4" />
<Check class="h-3.5 w-3.5" />
</Button>
<Button
variant="ghost"
size="icon"
class="h-10 w-10 shrink-0 touch-manipulation text-muted-foreground sm:h-7 sm:w-7"
class="h-7 w-7 shrink-0 text-muted-foreground"
aria-label={i18n.t("products.table.cancelCategory")}
onclick={cancelCategoryEdit}
>
<X class="h-4 w-4" />
<X class="h-3.5 w-3.5" />
</Button>
{/if}
</div>
@@ -419,14 +419,14 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
isLoading && "bg-background/20 backdrop-blur-sm"
)}
>
<div class="w-full min-w-0 md:min-w-[44rem] lg:min-w-[52rem]">
<div class="w-full min-w-0 md:min-w-[48rem] lg:min-w-[56rem]">
<div
class={cn(
"sticky top-0 z-10 flex border-b bg-muted text-sm font-medium",
isLoading && "bg-background/50 backdrop-blur-sm"
)}
>
<div class="flex w-12 shrink-0 items-center justify-center p-3">
<div class="flex w-12 shrink-0 items-center justify-center px-3 py-2">
<input
bind:this={headerCheckbox}
type="checkbox"
@@ -443,17 +443,17 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
/>
</div>
<div class="min-w-0 flex-1 p-3 font-medium md:min-w-[10rem]">{i18n.t("products.table.colIdName")}</div>
<div class="hidden w-[128px] shrink-0 p-3 font-medium sm:block sm:w-[140px]" title={i18n.t("products.table.coverageTitle")}>
<div class="min-w-0 flex-1 px-3 py-2 font-medium md:min-w-[10rem]">{i18n.t("products.table.colIdName")}</div>
<div class="hidden w-[128px] shrink-0 px-3 py-2 font-medium sm:block sm:w-[140px]" title={i18n.t("products.table.coverageTitle")}>
{i18n.t("products.table.colCoverage")}
</div>
<div class="hidden w-[130px] shrink-0 p-3 font-medium xl:block">{i18n.t("products.table.colFeed")}</div>
<div class="hidden w-[130px] shrink-0 px-3 py-2 font-medium xl:block">{i18n.t("products.table.colFeed")}</div>
{#if activeTab !== "unprocessed"}
<div class="hidden w-[168px] shrink-0 p-3 font-medium md:block">{i18n.t("products.table.colCategory")}</div>
<div class="hidden w-[300px] shrink-0 px-3 py-2 font-medium md:block">{i18n.t("products.table.colCategory")}</div>
{/if}
<div class="hidden w-[110px] shrink-0 p-3 font-medium md:block">{i18n.t("products.table.colStatus")}</div>
<div class="hidden w-[120px] shrink-0 p-3 font-medium lg:block">{i18n.t("products.table.colUpdated")}</div>
<div class="table-sticky-actions flex w-14 shrink-0 items-center justify-end bg-muted p-2 text-right font-medium sm:w-[100px] sm:p-3">
<div class="hidden w-[128px] shrink-0 px-3 py-2 font-medium md:block">{i18n.t("products.table.colStatus")}</div>
<div class="hidden w-[120px] shrink-0 px-3 py-2 font-medium lg:block">{i18n.t("products.table.colUpdated")}</div>
<div class="table-sticky-actions flex w-14 shrink-0 items-center justify-end bg-muted px-2 py-2 text-right font-medium sm:w-[100px] sm:px-3">
<span class="sr-only sm:not-sr-only">{i18n.t("products.table.colActions")}</span>
</div>
</div>
@@ -461,35 +461,32 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
{#if isLoading}
<div class="relative overflow-hidden" style="height: 400px" role="status" aria-label={i18n.t("products.table.loading")} aria-busy="true">
{#each Array.from({ length: 6 }, (_, i) => i) as index}
<div class="flex h-20 w-full min-w-0 border-b border-border">
<div class="flex w-12 shrink-0 items-center justify-center p-3">
<div class="flex h-16 w-full min-w-0 border-b border-border">
<div class="flex w-12 shrink-0 items-center justify-center px-3 py-2">
<Skeleton class="h-4 w-4 rounded-sm" />
</div>
<div class="min-w-0 flex-1 space-y-2 p-3 md:min-w-[10rem]">
<div class="min-w-0 flex-1 space-y-1.5 px-3 py-2 md:min-w-[10rem]">
<Skeleton class="h-3 w-[100px] opacity-60" />
<Skeleton class="h-4 w-[min(220px,80%)]" />
{#if index % 3 === 0}
<Skeleton class="mt-1 h-3 w-[min(160px,60%)] opacity-60" />
{/if}
</div>
<div class="hidden w-[128px] shrink-0 items-center p-3 sm:flex sm:w-[140px]">
<Skeleton class="h-8 w-[100px]" />
<div class="hidden w-[128px] shrink-0 items-center px-3 py-2 sm:flex sm:w-[140px]">
<Skeleton class="h-5 w-[100px]" />
</div>
<div class="hidden w-[130px] shrink-0 items-center p-3 xl:flex">
<Skeleton class="h-8 w-[100px]" />
<div class="hidden w-[130px] shrink-0 items-center px-3 py-2 xl:flex">
<Skeleton class="h-4 w-[100px]" />
</div>
{#if activeTab !== "unprocessed"}
<div class="hidden w-[168px] shrink-0 items-center p-3 md:flex">
<Skeleton class="h-6 w-[100px]" />
<div class="hidden w-[300px] shrink-0 items-center px-3 py-2 md:flex">
<Skeleton class="h-5 w-[140px]" />
</div>
{/if}
<div class="hidden w-[110px] shrink-0 items-center p-3 md:flex">
<Skeleton class="h-6 w-[80px] rounded-full" />
<div class="hidden w-[128px] shrink-0 items-center px-3 py-2 md:flex">
<Skeleton class="h-5 w-[80px] rounded-full" />
</div>
<div class="hidden w-[120px] shrink-0 items-center p-3 lg:flex">
<div class="hidden w-[120px] shrink-0 items-center px-3 py-2 lg:flex">
<Skeleton class="h-4 w-[90px]" />
</div>
<div class="table-sticky-actions flex w-14 shrink-0 items-center justify-end gap-1 bg-card p-2 sm:w-[100px] sm:p-3">
<div class="table-sticky-actions flex w-14 shrink-0 items-center justify-end gap-1 bg-card px-2 py-2 sm:w-[100px] sm:px-3">
<Skeleton class="h-8 w-8 rounded-full opacity-50" />
</div>
</div>
@@ -501,7 +498,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
{:else}
<VirtualList
items={products}
estimateSize={88}
estimateSize={64}
overscan={6}
class="max-h-[min(70vh,640px)]"
getKey={(product) => String(product.id)}
@@ -511,12 +508,12 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
{@const qScore = Number(product.quality_score ?? NaN)}
<div
class={cn(
"group flex min-h-[5.5rem] border-b border-border transition-all duration-300 hover:bg-muted/40",
"group flex border-b border-border transition-colors hover:bg-muted/40",
selected && "bg-muted/60"
)}
data-state={selected ? "selected" : undefined}
>
<div class="flex w-12 shrink-0 items-center justify-center p-3">
<div class="flex w-12 shrink-0 items-center justify-center px-3 py-2">
<input
type="checkbox"
class="h-4 w-4 rounded border border-primary"
@@ -532,17 +529,17 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
/>
</div>
<div class="flex min-w-0 flex-1 items-start gap-3 p-3 md:min-w-[10rem]">
<div class="flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2 md:min-w-[10rem]">
<ProductThumb
src={productThumbUrl(product)}
alt={productDisplayName(product, kind)}
class="mt-0.5"
size="sm"
/>
<div class="flex min-w-0 flex-1 flex-col">
<div class="truncate font-mono text-xs text-muted-foreground">{productSku(product)}</div>
<div class="min-w-0 font-medium">
<div class="truncate font-mono text-[11px] text-muted-foreground">{productSku(product)}</div>
<div class="min-w-0 text-sm font-medium">
{#if editingId !== null && String(editingId) === String(product.id)}
<div class="flex items-center space-x-1 py-1">
<div class="flex items-center space-x-1">
<Input
class="h-8 py-1"
bind:value={editValue}
@@ -559,7 +556,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
<Button
variant="ghost"
size="icon"
class="h-10 w-10 touch-manipulation text-primary sm:h-7 sm:w-7"
class="h-8 w-8 touch-manipulation text-primary sm:h-7 sm:w-7"
aria-label={i18n.t("products.table.saveName")}
onclick={() => void saveInline()}
>
@@ -568,7 +565,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
<Button
variant="ghost"
size="icon"
class="h-10 w-10 touch-manipulation text-muted-foreground sm:h-7 sm:w-7"
class="h-8 w-8 touch-manipulation text-muted-foreground sm:h-7 sm:w-7"
aria-label={i18n.t("products.table.cancelRename")}
onclick={() => {
editingId = null;
@@ -583,7 +580,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
<div class="group/name flex min-w-0 items-center">
<button
type="button"
class="line-clamp-2 min-w-0 cursor-pointer pr-1 text-left hover:underline"
class="line-clamp-1 min-w-0 cursor-pointer pr-1 text-left hover:underline"
onclick={() => onEditProduct(product)}
>
{productDisplayName(product, kind)}
@@ -605,7 +602,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
{/if}
</div>
<!-- Coverage under name below sm; column takes over at sm+ -->
<div class="mt-2 sm:hidden">
<div class="mt-1 sm:hidden">
{#if Number.isFinite(qScore)}
<span
class="inline-flex min-w-10 items-center justify-center rounded-md px-1.5 py-0.5 text-xs font-semibold {qualityClass(qScore)}"
@@ -615,7 +612,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
</span>
{:else}
{@const states = productEnrichmentStates(product)}
<div class="flex flex-col gap-1" title={leanReadyTitle(product)}>
<div class="flex flex-wrap items-center gap-1" title={leanReadyTitle(product)}>
<div class="flex flex-wrap items-center gap-0.5" aria-label={productEnrichmentTitle(product)}>
{#each COVERAGE_CHIPS as chip}
<span
@@ -641,7 +638,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
{/if}
</div>
<!-- Category + status until md; columns take over at md+ (avoids sm–md gap) -->
<div class="mt-2 space-y-2 md:hidden">
<div class="mt-1 space-y-1 md:hidden">
{#if activeTab !== "unprocessed" && kind === "processed"}
{@render categoryCell(product, "mobile")}
{/if}
@@ -650,7 +647,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
</div>
</div>
<div class="hidden w-[128px] shrink-0 items-center p-3 sm:flex sm:w-[140px]">
<div class="hidden w-[128px] shrink-0 items-center px-3 py-2 sm:flex sm:w-[140px]">
{#if Number.isFinite(qScore)}
<span
class="inline-flex min-w-10 items-center justify-center rounded-md px-1.5 py-0.5 text-xs font-semibold {qualityClass(qScore)}"
@@ -660,7 +657,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
</span>
{:else}
{@const states = productEnrichmentStates(product)}
<div class="flex flex-col gap-1" title={leanReadyTitle(product)}>
<div class="flex flex-wrap items-center gap-1" title={leanReadyTitle(product)}>
<div class="flex flex-wrap items-center gap-0.5" aria-label={productEnrichmentTitle(product)}>
{#each COVERAGE_CHIPS as chip}
<span
@@ -685,27 +682,29 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
</div>
{/if}
</div>
<div class="hidden w-[130px] shrink-0 flex-col justify-center p-3 xl:flex">
<div class="hidden w-[130px] shrink-0 items-center px-3 py-2 xl:flex">
{#if product.feed_name}
<div class="truncate text-sm font-medium" title={String(product.feed_name)}>{product.feed_name}</div>
<div class="truncate text-xs text-muted-foreground" title={productFeedSyncLabel(product)}>
{formatRelativeUpdated(product.feed_last_synced_at || product.raw_updated_at) || i18n.t("products.table.noSyncYet")}
<div
class="truncate text-sm"
title={productFeedSyncLabel(product)}
>
{product.feed_name}
</div>
{:else}
<div class="text-sm text-muted-foreground">—</div>
{/if}
</div>
{#if activeTab !== "unprocessed"}
<div class="hidden w-[168px] shrink-0 items-center p-3 md:flex">
<div class="hidden w-[300px] shrink-0 items-center px-3 py-2 md:flex">
{@render categoryCell(product, "desktop")}
</div>
{/if}
<div class="hidden w-[110px] shrink-0 items-center p-3 md:flex">
<div class="hidden w-[128px] shrink-0 items-center px-3 py-2 md:flex">
<ProductStatusBadge status={product.status ?? product.processing_status} />
</div>
<div class="hidden w-[120px] shrink-0 items-center p-3 lg:flex">
<div class="hidden w-[120px] shrink-0 items-center px-3 py-2 lg:flex">
<div class="text-sm text-muted-foreground">
{formatRelativeUpdated(product.updated_at) || "—"}
</div>
@@ -713,7 +712,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
<div
class={cn(
"table-sticky-actions relative flex w-14 shrink-0 items-center justify-end gap-1 p-2 sm:w-[100px] sm:p-3",
"table-sticky-actions relative flex w-14 shrink-0 items-center justify-end gap-1 px-2 py-2 sm:w-[100px] sm:px-3",
selected ? "bg-muted/60" : "bg-card group-hover:bg-muted/40"
)}
>
@@ -721,7 +720,7 @@ import { Check, Edit, MoreHorizontal, X } from "@lucide/svelte";
{#snippet trigger({ open, toggle })}
<button
type="button"
class="relative z-10 inline-flex h-10 w-10 items-center justify-center rounded-md opacity-70 hover:bg-accent hover:opacity-100"
class="relative z-10 inline-flex h-8 w-8 items-center justify-center rounded-md opacity-70 hover:bg-accent hover:opacity-100"
aria-label={i18n.t("products.table.productOptions")}
aria-haspopup="menu"
aria-expanded={open}
+4 -4
View File
@@ -86,9 +86,9 @@
</script>
{#if open}
<!-- Overlay above assistant FAB (z-[55]); same layer as CommandPalette -->
<div class="fixed inset-0 z-[60] bg-black/80" aria-hidden="true"></div>
<div class="fixed inset-0 z-[60] flex items-end justify-center p-0 sm:items-center sm:p-4">
<!-- Overlay above app header (z-[110]) and assistant FAB -->
<div class="fixed inset-0 z-[120] bg-black/80" aria-hidden="true"></div>
<div class="fixed inset-0 z-[120] flex items-end justify-center p-0 sm:items-center sm:p-4">
<button
type="button"
class="absolute inset-0 cursor-default {!overlayArmed ? 'pointer-events-none' : ''}"
@@ -104,7 +104,7 @@
aria-describedby={description ? "ui-dialog-desc" : undefined}
tabindex="-1"
class={cn(
"relative z-[60] grid max-h-[min(92dvh,900px)] w-full max-w-[600px] min-w-0 grid-rows-[auto_minmax(0,1fr)_auto] gap-4 overflow-hidden border bg-background p-4 shadow-lg sm:rounded-lg sm:p-6",
"relative z-[120] grid max-h-[min(92dvh,900px)] w-full max-w-[600px] min-w-0 grid-rows-[auto_minmax(0,1fr)_auto] gap-4 overflow-hidden border bg-background p-4 shadow-lg sm:rounded-lg sm:p-6",
"rounded-t-xl pb-[max(1rem,env(safe-area-inset-bottom))] sm:pb-6",
className
)}
+7 -2
View File
@@ -2115,7 +2115,7 @@ export const en: MessageDict = {
"mapping.highConfidence": "{count} high-confidence mapping ready",
"mapping.highConfidencePlural": "{count} high-confidence mappings ready",
"mapping.highConfidenceHelp":
"Exact and alias matches (for example EAN → GTIN). Apply all, or accept per-row chips in the table.",
"Exact and alias matches (for example EAN → GTIN). Use Auto-map, or accept per-row in the table.",
"mapping.reviewMappings": "Review mappings",
"mapping.needItemPath": "Enter a product element path before mapping fields.",
"mapping.removeMapping": "Remove mapping",
@@ -5283,7 +5283,7 @@ export const en: MessageDict = {
"categories.sectionType.ul": "Bullet List",
"categories.aiGenerationPrompt": "AI generation prompt",
"categories.aiPromptOverrides":
"Overrides the company product-enhance user prompt for {name}",
"Rules for how products title, description, meta in this category should be rewritten and enriched with AI.",
"categories.promptTemplate": "Prompt template",
"categories.promptTemplateHelp":
"Use placeholders like {{name}} and {{description}}. Leave empty to use the company default from Integrations → AI.",
@@ -5301,6 +5301,11 @@ export const en: MessageDict = {
"categories.promptSection.navHeading": "Sections",
"categories.promptSection.navHint":
"Edit one part of the enhance reply at a time.",
"categories.promptSection.structureHeading": "Structure & formulas",
"categories.promptSection.structureEmpty": "None set — expand to configure assembly for this section.",
"categories.promptSection.structureDescCount":
"{count} description section(s)",
"categories.promptSection.openFullEditor": "Open full editor",
"categories.promptSection.title": "Title",
"categories.promptSection.titleHelp": "Instructions for the product title.",
"categories.promptSection.titleFormulaNote":