Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Dashboard chrome: palette, wizard shell, and list guidance (#14544)

Damian Legawiece49d7f098556
diff --git a/CLAUDE.md b/CLAUDE.md
index d63299d021..db9903f58e 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -175,7 +175,10 @@ One-time machine setup: Homebrew `postgresql@18` running on :5432 (with a `postg
## General rules
- ONLY comment complex or non-obvious methods/code, do not comment every method or class, DON'T create comments noise
-- Commit message body: be precise, DON'T include implementation detail, focus on the "what" and "why", not the "how"
+- DON'T comment code removal, just delete it
+- DON'T comment obvious and native to Rails framework methods, associations, validations
+- DON'T comment on shapes, serializers, types
+- Commit message body: max 3-4 sentences, DON'T include implementation detail, focus on the "what" and "why", not the "how"
- If n-commits are needed for a single logical change, use `git commit --fixup` for the follow-ups and `git rebase -i --autosquash` to combine into a single commit before merging
- Documentation also needs to follow the same principles — focus on the "what" and "why", not the "how". Don't include implementation details in docs. Docs should explain the feature, its purpose, and how to use it, but not how it's implemented internally.
- NEVER commit anything to main branch, always use feature/fix/chore branches for development
diff --git a/packages/dashboard-core/src/components/import-wizard-dialog.tsx b/packages/dashboard-core/src/components/import-wizard-dialog.tsx
index 4ffab229b7..04a8572499 100644
--- a/packages/dashboard-core/src/components/import-wizard-dialog.tsx
+++ b/packages/dashboard-core/src/components/import-wizard-dialog.tsx
@@ -3,13 +3,12 @@ import {
Button,
Card,
CardContent,
- CardFooter,
CardHeader,
CardTitle,
- cn,
Dialog,
DialogBody,
DialogContent,
+ DialogFooter,
DialogHeader,
DialogTitle,
Progress,
@@ -26,6 +25,7 @@ import {
TableHead,
TableHeader,
TableRow,
+ WizardProgress,
} from '@spree/dashboard-ui'
import {
AlertTriangleIcon,
@@ -36,7 +36,7 @@ import {
RotateCcwIcon,
XIcon,
} from '@spree/dashboard-ui/icons'
-import { useEffect, useState } from 'react'
+import { useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import type { PanelImport, PanelImportRow } from '../api-client'
import {
@@ -107,22 +107,57 @@ function ImportWizard({
// from row totals (they look identical in the last poll tick of a first
// pass that ends with failures).
const [retryRequested, setRetryRequested] = useState(false)
+ const completeMapping = useCompleteMapping(importId)
+ const [assignments, setAssignments] = useState<MappingAssignments>({})
+
+ // Seeded once per import. The query is stale immediately, so a refetch on
+ // window focus hands back a new object; re-seeding on that would throw away
+ // a mapping the merchant is part-way through.
+ const seededFor = useRef<string | null>(null)
+ useEffect(() => {
+ if (!imp || seededFor.current === imp.id) return
+ seededFor.current = imp.id
+ setAssignments(initialAssignments(imp))
+ }, [imp])
+
+ const isMapping = imp?.status === 'mapping'
+ const isCompleted = imp?.status === 'completed'
+ const missingRequired = imp && isMapping ? missingRequiredFields(imp, assignments) : []
+ const retryMutation = useRetryFailedRows(importId)
+
+ function handleStartImport() {
+ if (!imp) return
+ completeMapping.mutate({
+ mappings: imp.schema_fields.map((field) => ({
+ schema_field: field.name,
+ file_column: assignments[field.name] ?? null,
+ })),
+ })
+ }
const showFailedRows =
!!imp && imp.failed_rows_count > 0 && (isImportActive(imp.status) || imp.status === 'completed')
return (
<>
- <DialogHeader className="flex flex-row items-center justify-between gap-3 space-y-0 border-b p-3">
- <div className="flex min-w-0 items-center gap-2">
- <DialogTitle className="truncate">
- {imp ? `${importTypeLabel(imp.type)} · ${imp.number}` : t('admin.imports.wizard_title')}
+ <DialogHeader className="h-14 shrink-0 flex-row items-center gap-3 space-y-0 border-b border-border-subtle bg-background px-4 py-0">
+ <div className="flex min-w-0 items-center gap-3">
+ <DialogTitle className="truncate text-base">
+ {t('admin.imports.wizard_title')}
</DialogTitle>
{imp && (
- <StatusBadge status={imp.status} label={t(`admin.imports.status.${imp.status}`)} />
+ <>
+ <span aria-hidden className="h-4 w-px shrink-0 bg-border" />
+ <span className="truncate text-muted-foreground text-sm">
+ {`${importTypeLabel(imp.type)} · ${imp.number}`}
+ </span>
+ </>
)}
</div>
- <div className="flex items-center gap-1">
+ <div className="ms-auto flex shrink-0 items-center gap-2">
+ {imp && (
+ <StatusBadge status={imp.status} label={t(`admin.imports.status.${imp.status}`)} />
+ )}
{/* Keyed on the filename rather than the URL: a client that serves
the file from its own endpoint may send no `original_file_url`
(the download hook falls back to `imports().downloadUrl`), but an
@@ -152,8 +187,12 @@ function ImportWizard({
</div>
</DialogHeader>
- <DialogBody className="min-h-0 flex-1 overflow-y-auto p-4">
- <div className="mx-auto flex w-full flex-col gap-4">
+ {/* The body itself does not scroll: the rail stays put while the step's
+ own column scrolls, so a long mapping table never carries the
+ progress list off-screen. */}
+ <DialogBody className="flex min-h-0 flex-1 gap-8 overflow-hidden p-0">
+ <StepIndicator status={imp?.status ?? 'mapping'} />
+ <div className="flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto py-8 pe-8 ps-8 md:ps-0">
{isError ? (
<div className="flex flex-col items-center gap-3 py-12 text-center">
<AlertTriangleIcon className="size-8 text-destructive" />
@@ -169,26 +208,77 @@ function ImportWizard({
</>
) : (
<>
- <StepIndicator status={imp.status} />
-
- {imp.status === 'mapping' && <MappingStep imp={imp} />}
- {isImportActive(imp.status) && (
- <ProcessingCard imp={imp} retryPass={retryRequested} />
- )}
- {imp.status === 'completed' && (
- <ResultsCard
+ {imp.status === 'mapping' && (
+ <MappingStep
imp={imp}
- onClose={onClose}
- onRetried={() => setRetryRequested(true)}
- onViewRecords={onViewRecords}
+ assignments={assignments}
+ setAssignments={setAssignments}
+ error={completeMapping.error}
/>
)}
+ {isImportActive(imp.status) && (
+ <ProcessingCard imp={imp} retryPass={retryRequested} />
+ )}
+ {imp.status === 'completed' && <ResultsCard imp={imp} />}
{imp.status === 'failed' && <FailedCard imp={imp} />}
{showFailedRows && <FailedRowsCard imp={imp} />}
</>
)}
</div>
</DialogBody>
+
+ {/* Every step's action lives here rather than at the end of its card:
+ a long mapping table or failed-rows list would otherwise push the
+ button below the fold. */}
+ {(isMapping || isCompleted) && imp && (
+ <DialogFooter className="h-16 shrink-0 flex-row items-center justify-between border-border-subtle bg-background px-4 py-0 sm:justify-between">
+ <span className="text-muted-foreground text-sm">
+ {isMapping && missingRequired.length > 0
+ ? t('admin.imports.mapping.missing_required', {
+ fields: missingRequired.map((f) => f.label).join(', '),
+ })
+ : null}
+ </span>
+
+ {isMapping ? (
+ <Button
+ onClick={handleStartImport}
+ disabled={missingRequired.length > 0 || completeMapping.isPending}
+ >
+ {completeMapping.isPending
+ ? t('admin.imports.mapping.starting')
+ : t('admin.imports.mapping.start')}
+ </Button>
+ ) : (
+ <div className="flex items-center gap-2">
+ {imp.failed_rows_count > 0 && (
+ <Button
+ variant="outline"
+ onClick={() =>
+ retryMutation.mutate(undefined, { onSuccess: () => setRetryRequested(true) })
+ }
+ disabled={retryMutation.isPending}
+ >
+ <RotateCcwIcon className="size-4" />
+ {retryMutation.isPending
+ ? t('admin.imports.results.retrying')
+ : t('admin.imports.results.retry_failed', { failed: imp.failed_rows_count })}
+ </Button>
+ )}
+ {onViewRecords && (
+ <Button
+ onClick={() => {
+ onClose()
+ onViewRecords(imp.type)
+ }}
+ >
+ {t('admin.imports.results.view_records', { type: importTypeLabel(imp.type) })}
+ </Button>
+ )}
+ </div>
+ )}
+ </DialogFooter>
+ )}
</>
)
}
@@ -207,32 +297,11 @@ function StepIndicator({ status }: { status: string }) {
const steps = ['map_fields', 'process_rows', 'complete'] as const
return (
- <ol className="flex items-center gap-2">
- {steps.map((step, index) => (
- <li key={step} className="flex items-center gap-2">
- <span
- className={cn(
- 'flex size-5 items-center justify-center rounded-full text-xs',
- index <= activeIndex && 'bg-primary text-primary-foreground',
- index > activeIndex && 'bg-muted text-muted-foreground',
- )}
- >
- {index < activeIndex ? <CheckCircle2Icon className="size-3.5" /> : index + 1}
- </span>
- <span
- className={cn(
- 'text-sm',
- index === activeIndex ? 'font-medium' : 'text-muted-foreground',
- )}
- >
- {t(`admin.imports.steps.${step}`)}
- </span>
- {index < steps.length - 1 && (
- <ChevronRightIcon className="size-4 text-muted-foreground" />
- )}
- </li>
- ))}
- </ol>
+ <WizardProgress
+ className="hidden w-56 shrink-0 py-8 ps-8 md:flex"
+ current={steps[activeIndex]}
+ steps={steps.map((step) => ({ key: step, label: t(`admin.imports.steps.${step}`) }))}
+ />
)
}
@@ -240,23 +309,35 @@ function StepIndicator({ status }: { status: string }) {
// Mapping step
// ---------------------------------------------------------------------------
-function MappingStep({ imp }: { imp: PanelImport }) {
- const { t } = useTranslation()
- const completeMapping = useCompleteMapping(imp.id)
- const [assignments, setAssignments] = useState<Record<string, string | null>>(() =>
- Object.fromEntries(imp.mappings.map((m) => [m.schema_field, m.file_column])),
- )
+/** Which schema field each CSV column feeds, keyed by field name. */
+export type MappingAssignments = Record<string, string | null>
- const missingRequired = imp.schema_fields.filter((f) => f.required && !assignments[f.name])
+export function initialAssignments(imp: PanelImport): MappingAssignments {
+ return Object.fromEntries(imp.mappings.map((m) => [m.schema_field, m.file_column]))
+}
- function handleStart() {
- completeMapping.mutate({
- mappings: imp.schema_fields.map((field) => ({
- schema_field: field.name,
- file_column: assignments[field.name] ?? null,
- })),
- })
- }
+export function missingRequiredFields(imp: PanelImport, assignments: MappingAssignments) {
+ return imp.schema_fields.filter((f) => f.required && !assignments[f.name])
+}
+
+/**
+ * The mapping table. Assignments live in the wizard rather than here, because
+ * the action that submits them sits in the wizard's footer — a long column
+ * list would otherwise bury the button below the fold.
+ */
+function MappingStep({
+ imp,
+ assignments,
+ setAssignments,
+ error,
+}: {
+ imp: PanelImport
+ assignments: MappingAssignments
+ setAssignments: React.Dispatch<React.SetStateAction<MappingAssignments>>
+ /** Failure from the footer's submit, rendered beside the fields it concerns. */
+ error?: Error | null
+}) {
+ const { t } = useTranslation()
const headerOptions = (current: string | null) => [
{ value: NOT_MAPPED, label: t('admin.imports.mapping.not_mapped'), disabled: false },
@@ -340,36 +421,13 @@ function MappingStep({ imp }: { imp: PanelImport }) {
</Table>
</div>
- {missingRequired.length > 0 && (
- <p className="text-muted-foreground text-sm">
- {t('admin.imports.mapping.missing_required', {
- fields: missingRequired.map((f) => f.label).join(', '),
- })}
- </p>
- )}
-
- {completeMapping.isError && (
+ {error && (
<div className="flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-destructive text-sm">
<AlertTriangleIcon className="size-4 shrink-0" />
- <span>
- {completeMapping.error instanceof Error
- ? completeMapping.error.message
- : String(completeMapping.error)}
- </span>
+ <span>{error.message}</span>
</div>
)}
</CardContent>
- <CardFooter className="flex justify-end">
- <Button
- onClick={handleStart}
- disabled={missingRequired.length > 0 || completeMapping.isPending}
- className="m-4"
- >
- {completeMapping.isPending
- ? t('admin.imports.mapping.starting')
- : t('admin.imports.mapping.start')}
- </Button>
- </CardFooter>
</Card>
)
}
@@ -429,19 +487,8 @@ function ProcessingCard({ imp, retryPass }: { imp: PanelImport; retryPass: boole
// Results / file-level failure
// ---------------------------------------------------------------------------
-function ResultsCard({
- imp,
- onClose,
- onRetried,
- onViewRecords,
-}: {
- imp: PanelImport
- onClose: () => void
- onRetried: () => void
- onViewRecords?: (type: string | null) => void
-}) {
+function ResultsCard({ imp }: { imp: PanelImport }) {
const { t } = useTranslation()
- const retryMutation = useRetryFailedRows(imp.id)
return (
<Card>
@@ -454,30 +501,6 @@ function ResultsCard({
failed: imp.failed_rows_count.toLocaleString(),
})}
</p>
- <div className="mt-2 flex items-center gap-2">
- {imp.failed_rows_count > 0 && (
- <Button
- variant="outline"
- onClick={() => retryMutation.mutate(undefined, { onSuccess: onRetried })}
- disabled={retryMutation.isPending}
- >
- <RotateCcwIcon className="size-4" />
- {retryMutation.isPending
- ? t('admin.imports.results.retrying')
- : t('admin.imports.results.retry_failed', { failed: imp.failed_rows_count })}
- </Button>
- )}
- {onViewRecords && (
- <Button
- onClick={() => {
- onClose()
- onViewRecords(imp.type)
- }}
- >
- {t('admin.imports.results.view_records', { type: importTypeLabel(imp.type) })}
- </Button>
- )}
- </div>
</CardContent>
</Card>
)
diff --git a/packages/dashboard-core/src/components/resource-table.tsx b/packages/dashboard-core/src/components/resource-table.tsx
index 673559de77..91d055506b 100644
--- a/packages/dashboard-core/src/components/resource-table.tsx
+++ b/packages/dashboard-core/src/components/resource-table.tsx
@@ -145,6 +145,10 @@ interface ResourceTableProps<T> {
searchParams: ResourceSearch
/** Title displayed in the toolbar header. Overrides the table definition's title. */
title?: string
+ /** One line under the title. Overrides the table definition's description. */
+ description?: string
+ /** Docs for the feature, linked after the description. Overrides the table definition's. */
+ docsPath?: string
/** Default params always sent with every request (e.g., { complete: 1 } for orders) */
defaultParams?: Record<string, unknown>
/**
@@ -205,6 +209,8 @@ export function ResourceTable<T extends Record<string, any>>({
queryFn,
searchParams,
title,
+ description,
+ docsPath,
defaultParams,
actions,
reorder,
@@ -497,6 +503,8 @@ export function ResourceTable<T extends Record<string, any>>({
onFiltersChange={handleFiltersChange}
allColumns={allColumns}
title={title ?? table.title}
+ description={description ?? table.description}
+ docsPath={docsPath ?? table.docsPath}
actions={resolvedActions}
hideSort={reorderActive}
/>
@@ -511,7 +519,7 @@ export function ResourceTable<T extends Record<string, any>>({
items={rows.map((r) => (r as any).id)}
strategy={verticalListSortingStrategy}
>
- <Table stickyHeader>
+ <Table stickyHeader roundedBottom>
<TableHeader>
<TableHeaderRow>
<TableHead className="w-8" />
@@ -631,7 +639,7 @@ export function ResourceTable<T extends Record<string, any>>({
</section>,
document.body,
)}
- <Table stickyHeader>
+ <Table stickyHeader roundedBottom>
<TableHeader>
{/* Column headers stay mounted with rows selected, and the bulk
bar is laid over them. Swapping them for one `colSpan` cell
diff --git a/packages/dashboard-core/src/components/section-heading.tsx b/packages/dashboard-core/src/components/section-heading.tsx
new file mode 100644
index 0000000000..29806c6f37
--- /dev/null
+++ b/packages/dashboard-core/src/components/section-heading.tsx
@@ -0,0 +1,53 @@
+import { CardTitle, cn } from '@spree/dashboard-ui'
+import { ExternalLinkIcon } from '@spree/dashboard-ui/icons'
+import { useTranslation } from 'react-i18next'
+import { docsUrl } from '../lib/docs'
+
+/**
+ * A card's title with an optional line under it saying what the list is for,
+ * and a link to the documentation for the feature.
+ *
+ * Worth writing for anything a merchant meets for the first time — catalogs,
+ * price lists, transfers — and worth leaving off a list that explains itself.
+ * `ResourceTable` renders this from the table definition; hand-built cards use
+ * it directly so both read the same.
+ */
+export function SectionHeading({
+ title,
+ description,
+ docsPath,
+ className,
+}: {
+ title: React.ReactNode
+ description?: React.ReactNode
+ /** Relative to the user guide, or a full URL for a plugin's own docs. */
+ docsPath?: string
+ className?: string
+}) {
+ const { t } = useTranslation()
+
+ return (
+ <div className={cn('flex min-w-0 flex-col gap-1', className)}>
+ <CardTitle className="min-w-0 truncate text-lg">{title}</CardTitle>
+ {description && (
+ <p className="text-muted-foreground text-sm">
+ {description}
+ {docsPath && (
+ <>
+ {' '}
+ <a
+ href={docsUrl(docsPath)}
+ target="_blank"
+ rel="noreferrer"
+ className="inline-flex items-center gap-0.5 text-link hover:text-link-hover"
+ >
+ {t('admin.common.learn_more')}
+ <ExternalLinkIcon className="size-3" />
+ </a>
+ </>
+ )}
+ </p>
+ )}
+ </div>
+ )
+}
diff --git a/packages/dashboard-core/src/components/table-toolbar.tsx b/packages/dashboard-core/src/components/table-toolbar.tsx
index abfe7c3473..2750b6f2e4 100644
--- a/packages/dashboard-core/src/components/table-toolbar.tsx
+++ b/packages/dashboard-core/src/components/table-toolbar.tsx
@@ -1,7 +1,7 @@
import {
Button,
- CardTitle,
Checkbox,
+ cn,
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
@@ -54,6 +54,7 @@ import {
} from '../lib/table-registry'
import { useOptionalStore } from '../providers/store-provider'
import { useTenantId } from '../providers/tenant-provider'
+import { SectionHeading } from './section-heading'
import { StoreDatePicker } from './store-date-picker'
interface TableToolbarProps {
@@ -72,6 +73,10 @@ interface TableToolbarProps {
allColumns?: ColumnDef[]
/** Title displayed in the toolbar header */
title?: string
+ /** One line under the title saying what the list is for. */
+ description?: string
+ /** Documentation for the feature, linked at the end of the description. */
+ docsPath?: string
actions?: React.ReactNode
/** Hide the sort dropdown — used when the table is drag-reorderable, where free sorting would defeat the drag. */
hideSort?: boolean
@@ -176,6 +181,8 @@ export function TableToolbar({
onFiltersChange,
allColumns,
title,
+ description,
+ docsPath,
actions,
hideSort = false,
}: TableToolbarProps) {
@@ -253,8 +260,15 @@ export function TableToolbar({
{/* Title and page actions only. Every control that acts on the list —
search, filters, sort, columns — lives on the row below, so the two
rows split by what they are for rather than by how they are built. */}
- <div className="flex flex-row items-center gap-2 border-b border-border-subtle p-3 pl-4 lg:justify-between">
- {title && <CardTitle className="min-w-0 truncate text-lg">{title}</CardTitle>}
+ <div
+ className={cn(
+ 'flex flex-row gap-2 border-b border-border-subtle p-3 pl-4 lg:justify-between',
+ description ? 'items-start' : 'items-center',
+ )}
+ >
+ {(title || description) && (
+ <SectionHeading title={title} description={description} docsPath={docsPath} />
+ )}
<div className="ml-auto flex shrink-0 items-center gap-2">{actions}</div>
</div>
diff --git a/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx b/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx
index abb043494b..7195433380 100644
--- a/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx
+++ b/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx
@@ -63,7 +63,7 @@ export function MobileBreadcrumbBar({
const { crumbs, pathname, inSettings } = trail
return (
- <div className="flex h-11 shrink-0 items-center border-b border-border/75 bg-background px-4 md:hidden">
+ <div className="flex h-11 shrink-0 items-center border-b border-border bg-background px-4 md:hidden">
<CrumbTrail
crumbs={crumbs}
pathname={pathname}
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.ts
index 1ad839320e..4dba8c1989 100644
--- a/packages/dashboard-core/src/index.ts
+++ b/packages/dashboard-core/src/index.ts
@@ -39,6 +39,7 @@ export * from './components/resource-combobox'
export * from './components/resource-multi-autocomplete'
export * from './components/resource-picker-sheet'
export * from './components/resource-table'
+export * from './components/section-heading'
export * from './components/settings-sidebar'
export * from './components/slot'
export * from './components/store-date-picker'
@@ -75,6 +76,7 @@ export * from './lib/date-presets'
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
+export * from './lib/docs'
export * from './lib/download'
export * from './lib/filters-to-ransack'
export * from './lib/form-errors'
diff --git a/packages/dashboard-core/src/lib/docs.ts b/packages/dashboard-core/src/lib/docs.ts
new file mode 100644
index 0000000000..8de4f3abb9
--- /dev/null
+++ b/packages/dashboard-core/src/lib/docs.ts
@@ -0,0 +1,25 @@
+/**
+ * Base for documentation links surfaced in the dashboard.
+ *
+ * Kept in one place so a docs restructure, a domain change or a locale prefix
+ * is a single edit rather than a sweep through every table and settings page.
+ */
+export const DOCS_BASE_URL = 'https://spreecommerce.org/docs'
+
+/**
+ * Resolves a documentation path to a full URL.
+ *
+ * A bare path is taken as relative to the user guide, which is where the
+ * merchant-facing pages live; an absolute URL is returned untouched, so a
+ * plugin can point at its own documentation.
+ *
+ * @param path - `'catalogs'`, `'developer/providers/erp'`, or a full URL
+ * @returns the URL to link to
+ */
+export function docsUrl(path: string): string {
+ if (/^https?:\/\//.test(path)) return path
+
+ const trimmed = path.replace(/^\/+/, '')
+ const section = /^(user|developer)\//.test(trimmed) ? trimmed : `user/${trimmed}`
+ return `${DOCS_BASE_URL}/${section}`
+}
diff --git a/packages/dashboard-core/src/lib/table-registry.ts b/packages/dashboard-core/src/lib/table-registry.ts
index 92a807a720..51d0764cf9 100644
--- a/packages/dashboard-core/src/lib/table-registry.ts
+++ b/packages/dashboard-core/src/lib/table-registry.ts
@@ -139,6 +139,18 @@ export interface SortOption {
export interface TableDef<T = any> {
key: string
title?: string
+ /**
+ * One line under the title saying what the list is for. Worth writing for
+ * anything a merchant meets for the first time — catalogs, price lists,
+ * transfers — and worth leaving off a list that explains itself.
+ */
+ description?: string
+ /**
+ * Documentation for the feature, appended to `description` as a "Learn more"
+ * link. A path is relative to the user guide (`'catalogs'`); a full URL is
+ * used as given, so a plugin can point at its own docs.
+ */
+ docsPath?: string
columns: ColumnDef<T>[]
searchParam?: string
searchPlaceholder?: string
diff --git a/packages/dashboard-core/src/locales/ar.json b/packages/dashboard-core/src/locales/ar.json
index 1901367077..eff118e048 100644
--- a/packages/dashboard-core/src/locales/ar.json
+++ b/packages/dashboard-core/src/locales/ar.json
@@ -155,6 +155,7 @@
"deleted": "تم الحذف",
"empty_value": "—",
"inactive": "غير نشط",
+ "learn_more": "اعرف المزيد",
"loading": "جارٍ التحميل…",
"next": "التالي",
"no": "لا",
@@ -895,6 +896,11 @@
"pending": "قيد الانتظار",
"processing": "قيد المعالجة"
},
+ "step_descriptions": {
+ "complete": "اكتمل الاستيراد. راجع ما تم إنشاؤه وتحديثه.",
+ "map_fields": "طابق كل عمود في ملفك مع حقل في Spree.",
+ "process_rows": "يجري استيراد الصفوف. قد يستغرق ذلك بضع دقائق."
+ },
"steps": {
"complete": "اكتمل",
"map_fields": "مطابقة الحقول",
diff --git a/packages/dashboard-core/src/locales/de.json b/packages/dashboard-core/src/locales/de.json
index 4618e355b1..83cb4b6312 100644
--- a/packages/dashboard-core/src/locales/de.json
+++ b/packages/dashboard-core/src/locales/de.json
@@ -155,6 +155,7 @@
"deleted": "Gelöscht",
"empty_value": "—",
"inactive": "Inaktiv",
+ "learn_more": "Mehr erfahren",
"loading": "Wird geladen…",
"next": "Weiter",
"no": "Nein",
@@ -895,6 +896,11 @@
"pending": "Ausstehend",
"processing": "In Bearbeitung"
},
+ "step_descriptions": {
+ "complete": "Der Import ist abgeschlossen. Prüfen Sie, was erstellt und aktualisiert wurde.",
+ "map_fields": "Ordnen Sie jede Spalte Ihrer Datei einem Feld in Spree zu.",
+ "process_rows": "Ihre Zeilen werden importiert. Das kann einige Minuten dauern."
+ },
"steps": {
"complete": "Fertig",
"map_fields": "Felder zuordnen",
diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.json
index d10946212f..9771ba56a6 100644
--- a/packages/dashboard-core/src/locales/en.json
+++ b/packages/dashboard-core/src/locales/en.json
@@ -155,6 +155,7 @@
"deleted": "Deleted",
"empty_value": "—",
"inactive": "Inactive",
+ "learn_more": "Learn more",
"loading": "Loading…",
"next": "Next",
"no": "No",
@@ -897,6 +898,11 @@
"pending": "Pending",
"processing": "Processing"
},
+ "step_descriptions": {
+ "complete": "Your import has finished. Review what was created and updated.",
+ "map_fields": "Match each column in your file to a field in Spree.",
+ "process_rows": "We are importing your rows. This can take a few minutes."
+ },
"steps": {
"complete": "Complete",
"map_fields": "Map fields",
diff --git a/packages/dashboard-core/src/locales/fr.json b/packages/dashboard-core/src/locales/fr.json
index ef7dde613f..4a32b9206f 100644
--- a/packages/dashboard-core/src/locales/fr.json
+++ b/packages/dashboard-core/src/locales/fr.json
@@ -155,6 +155,7 @@
"deleted": "Supprimé",
"empty_value": "—",
"inactive": "Inactif",
+ "learn_more": "En savoir plus",
"loading": "Chargement…",
"next": "Suivant",
"no": "Non",
@@ -895,6 +896,11 @@
"pending": "En attente",
"processing": "En cours"
},
+ "step_descriptions": {
+ "complete": "Votre import est terminé. Vérifiez ce qui a été créé et mis à jour.",
+ "map_fields": "Associez chaque colonne de votre fichier à un champ dans Spree.",
+ "process_rows": "Vos lignes sont en cours d’import. Cela peut prendre quelques minutes."
+ },
"steps": {
"complete": "Terminé",
"map_fields": "Associer les champs",
diff --git a/packages/dashboard-core/src/locales/pl.json b/packages/dashboard-core/src/locales/pl.json
index 763b512e46..1a003c6a3f 100644
--- a/packages/dashboard-core/src/locales/pl.json
+++ b/packages/dashboard-core/src/locales/pl.json
@@ -155,6 +155,7 @@
"deleted": "Usunięto",
"empty_value": "—",
"inactive": "Nieaktywny",
+ "learn_more": "Dowiedz się więcej",
"loading": "Ładowanie…",
"next": "Następna",
"no": "Nie",
@@ -895,6 +896,11 @@
"pending": "Oczekujący",
"processing": "Przetwarzanie"
},
+ "step_descriptions": {
+ "complete": "Import zakończony. Sprawdź, co zostało utworzone i zaktualizowane.",
+ "map_fields": "Dopasuj każdą kolumnę pliku do pola w Spree.",
+ "process_rows": "Importujemy Twoje wiersze. Może to potrwać kilka minut."
+ },
"steps": {
"complete": "Gotowe",
"map_fields": "Dopasuj pola",
diff --git a/packages/dashboard-core/src/locales/zh-CN.json b/packages/dashboard-core/src/locales/zh-CN.json
index e7d8707481..fb2853baad 100644
--- a/packages/dashboard-core/src/locales/zh-CN.json
+++ b/packages/dashboard-core/src/locales/zh-CN.json
@@ -155,6 +155,7 @@
"deleted": "已删除",
"empty_value": "—",
"inactive": "停用",
+ "learn_more": "了解更多",
"loading": "加载中…",
"next": "下一页",
"no": "否",
@@ -895,6 +896,11 @@
"pending": "待处理",
"processing": "处理中"
},
+ "step_descriptions": {
+ "complete": "导入已完成。请查看已创建和更新的内容。",
+ "map_fields": "将文件中的每一列与 Spree 中的字段对应。",
+ "process_rows": "正在导入您的数据行,这可能需要几分钟。"
+ },
"steps": {
"complete": "完成",
"map_fields": "匹配字段",
diff --git a/packages/dashboard-ui/src/spree/wizard.tsx b/packages/dashboard-ui/src/spree/wizard.tsx
index 1b1f180069..3439b2af1c 100644
--- a/packages/dashboard-ui/src/spree/wizard.tsx
+++ b/packages/dashboard-ui/src/spree/wizard.tsx
@@ -49,13 +49,30 @@ export function WizardProgress({ steps, current, onStepSelect, className }: Wiza
const currentIndex = steps.findIndex((step) => step.key === current)
return (
- <ol className={cn('flex items-center gap-2', className)}>
+ <ol className={cn('flex flex-col', className)}>
{steps.map((step, index) => {
const state = index < currentIndex ? 'done' : index === currentIndex ? 'current' : 'ahead'
const navigable = state === 'done' && !!onStepSelect
+ const last = index === steps.length - 1
return (
- <li key={step.key} className="flex flex-1 items-center gap-2">
+ <li key={step.key} className="flex gap-3">
+ {/* Marker and connector share a column so the line always meets
+ the dots, whatever a label wraps to. */}
+ <div className="flex flex-col items-center">
+ <span
+ aria-hidden
+ className={cn(
+ 'flex size-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors',
+ state === 'done' && 'border-success bg-success text-white',
+ state === 'current' && 'border-ring bg-background',
+ state === 'ahead' && 'border-border bg-background',
+ )}
+ >
+ {state === 'done' ? <CheckIcon className="size-2.5" strokeWidth={3} /> : null}
+ </span>
+ {last ? null : <span aria-hidden className="w-px flex-auto bg-border" />}
+ </div>
<button
type="button"
disabled={!navigable}
@@ -66,29 +83,14 @@ export function WizardProgress({ steps, current, onStepSelect, className }: Wiza
tabIndex={navigable ? undefined : -1}
aria-current={state === 'current' ? 'step' : undefined}
className={cn(
- 'flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm',
- navigable && 'cursor-pointer hover:bg-muted',
- state === 'ahead' && 'text-muted-foreground',
+ 'min-w-0 pb-7 text-left text-sm leading-none',
+ navigable && 'cursor-pointer hover:text-foreground',
+ state === 'current' ? 'font-medium text-foreground' : 'text-muted-foreground',
+ last && 'pb-0',
)}
>
- <span
- aria-hidden
- className={cn(
- 'flex size-6 shrink-0 items-center justify-center rounded-full border text-xs',
- state === 'current' && 'border-primary bg-primary text-primary-foreground',
- state === 'done' && 'border-primary text-primary',
- state === 'ahead' && 'border-border text-muted-foreground',
- )}
- >
- {state === 'done' ? <CheckIcon className="size-3.5" /> : index + 1}
- </span>
- <span className={cn('truncate', state === 'current' && 'font-medium')}>
- {step.label}
- </span>
+ <span className="truncate">{step.label}</span>
</button>
- {index < steps.length - 1 && (
- <span aria-hidden className="h-px flex-1 bg-border last:hidden" />
- )}
</li>
)
})}
@@ -115,6 +117,8 @@ export function Wizard({
open,
onOpenChange,
title,
+ subtitle,
+ status,
steps,
current,
onStepSelect,
@@ -128,6 +132,10 @@ export function Wizard({
open: boolean
onOpenChange: (open: boolean) => void
title: string
+ /** Shown after the title behind a divider — what this run is about. */
+ subtitle?: ReactNode
+ /** Right-aligned ambient status, e.g. a save state or a badge. */
+ status?: ReactNode
steps: WizardStep[]
current: string
onStepSelect?: (key: string) => void
@@ -152,27 +160,47 @@ export function Wizard({
style={{ maxHeight: 'none' }}
showCloseButton={false}
>
- <DialogHeader className="flex flex-row items-center justify-between gap-3 space-y-0 border-b p-3">
- <DialogTitle>{title}</DialogTitle>
- <Button
- type="button"
- size="icon-sm"
- variant="ghost"
- onClick={() => onOpenChange(false)}
- aria-label={t('admin.actions.close')}
- >
- <XIcon />
- </Button>
+ <DialogHeader className="h-14 shrink-0 flex-row items-center gap-3 space-y-0 border-b border-border-subtle bg-background px-4 py-0">
+ <div className="flex min-w-0 items-center gap-3">
+ <DialogTitle className="truncate text-base">{title}</DialogTitle>
+ {subtitle ? (
+ <>
+ <span aria-hidden className="h-4 w-px shrink-0 bg-border" />
+ <span className="truncate text-muted-foreground text-sm">{subtitle}</span>
+ </>
+ ) : null}
+ </div>
+ <div className="ms-auto flex shrink-0 items-center gap-3">
+ {status}
+ <Button
+ type="button"
+ size="icon-sm"
+ variant="ghost"
+ onClick={() => onOpenChange(false)}
+ aria-label={t('admin.actions.close')}
+ >
+ <XIcon />
+ </Button>
+ </div>
</DialogHeader>
<form onSubmit={onSubmit} onKeyDown={onKeyDown} className="flex min-h-0 flex-1 flex-col">
- <div className="border-b border-border-subtle px-6 py-4">
- <WizardProgress steps={steps} current={current} onStepSelect={onStepSelect} />
- </div>
-
- <DialogBody className="flex-1 overflow-y-auto p-6">
- <div className={cn('mx-auto flex w-full flex-col gap-6', contentClassName)}>
- {children}
+ {/* The body itself does not scroll: the rail stays put while the
+ step's own column scrolls, so a long form never carries the
+ progress list off-screen. */}
+ <DialogBody className="flex min-h-0 flex-1 gap-8 overflow-hidden p-0">
+ <WizardProgress
+ steps={steps}
+ current={current}
+ onStepSelect={onStepSelect}
+ className="hidden w-56 shrink-0 py-8 ps-8 md:flex"
+ />
+ <div className="min-w-0 flex-1 overflow-y-auto py-8 pe-8 ps-8 md:ps-0">
+ {/* No width cap here: `contentClassName` is what sets it, and a
+ default with a breakpoint would outrank the caller's own. */}
+ <div className={cn('flex w-full min-w-0 flex-col gap-6', contentClassName)}>
+ {children}
+ </div>
</div>
</DialogBody>
@@ -180,7 +208,7 @@ export function Wizard({
the footer's end-justification is overridden. It stays a row at
every width too: stacked, Back would sit above Next and read as
the order to press them in. */}
- <DialogFooter className="flex-row justify-between sm:justify-between">
+ <DialogFooter className="h-16 shrink-0 flex-row items-center justify-between border-border-subtle bg-background px-4 py-0 sm:justify-between">
{back}
{forward}
</DialogFooter>
diff --git a/packages/dashboard-ui/src/styles.css b/packages/dashboard-ui/src/styles.css
index 1b2102a990..aa02a7da58 100644
--- a/packages/dashboard-ui/src/styles.css
+++ b/packages/dashboard-ui/src/styles.css
@@ -49,10 +49,15 @@
:root {
--brand-blue: oklch(0.5967 0.2212 258); /* #0077ff — site accent */
--brand-blue-strong: oklch(0.5106 0.1868 257.7); /* #0060ce — site link hover */
+ /* Links in body copy. The plain accent measures 4.13:1 on white and 4.21:1
+ on the dark card — under 4.5 in BOTH themes — so a link takes its own
+ step rather than the accent. */
+ --link: oklch(0.5106 0.1868 257.7);
+ --link-hover: oklch(0.44 0.16 257.7);
- --background: oklch(98.5% 0.001 106.423); /* stone-50 */
+ --background: oklch(0.9851 0 0); /* #fafafa — chrome sits one step below white */
--foreground: oklch(0.145 0.0039 49.25); /* stone-950 */
- --card: oklch(1 0 0); /* white, one step above the page */
+ --card: oklch(1 0 0); /* #ffffff — cards and inputs read as raised */
--card-foreground: oklch(0.145 0.0039 49.25);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0.0039 49.25);
@@ -60,9 +65,9 @@
--primary-foreground: oklch(1 0 0);
/* Filled surfaces (table headers, badges, secondary buttons) read as a
whisper against the white card rather than a distinct band. */
- --secondary: oklch(0.97 0.001 106.424); /* stone-100 */
+ --secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.145 0.0039 49.25);
- --muted: oklch(0.985 0.001 106.423); /* stone-50 */
+ --muted: oklch(0.9851 0 0);
/* Between stone-500 and -600. Clears 4.5:1 against every surface this text
actually lands on — including --accent, the darkest of them — where the
stone-500 step measured 4.15:1. Dark mode keeps its own value: it already
@@ -72,20 +77,26 @@
stone-200: these sit on white surfaces, where that value reads as a
pressed state rather than a hover. The sidebar shares this value via
--sidebar-accent so a highlighted row looks the same wherever it is. */
- --accent: oklch(0.95 0.0019 106.424);
+ --accent: oklch(0.9491 0 0);
--accent-foreground: oklch(0.145 0.0039 49.25);
--destructive: oklch(0.58 0.22 27); /* red-600 */
--destructive-foreground: oklch(1 0 0); /* #ffffff */
- /* stone-200 — rules stay legible but recede, so a dense table reads as
- rows of content rather than a grid. */
- --border: oklch(0.922 0.003 48.717);
+ /* The full-strength rule colour. Nothing styles with it directly — the two
+ tokens below are both a share of it, so neither compounds the other's
+ reduction. */
+ --border-base: oklch(0.922 0 0);
+ /* A container's own edge. Legible but receding, so a dense table reads as
+ rows of content rather than a grid. Carries its strength in the token, so
+ call sites never restate it — an `/80` utility would compound to 64%. */
+ --border: color-mix(in srgb, var(--border-base) 90%, transparent);
/* Half-strength rule for dividers *inside* a container — card header/footer
- splits, dialog and sheet separators, table chrome. Distinct from --border,
- which draws a container's own edge. Resolved to a real colour rather than
- an opacity utility so it also works inside arbitrary values such as the
- sticky table header's inset shadow, where `/50` has no effect. */
- --border-subtle: color-mix(in srgb, var(--border) 50%, transparent);
- --input: oklch(0.922 0.003 48.717);
+ splits, dialog and sheet separators, table chrome. Half of the base, not
+ of --border, so it is a true 50% rather than 40%. Resolved to a real
+ colour rather than an opacity utility so it also works inside arbitrary
+ values such as the sticky table header's inset shadow, where `/50` has no
+ effect. */
+ --border-subtle: color-mix(in srgb, var(--border-base) 50%, transparent);
+ --input: color-mix(in srgb, var(--border-base) 80%, transparent);
--ring: var(--brand-blue);
--chart-1: oklch(0.7663 0.1067 254.4);
--chart-2: oklch(0.5967 0.2212 258); /* brand blue */
@@ -98,7 +109,7 @@
points at the page token it matches rather than repeating it, so the two
cannot drift apart. */
--sidebar: var(--background);
- --sidebar-foreground: var(--foreground);
+ --sidebar-foreground: oklch(26.8% 0.007 34.298);
--sidebar-primary: var(--primary);
--sidebar-primary-foreground: var(--primary-foreground);
--sidebar-accent: var(--accent);
@@ -171,10 +182,13 @@
--accent: oklch(0.2645 0 0);
--accent-foreground: oklch(0.95 0.0019 106.424);
--destructive: oklch(0.704 0.191 22.216);
- --border: oklch(1 0 0 / 12%);
- --border-subtle: color-mix(in srgb, var(--border) 50%, transparent);
- --input: oklch(1 0 0 / 15%);
+ --border-base: oklch(1 0 0 / 12%);
+ --border: color-mix(in srgb, var(--border-base) 80%, transparent);
+ --border-subtle: color-mix(in srgb, var(--border-base) 50%, transparent);
+ --input: color-mix(in srgb, var(--border-base) 80%, transparent);
--ring: oklch(0.552 0.016 285); /* same blue ring as light, for focus parity */
+ --link: oklch(0.7 0.16 258);
+ --link-hover: oklch(0.78 0.14 258);
--chart-1: oklch(0.809 0.105 251.813);
--chart-2: oklch(0.623 0.214 259.815);
--chart-3: oklch(0.546 0.245 262.881);
@@ -336,6 +350,8 @@
incidental use such as charts and illustrations. */
--color-blue-500: var(--brand-blue);
--color-blue-600: var(--brand-blue-strong);
+ --color-link: var(--link);
+ --color-link-hover: var(--link-hover);
}
@utility focus-ring {
diff --git a/packages/dashboard-ui/src/ui/accordion.tsx b/packages/dashboard-ui/src/ui/accordion.tsx
index 0c5c2a9092..c8a9fee20a 100644
--- a/packages/dashboard-ui/src/ui/accordion.tsx
+++ b/packages/dashboard-ui/src/ui/accordion.tsx
@@ -45,7 +45,7 @@ function AccordionTrigger({
<AccordionPrimitive.Trigger
data-slot="accordion-trigger"
className={cn(
- 'group/accordion-trigger flex flex-1 cursor-pointer items-center gap-3 px-4 py-3.5 text-left text-base font-medium transition-colors outline-none hover:bg-accent/50 focus-visible:bg-accent',
+ 'group/accordion-trigger flex flex-1 cursor-pointer items-center gap-3 px-4 py-3.5 text-left text-base font-medium transition-colors outline-none hover:bg-accent focus-visible:bg-accent',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/card.tsx b/packages/dashboard-ui/src/ui/card.tsx
index 74ebfcaa95..160eb589dc 100644
--- a/packages/dashboard-ui/src/ui/card.tsx
+++ b/packages/dashboard-ui/src/ui/card.tsx
@@ -12,7 +12,7 @@ function Card({ className, ...props }: React.ComponentProps<'div'>) {
// the document, laying the whole page out wider than the viewport. `clip`
// rather than `hidden` so `overflow-y` stays `visible` and sticky
// descendants keep resolving against the page.
- 'group/card flex flex-col min-w-0 overflow-x-clip break-words bg-card text-card-foreground border border-border/80 rounded-xl',
+ 'group/card flex flex-col min-w-0 overflow-x-clip break-words bg-card text-card-foreground border border-border shadow-xs rounded-xl',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/checkbox.tsx b/packages/dashboard-ui/src/ui/checkbox.tsx
index ea4da184ce..83ec6e6f06 100644
--- a/packages/dashboard-ui/src/ui/checkbox.tsx
+++ b/packages/dashboard-ui/src/ui/checkbox.tsx
@@ -25,7 +25,7 @@ function Checkbox({
disabled={disabled}
name={name}
className={cn(
- 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-[4px] border border-border align-[-3px] shadow-xs outline-none transition-shadow',
+ 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-[4px] border border-border align-[-3px] outline-none transition-shadow',
'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50',
'disabled:cursor-not-allowed disabled:opacity-50',
'aria-invalid:border-destructive aria-invalid:ring-destructive/20',
diff --git a/packages/dashboard-ui/src/ui/combobox.tsx b/packages/dashboard-ui/src/ui/combobox.tsx
index 81302e7617..dce33bb0cc 100644
--- a/packages/dashboard-ui/src/ui/combobox.tsx
+++ b/packages/dashboard-ui/src/ui/combobox.tsx
@@ -48,7 +48,7 @@ function ComboboxButtonTrigger({ className, children, ...props }: ComboboxPrimit
<ComboboxPrimitive.Trigger
data-slot="combobox-button-trigger"
className={cn(
- "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:border-border disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/data-table.tsx b/packages/dashboard-ui/src/ui/data-table.tsx
index 3e6c3a8e84..8241ecd212 100644
--- a/packages/dashboard-ui/src/ui/data-table.tsx
+++ b/packages/dashboard-ui/src/ui/data-table.tsx
@@ -61,8 +61,11 @@ function Table({
// Applied on the table so it reaches the last row's edge cells without
// every TableCell paying for the selector.
+ // `td:only-child` covers the empty and skeleton rows, whose single spanning
+ // cell is both first and last child — matching on those alone rounds one
+ // corner and leaves the other square against the card's curve.
const roundedClasses = roundedBottom
- ? '[&_tbody_tr:last-child_td:first-child]:rounded-bl-xl [&_tbody_tr:last-child_td:last-child]:rounded-br-xl'
+ ? '[&_tbody_tr:last-child_td:first-child]:rounded-bl-xl [&_tbody_tr:last-child_td:last-child]:rounded-br-xl [&_tbody_tr:last-child_td:only-child]:rounded-b-xl'
: undefined
const kids = Children.toArray(children)
diff --git a/packages/dashboard-ui/src/ui/input-group.tsx b/packages/dashboard-ui/src/ui/input-group.tsx
index d082016ded..5b26cc99aa 100644
--- a/packages/dashboard-ui/src/ui/input-group.tsx
+++ b/packages/dashboard-ui/src/ui/input-group.tsx
@@ -11,7 +11,7 @@ function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
data-slot="input-group"
role="group"
className={cn(
- 'group/input-group relative flex w-full min-w-0 items-center rounded-lg border border-border bg-card text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:shadow-none has-disabled:bg-muted has-disabled:border-border has-disabled:opacity-50 has-disabled:shadow-none has-[[data-slot=input-group-control]:focus-visible]:border-blue-500 has-[[data-slot=input-group-control]:focus-visible]:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-[[data-slot][aria-invalid=true]]:border-destructive has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
+ 'group/input-group relative flex w-full min-w-0 items-center rounded-lg border border-border bg-card text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:shadow-none has-disabled:bg-muted has-disabled:opacity-50 has-disabled:shadow-none has-[[data-slot=input-group-control]:focus-visible]:border-blue-500 has-[[data-slot=input-group-control]:focus-visible]:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-[[data-slot][aria-invalid=true]]:border-destructive has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/input.tsx b/packages/dashboard-ui/src/ui/input.tsx
index 04aca58281..6c06aab656 100644
--- a/packages/dashboard-ui/src/ui/input.tsx
+++ b/packages/dashboard-ui/src/ui/input.tsx
@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
type={type}
data-slot="input"
className={cn(
- 'block w-full min-w-0 min-h-8 rounded-lg border border-border bg-card py-1.5 px-2.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:border-border disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',
+ 'block w-full min-w-0 min-h-8 rounded-lg border border-border bg-card py-1.5 px-2.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/select.tsx b/packages/dashboard-ui/src/ui/select.tsx
index 34a3e653b8..81b02f0e72 100644
--- a/packages/dashboard-ui/src/ui/select.tsx
+++ b/packages/dashboard-ui/src/ui/select.tsx
@@ -59,7 +59,7 @@ function SelectTrigger({
// doesn't collapse to chevron-height when the SelectValue render-prop
// returns an empty string (e.g., when value is unset and the
// placeholder isn't surfaced through the render-prop).
- "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:border-border disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive data-[placeholder]:text-muted-foreground data-[size=sm]:py-1 data-[size=sm]:px-2 data-[size=sm]:text-sm data-[size=sm]:min-h-[1.9375rem] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive data-[placeholder]:text-muted-foreground data-[size=sm]:py-1 data-[size=sm]:px-2 data-[size=sm]:text-sm data-[size=sm]:min-h-[1.9375rem] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/textarea.tsx b/packages/dashboard-ui/src/ui/textarea.tsx
index 4d9bebe858..85357b4669 100644
--- a/packages/dashboard-ui/src/ui/textarea.tsx
+++ b/packages/dashboard-ui/src/ui/textarea.tsx
@@ -7,7 +7,7 @@ function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
<textarea
data-slot="textarea"
className={cn(
- 'flex field-sizing-content min-h-16 w-full rounded-lg border border-border bg-card px-2.5 py-1.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:border-border disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive',
+ 'flex field-sizing-content min-h-16 w-full rounded-lg border border-border bg-card px-2.5 py-1.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive',
className,
)}
{...props}
diff --git a/packages/dashboard/src/components/spree/catalog-wizard-dialog.tsx b/packages/dashboard/src/components/spree/catalog-wizard-dialog.tsx
index c76b701e97..b1d4d6743e 100644
--- a/packages/dashboard/src/components/spree/catalog-wizard-dialog.tsx
+++ b/packages/dashboard/src/components/spree/catalog-wizard-dialog.tsx
@@ -170,9 +170,9 @@ function CatalogWizard({
event.target instanceof HTMLInputElement && event.target.type !== 'checkbox'
if (event.key === 'Enter' && !isLastStep && onTextInput) event.preventDefault()
}}
- // The Products step is two columns and wants the room; the others are a
- // form, which reads badly stretched across a wide window.
- contentClassName={step === 'products' ? 'max-w-5xl' : 'max-w-2xl'}
+ // The Products step is a two-column picker and takes the whole window;
+ // the others are a form, which reads badly stretched across one.
+ contentClassName={step === 'products' ? undefined : 'max-w-2xl'}
back={
<Button
type="button"
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 14cee87013..799dee2b1c 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -335,7 +335,7 @@
"collections": {
"add_cta": "مجموعة جديدة",
"columns": {
- "membership": "العضوية",
+ "kind": "النوع",
"products_count": "المنتجات",
"sort_order": "الترتيب"
},
@@ -4893,6 +4893,18 @@
"oz": "أوقية (أوقية)"
}
},
+ "table_descriptions": {
+ "catalogs": "ما تراه مجموعة من المشترين والأسعار التي يدفعونها.",
+ "categories": "شجرة التصفح التي يتنقل بها المتسوقون في متجرك.",
+ "collections": "مجموعات منتجات تعرضها معًا، تُختار يدويًا أو بقاعدة.",
+ "companies": "المشترون من الشركات وفرقهم وشروط الشراء.",
+ "customer_groups": "مجموعات تصنّف فيها العملاء، للأسعار والعروض.",
+ "delivery_profiles": "قواعد شحن المنتج، تُطبَّق لكل منتج.",
+ "options": "خيارات مثل المقاس أو اللون تُحوِّل المنتج إلى تنويعات.",
+ "price_lists": "أسعار بديلة تُطبَّق عند تحقق قواعدها.",
+ "product_types": "قوالب تمنح المنتجات الجديدة حقولها وخياراتها.",
+ "stock_transfers": "المخزون المنقول بين مواقعك، وما وصل منه."
+ },
"tax_categories": {
"add_cta": "إضافة فئة الضريبة",
"create_description": "تجميع المنتجات حسب المعاملة الضريبية (قياسية، مخفضة، معفاة،…).",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 795fc8ebab..9ccef7e096 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -331,7 +331,7 @@
"collections": {
"add_cta": "Neue Kollektion",
"columns": {
- "membership": "Zuordnung",
+ "kind": "Art",
"products_count": "Produkte",
"sort_order": "Sortierung"
},
@@ -4871,6 +4871,18 @@
"oz": "Unze (oz)"
}
},
+ "table_descriptions": {
+ "catalogs": "Was eine Käufergruppe sieht und welche Preise sie zahlt.",
+ "categories": "Der Navigationsbaum, über den Kunden Ihren Shop durchstöbern.",
+ "collections": "Produktgruppen, die Sie gemeinsam vermarkten — manuell oder per Regel.",
+ "companies": "Geschäftskunden, ihre Teams und die Konditionen, zu denen sie kaufen.",
+ "customer_groups": "Gruppen, in die Sie Kunden einteilen — für Preise und Aktionen.",
+ "delivery_profiles": "Regeln dafür, wie ein Produkt versendet wird, je Produkt angewendet.",
+ "options": "Auswahlmöglichkeiten wie Größe oder Farbe, aus denen Varianten entstehen.",
+ "price_lists": "Alternative Preise, die gelten, wenn ihre Regeln zutreffen.",
+ "product_types": "Vorlagen, die neuen Produkten ihre Felder und Optionen geben.",
+ "stock_transfers": "Bestand, der zwischen Ihren Lagern bewegt wird, und was angekommen ist."
+ },
"tax_categories": {
"add_cta": "Steuerkategorie hinzufügen",
"create_description": "Gruppieren Sie Produkte nach steuerlicher Behandlung (Standard, ermäßigt, befreit, …).",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 17feb4b401..a5ce5920bd 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -331,7 +331,7 @@
"collections": {
"add_cta": "New collection",
"columns": {
- "membership": "Membership",
+ "kind": "Kind",
"products_count": "Products",
"sort_order": "Sorting"
},
@@ -4871,6 +4871,18 @@
"oz": "Ounce (oz)"
}
},
+ "table_descriptions": {
+ "catalogs": "What a group of buyers can see and the prices they pay.",
+ "categories": "The browsing tree shoppers navigate your store by.",
+ "collections": "Groups of products you merchandise together, picked by hand or by rule.",
+ "companies": "Business buyers, their teams and the terms they buy on.",
+ "customer_groups": "Groups you sort customers into, for pricing and promotions.",
+ "delivery_profiles": "Rules for how a product ships, applied per product.",
+ "options": "Choices like size or colour that turn one product into variants.",
+ "price_lists": "Alternative prices that apply when their rules match.",
+ "product_types": "Templates that give new products their fields and options.",
+ "stock_transfers": "Stock moving between your locations, and what has arrived."
+ },
"tax_categories": {
"add_cta": "Add tax category",
"create_description": "Group products by tax treatment (standard, reduced, exempt, …).",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index e36538a4ef..acda5aba32 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -331,7 +331,7 @@
"collections": {
"add_cta": "Nouvelle collection",
"columns": {
- "membership": "Composition",
+ "kind": "Type",
"products_count": "Produits",
"sort_order": "Tri"
},
@@ -4871,6 +4871,18 @@
"oz": "Once (oz)"
}
},
+ "table_descriptions": {
+ "catalogs": "Ce qu’un groupe d’acheteurs voit et les prix qu’il paie.",
+ "categories": "L’arborescence de navigation par laquelle vos clients parcourent la boutique.",
+ "collections": "Des groupes de produits mis en avant ensemble, choisis à la main ou par règle.",
+ "companies": "Les acheteurs professionnels, leurs équipes et leurs conditions d’achat.",
+ "customer_groups": "Les groupes dans lesquels vous classez vos clients, pour les prix et les promotions.",
+ "delivery_profiles": "Les règles d’expédition d’un produit, appliquées produit par produit.",
+ "options": "Des choix comme la taille ou la couleur qui déclinent un produit en variantes.",
+ "price_lists": "Des prix alternatifs qui s’appliquent quand leurs règles correspondent.",
+ "product_types": "Des modèles qui donnent aux nouveaux produits leurs champs et leurs options.",
+ "stock_transfers": "Le stock qui circule entre vos entrepôts, et ce qui est arrivé."
+ },
"tax_categories": {
"add_cta": "Ajouter une catégorie de taxe",
"create_description": "Regroupez les produits par traitement fiscal (standard, réduit, exonéré, …).",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 362d3d03a8..0dfd20c328 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -335,7 +335,7 @@
"collections": {
"add_cta": "Nowa kolekcja",
"columns": {
- "membership": "Przypisanie",
+ "kind": "Rodzaj",
"products_count": "Produkty",
"sort_order": "Sortowanie"
},
@@ -4925,6 +4925,18 @@
"oz": "Uncja (oz)"
}
},
+ "table_descriptions": {
+ "catalogs": "Co widzi dana grupa kupujących i jakie ceny płaci.",
+ "categories": "Drzewo nawigacji, po którym klienci przeglądają sklep.",
+ "collections": "Grupy produktów prezentowane razem, wybrane ręcznie lub regułą.",
+ "companies": "Klienci biznesowi, ich zespoły i warunki, na jakich kupują.",
+ "customer_groups": "Grupy, do których przypisujesz klientów — dla cen i promocji.",
+ "delivery_profiles": "Reguły wysyłki produktu, stosowane dla każdego produktu.",
+ "options": "Cechy takie jak rozmiar czy kolor, które tworzą warianty produktu.",
+ "price_lists": "Alternatywne ceny, które obowiązują, gdy pasują ich reguły.",
+ "product_types": "Szablony nadające nowym produktom pola i opcje.",
+ "stock_transfers": "Zapasy przemieszczane między lokalizacjami i to, co już dotarło."
+ },
"tax_categories": {
"add_cta": "Dodaj kategorię podatkową",
"create_description": "Grupuj produkty według sposobu opodatkowania (standardowa, obniżona, zwolniona, …).",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 79e29ae7f5..89a6dbdf34 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -330,7 +330,7 @@
"collections": {
"add_cta": "新建系列",
"columns": {
- "membership": "商品来源",
+ "kind": "类型",
"products_count": "商品",
"sort_order": "排序"
},
@@ -4862,6 +4862,18 @@
"oz": "盎司 (oz)"
}
},
+ "table_descriptions": {
+ "catalogs": "某一类买家能看到的商品,以及他们支付的价格。",
+ "categories": "顾客浏览店铺所依循的分类树。",
+ "collections": "一起陈列的商品组合,可手动挑选或按规则生成。",
+ "companies": "企业买家、他们的团队,以及采购条款。",
+ "customer_groups": "用于定价和促销的客户分组。",
+ "delivery_profiles": "按商品应用的配送规则。",
+ "options": "尺码、颜色等选项,用于生成商品的多个款式。",
+ "price_lists": "规则匹配时生效的备选价格。",
+ "product_types": "为新商品预设字段和选项的模板。",
+ "stock_transfers": "在各地点之间调拨的库存,以及已到货的部分。"
+ },
"tax_categories": {
"add_cta": "添加税务类别",
"create_description": "按税务处理方式对商品进行分组(标准、减免、免税等)。",
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/index.tsx
index ea9fcb10b6..ac5c6d99d9 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/index.tsx
@@ -1,10 +1,9 @@
import type { Category } from '@spree/admin-sdk'
-import { Can, Subject } from '@spree/dashboard-core'
+import { Can, SectionHeading, Subject } from '@spree/dashboard-core'
import {
Button,
Card,
CardContent,
- CardTitle,
InputGroup,
InputGroupAddon,
InputGroupInput,
@@ -73,8 +72,12 @@ function CategoriesPage() {
return (
<>
<Card className="overflow-hidden rounded-xl">
- <div className="flex flex-col items-start justify-between gap-2 border-b border-border-subtle p-3 lg:flex-row lg:items-center">
- <CardTitle>{t('admin.categories.title')}</CardTitle>
+ <div className="flex flex-col items-start justify-between gap-2 border-b border-border-subtle p-3 lg:flex-row lg:items-start">
+ <SectionHeading
+ title={t('admin.categories.title')}
+ description={t('admin.table_descriptions.categories')}
+ docsPath="manage-products/product-taxonomies"
+ />
<div className="flex items-center gap-2">
<InputGroup className="lg:w-[300px]">
<InputGroupAddon>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
index 35e83686d5..e87e100012 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
@@ -3,7 +3,7 @@ import {
adminClient,
Can,
ImageUploadField,
- PageHeader,
+ SectionHeading,
Subject,
useDirectUpload,
usePermissions,
@@ -11,6 +11,8 @@ import {
import {
Badge,
Button,
+ Card,
+ CardContent,
ContextMenu,
ContextMenuContent,
ContextMenuItem,
@@ -212,170 +214,174 @@ function MediaLibraryPage() {
return (
<>
- <PageHeader
- title={t('admin.media_library.title')}
- subtitle={t('admin.media_library.description')}
- actions={
- <Can I="update" a={Subject.Media}>
- <input
- ref={fileInputRef}
- type="file"
- multiple
- accept="image/png,image/jpeg,image/webp,image/gif,video/mp4,video/webm"
- className="hidden"
- onChange={(e) => handleUpload(e.target.files)}
- />
- <Button
- type="button"
- disabled={uploading}
- onClick={() => fileInputRef.current?.click()}
- >
- {uploading ? (
- <Loader2Icon className="size-4 animate-spin" />
- ) : (
- <UploadIcon className="size-4" />
- )}
- {t('admin.media_library.upload')}
- </Button>
- </Can>
- }
- />
-
- <div className="flex flex-col gap-3 px-4 pb-4 sm:flex-row sm:items-center">
- <SearchInput
- value={searchInput}
- onValueChange={(value) => {
- setSearchInput(value)
- patchSearch({ search: value || undefined }, true)
- }}
- placeholder={t('admin.media_library.search_placeholder')}
- clearLabel={t('admin.common.clear')}
- className="sm:max-w-xs"
- />
-
- <Select
- items={PLACEMENT_FILTERS.map((value) => ({
- value,
- label: t(`admin.media_library.placement.${value}`),
- }))}
- value={placement}
- onValueChange={(value) => patchSearch({ placement: value as PlacementFilter })}
- >
- <SelectTrigger className="sm:w-44">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {PLACEMENT_FILTERS.map((value) => (
- <SelectItem key={value} value={value}>
- {t(`admin.media_library.placement.${value}`)}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
-
- <Select
- items={TYPE_FILTERS.map((value) => ({
- value,
- label: t(`admin.media_library.type.${value}`),
- }))}
- value={mediaType}
- onValueChange={(value) => patchSearch({ type: value as TypeFilter })}
- >
- <SelectTrigger className="sm:w-44">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {TYPE_FILTERS.map((value) => (
- <SelectItem key={value} value={value}>
- {t(`admin.media_library.type.${value}`)}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
-
- <div className="px-4 pb-8">
- {query.isLoading ? (
- <div className="flex items-center justify-center py-16 text-muted-foreground">
- <Loader2Icon className="size-5 animate-spin" />
+ {/* Same shell as every other list page: the title, its description and
+ the filters all live inside one card rather than floating above it. */}
+ <Card className="-mx-4 rounded-none border-0 bg-transparent sm:mx-0 sm:rounded-xl sm:border sm:bg-card">
+ <div className="flex flex-row items-start gap-2 border-b border-border-subtle p-3 pl-4 lg:justify-between">
+ <SectionHeading
+ title={t('admin.media_library.title')}
+ description={t('admin.media_library.description')}
+ />
+ <div className="ml-auto flex shrink-0 items-center gap-2">
+ <Can I="update" a={Subject.Media}>
+ <input
+ ref={fileInputRef}
+ type="file"
+ multiple
+ accept="image/png,image/jpeg,image/webp,image/gif,video/mp4,video/webm"
+ className="hidden"
+ onChange={(e) => handleUpload(e.target.files)}
+ />
+ <Button
+ type="button"
+ disabled={uploading}
+ onClick={() => fileInputRef.current?.click()}
+ >
+ {uploading ? (
+ <Loader2Icon className="size-4 animate-spin" />
+ ) : (
+ <UploadIcon className="size-4" />
+ )}
+ {t('admin.media_library.upload')}
+ </Button>
+ </Can>
</div>
- ) : files.length === 0 ? (
- <p className="py-16 text-center text-muted-foreground text-sm">
- {deferredSearch.trim() || placement !== 'all' || mediaType !== 'all'
- ? t('admin.media_library.no_results')
- : t('admin.media_library.empty')}
- </p>
- ) : (
- <ul className="grid grid-cols-2 gap-4 sm:grid-cols-4 lg:grid-cols-6">
- {files.map((media) => (
- <li key={media.id}>
- <ContextMenu>
- <ContextMenuTrigger
- render={
- <button
- type="button"
- onClick={() => setSelected(media)}
- className="block w-full cursor-pointer text-left overflow-hidden rounded-md border border-border transition-colors hover:border-muted-foreground focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2"
- />
- }
- >
- <MediaTile media={media} />
- <span className="block truncate px-2 py-1.5 text-xs">
- {media.alt || media.filename || ''}
- </span>
- </ContextMenuTrigger>
-
- {/* A shortcut to what the detail panel already offers —
+ </div>
+
+ <div className="flex flex-col gap-3 border-b border-border-subtle px-3 py-2 sm:flex-row sm:items-center">
+ <SearchInput
+ value={searchInput}
+ onValueChange={(value) => {
+ setSearchInput(value)
+ patchSearch({ search: value || undefined }, true)
+ }}
+ placeholder={t('admin.media_library.search_placeholder')}
+ clearLabel={t('admin.common.clear')}
+ className="sm:max-w-xs"
+ />
+
+ <Select
+ items={PLACEMENT_FILTERS.map((value) => ({
+ value,
+ label: t(`admin.media_library.placement.${value}`),
+ }))}
+ value={placement}
+ onValueChange={(value) => patchSearch({ placement: value as PlacementFilter })}
+ >
+ <SelectTrigger className="sm:w-44">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {PLACEMENT_FILTERS.map((value) => (
+ <SelectItem key={value} value={value}>
+ {t(`admin.media_library.placement.${value}`)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+
+ <Select
+ items={TYPE_FILTERS.map((value) => ({
+ value,
+ label: t(`admin.media_library.type.${value}`),
+ }))}
+ value={mediaType}
+ onValueChange={(value) => patchSearch({ type: value as TypeFilter })}
+ >
+ <SelectTrigger className="sm:w-44">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {TYPE_FILTERS.map((value) => (
+ <SelectItem key={value} value={value}>
+ {t(`admin.media_library.type.${value}`)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+
+ <CardContent className="p-4">
+ {query.isLoading ? (
+ <div className="flex items-center justify-center py-16 text-muted-foreground">
+ <Loader2Icon className="size-5 animate-spin" />
+ </div>
+ ) : files.length === 0 ? (
+ <p className="py-16 text-center text-muted-foreground text-sm">
+ {deferredSearch.trim() || placement !== 'all' || mediaType !== 'all'
+ ? t('admin.media_library.no_results')
+ : t('admin.media_library.empty')}
+ </p>
+ ) : (
+ <ul className="grid grid-cols-2 gap-4 sm:grid-cols-4 lg:grid-cols-6">
+ {files.map((media) => (
+ <li key={media.id}>
+ <ContextMenu>
+ <ContextMenuTrigger
+ render={
+ <button
+ type="button"
+ onClick={() => setSelected(media)}
+ className="block w-full cursor-pointer text-left overflow-hidden rounded-md border border-border transition-colors hover:border-muted-foreground focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2"
+ />
+ }
+ >
+ <MediaTile media={media} />
+ <span className="block truncate px-2 py-1.5 text-xs">
+ {media.alt || media.filename || ''}
+ </span>
+ </ContextMenuTrigger>
+
+ {/* A shortcut to what the detail panel already offers —
right-click is undiscoverable and absent on touch. */}
- <ContextMenuContent>
- <ContextMenuItem onClick={() => setSelected(media)}>
- <PencilIcon />
- {t('admin.actions.edit')}
- </ContextMenuItem>
- {media.download_url && (
- // A click rather than an anchor: Base UI's `render`
- // replaces the item, and the URL already carries a
- // Content-Disposition attachment header, so navigating
- // to it downloads rather than opening a page.
- <ContextMenuItem
- onClick={() => {
- window.location.href = media.download_url as string
- }}
- >
- <DownloadIcon />
- {t('admin.media_library.download')}
+ <ContextMenuContent>
+ <ContextMenuItem onClick={() => setSelected(media)}>
+ <PencilIcon />
+ {t('admin.actions.edit')}
</ContextMenuItem>
- )}
- {canWrite && (
- <>
- <ContextMenuSeparator />
+ {media.download_url && (
+ // A click rather than an anchor: Base UI's `render`
+ // replaces the item, and the URL already carries a
+ // Content-Disposition attachment header, so navigating
+ // to it downloads rather than opening a page.
<ContextMenuItem
- variant="destructive"
- onClick={() => handleDeleteFromGrid(media)}
+ onClick={() => {
+ window.location.href = media.download_url as string
+ }}
>
- <TrashIcon />
- {t('admin.actions.delete')}
+ <DownloadIcon />
+ {t('admin.media_library.download')}
</ContextMenuItem>
- </>
- )}
- </ContextMenuContent>
- </ContextMenu>
- </li>
- ))}
- </ul>
- )}
+ )}
+ {canWrite && (
+ <>
+ <ContextMenuSeparator />
+ <ContextMenuItem
+ variant="destructive"
+ onClick={() => handleDeleteFromGrid(media)}
+ >
+ <TrashIcon />
+ {t('admin.actions.delete')}
+ </ContextMenuItem>
+ </>
+ )}
+ </ContextMenuContent>
+ </ContextMenu>
+ </li>
+ ))}
+ </ul>
+ )}
+ </CardContent>
{meta && files.length > 0 && (
- <div className="pt-4">
- <Pagination
- meta={meta}
- pageSizeOptions={PAGE_SIZES}
- onPageChange={(next) => patchSearch({ page: next })}
- onPageSizeChange={(size) => patchSearch({ limit: size })}
- />
- </div>
+ <Pagination
+ meta={meta}
+ pageSizeOptions={PAGE_SIZES}
+ onPageChange={(next) => patchSearch({ page: next })}
+ onPageSizeChange={(size) => patchSearch({ limit: size })}
+ />
)}
- </div>
+ </Card>
<MediaDetailSheet
media={selected}
diff --git a/packages/dashboard/src/tables/catalogs.tsx b/packages/dashboard/src/tables/catalogs.tsx
index bf0cc8a746..28c9a07cc1 100644
--- a/packages/dashboard/src/tables/catalogs.tsx
+++ b/packages/dashboard/src/tables/catalogs.tsx
@@ -6,6 +6,8 @@ import i18n from 'i18next'
defineTable<Catalog>('catalogs', {
title: i18n.t('admin.nav.catalogs'),
+ description: i18n.t('admin.table_descriptions.catalogs'),
+ docsPath: 'manage-products/catalogs',
searchParam: 'name_cont',
searchPlaceholder: i18n.t('admin.catalogs.search_placeholder'),
defaultSort: { field: 'position', direction: 'asc' },
diff --git a/packages/dashboard/src/tables/collections.tsx b/packages/dashboard/src/tables/collections.tsx
index 833ee78a0c..bc456edc05 100644
--- a/packages/dashboard/src/tables/collections.tsx
+++ b/packages/dashboard/src/tables/collections.tsx
@@ -7,6 +7,8 @@ import { sortOrderLabelKey } from '../schemas/collection'
defineTable<Collection>('collections', {
title: i18n.t('admin.collections.title'),
+ description: i18n.t('admin.table_descriptions.collections'),
+ docsPath: 'manage-products/product-taxonomies',
searchParam: 'name_cont',
searchPlaceholder: i18n.t('admin.collections.search_placeholder'),
defaultSort: { field: 'position', direction: 'asc' },
@@ -29,9 +31,16 @@ defineTable<Collection>('collections', {
},
{
key: 'automatic',
- label: i18n.t('admin.collections.columns.membership'),
+ label: i18n.t('admin.collections.columns.kind'),
filterable: true,
- filterType: 'boolean',
+ quickFilter: true,
+ // Named values rather than a boolean: "Yes / No" against a column
+ // headed Kind says nothing about what is being asked.
+ filterType: 'enum',
+ filterOptions: [
+ { value: 'false', label: i18n.t('admin.collections.membership.manual') },
+ { value: 'true', label: i18n.t('admin.collections.membership.automatic') },
+ ],
default: true,
render: (collection) => (
<Badge variant="outline">
diff --git a/packages/dashboard/src/tables/companies.tsx b/packages/dashboard/src/tables/companies.tsx
index 30be117e55..6a46e5facc 100644
--- a/packages/dashboard/src/tables/companies.tsx
+++ b/packages/dashboard/src/tables/companies.tsx
@@ -7,6 +7,7 @@ import { CompanyKindBadge } from '../components/spree/company-kind-badge'
defineTable<Company>('companies', {
title: i18n.t('admin.nav.companies'),
+ description: i18n.t('admin.table_descriptions.companies'),
searchParam: 'name_cont',
searchPlaceholder: i18n.t('admin.companies.search_placeholder'),
defaultSort: { field: 'name', direction: 'asc' },
diff --git a/packages/dashboard/src/tables/customer-groups.tsx b/packages/dashboard/src/tables/customer-groups.tsx
index d546ceeb54..0a6150d740 100644
--- a/packages/dashboard/src/tables/customer-groups.tsx
+++ b/packages/dashboard/src/tables/customer-groups.tsx
@@ -6,6 +6,8 @@ import i18n from 'i18next'
defineTable<CustomerGroup>('customer-groups', {
title: i18n.t('admin.customers.groups.table.title'),
+ description: i18n.t('admin.table_descriptions.customer_groups'),
+ docsPath: 'customers/customer-groups',
searchParam: 'name_cont',
searchPlaceholder: i18n.t('admin.customers.groups.table.search_placeholder'),
defaultSort: { field: 'name', direction: 'asc' },
diff --git a/packages/dashboard/src/tables/delivery-profiles.tsx b/packages/dashboard/src/tables/delivery-profiles.tsx
index 852f759955..312f7e65dd 100644
--- a/packages/dashboard/src/tables/delivery-profiles.tsx
+++ b/packages/dashboard/src/tables/delivery-profiles.tsx
@@ -6,6 +6,8 @@ import i18n from 'i18next'
defineTable<DeliveryProfile>('delivery-profiles', {
title: i18n.t('admin.settings_nav.items.delivery_profiles'),
+ description: i18n.t('admin.table_descriptions.delivery_profiles'),
+ docsPath: 'settings/shipping-methods',
searchParam: 'name_cont',
searchPlaceholder: i18n.t('admin.delivery_profiles.search_placeholder'),
defaultSort: { field: 'position', direction: 'asc' },
diff --git a/packages/dashboard/src/tables/option-types.tsx b/packages/dashboard/src/tables/option-types.tsx
index d92489d0da..baf242a8eb 100644
--- a/packages/dashboard/src/tables/option-types.tsx
+++ b/packages/dashboard/src/tables/option-types.tsx
@@ -12,6 +12,8 @@ const KIND_LABELS: Record<string, string> = {
defineTable<OptionType>('option-types', {
title: i18n.t('admin.nav.options'),
+ description: i18n.t('admin.table_descriptions.options'),
+ docsPath: 'manage-products/product-options',
searchParam: 'name_cont',
searchPlaceholder: i18n.t('admin.option_types.table.search_placeholder'),
defaultSort: { field: 'position', direction: 'asc' },
diff --git a/packages/dashboard/src/tables/price-lists.tsx b/packages/dashboard/src/tables/price-lists.tsx
index c46435db43..46594824fe 100644
--- a/packages/dashboard/src/tables/price-lists.tsx
+++ b/packages/dashboard/src/tables/price-lists.tsx
@@ -7,6 +7,8 @@ import { PriceListStatusBadge } from '../components/spree/price-list-editors/sta
defineTable<PriceList>('price-lists', {
title: i18n.t('admin.nav.price_lists'),
+ description: i18n.t('admin.table_descriptions.price_lists'),
+ docsPath: 'manage-products/price-lists',
searchParam: 'name_cont',
searchPlaceholder: i18n.t('admin.common.search_placeholder'),
defaultSort: { field: 'position', direction: 'asc' },
diff --git a/packages/dashboard/src/tables/product-types.tsx b/packages/dashboard/src/tables/product-types.tsx
index 654780d09e..54e8fda043 100644
--- a/packages/dashboard/src/tables/product-types.tsx
+++ b/packages/dashboard/src/tables/product-types.tsx
@@ -6,6 +6,7 @@ import i18n from 'i18next'
defineTable<ProductType>('product-types', {
title: i18n.t('admin.settings_nav.items.product_types'),
+ description: i18n.t('admin.table_descriptions.product_types'),
searchParam: 'name_cont',
searchPlaceholder: i18n.t('admin.product_types.search_placeholder'),
defaultSort: { field: 'name', direction: 'asc' },
diff --git a/packages/dashboard/src/tables/stock-transfers.tsx b/packages/dashboard/src/tables/stock-transfers.tsx
index f3902e56e1..d55106f1f0 100644
--- a/packages/dashboard/src/tables/stock-transfers.tsx
+++ b/packages/dashboard/src/tables/stock-transfers.tsx
@@ -6,7 +6,9 @@ import i18n from 'i18next'
defineTable<StockTransfer>('stock-transfers', {
title: i18n.t('admin.stock_transfers.title'),
- searchParam: 'number_cont',
+ description: i18n.t('admin.table_descriptions.stock_transfers'),
+ docsPath: 'manage-products/stock-transfers',
+ searchParam: 'number_or_reference_cont',
searchPlaceholder: i18n.t('admin.stock_transfers.table.search_placeholder'),
defaultSort: { field: 'created_at', direction: 'desc' },
emptyIcon: <ArrowLeftRightIcon className="size-8 text-muted-foreground" />,
@@ -42,7 +44,6 @@ defineTable<StockTransfer>('stock-transfers', {
{
key: 'reference',
label: i18n.t('admin.stock_transfers.columns.reference'),
- filterable: true,
default: true,
render: (st) => st.reference ?? '—',
},
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/stock_transfers_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/stock_transfers_controller_spec.rb
index f0b695ba1e..c9916061b6 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/stock_transfers_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/stock_transfers_controller_spec.rb
@@ -26,6 +26,32 @@ RSpec.describe Spree::Api::V3::Admin::StockTransfersController, type: :controlle
expect(response).to have_http_status(:ok)
expect(json_response['data'].map { |t| t['id'] }).to include(transfer.prefixed_id)
end
+
+ # The dashboard's search box sends this one predicate for both columns, so
+ # a whitelist that covers only `number` would silently return every row.
+ context 'searching by number or reference' do
+ let!(:referenced) do
+ Spree::StockTransfer.new(reference: 'PO-4471').tap do |t|
+ t.transfer(source_location, destination_location, variant => 1)
+ end
+ end
+
+ it 'matches on the reference' do
+ get :index, params: { q: { number_or_reference_cont: 'PO-4471' } }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ ids = json_response['data'].map { |t| t['id'] }
+ expect(ids).to eq([referenced.prefixed_id])
+ end
+
+ it 'matches on the number' do
+ get :index, params: { q: { number_or_reference_cont: transfer.number } }, as: :json
+
+ expect(response).to have_http_status(:ok)
+ ids = json_response['data'].map { |t| t['id'] }
+ expect(ids).to eq([transfer.prefixed_id])
+ end
+ end
end
describe 'POST #create' do