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 branding (#14424)

Damian Legawiecc79597bfea2c
diff --git a/packages/dashboard-core/src/components/bulk-action-bar.tsx b/packages/dashboard-core/src/components/bulk-action-bar.tsx
index e98f63ffa8..fe132b4465 100644
--- a/packages/dashboard-core/src/components/bulk-action-bar.tsx
+++ b/packages/dashboard-core/src/components/bulk-action-bar.tsx
@@ -8,10 +8,9 @@ import {
} from '@spree/dashboard-ui'
import type { QueryKey } from '@tanstack/react-query'
import { useQueryClient } from '@tanstack/react-query'
-import { MoreHorizontalIcon, XIcon } from 'lucide-react'
+import { MoreHorizontalIcon } from 'lucide-react'
import type { ReactNode } from 'react'
-import { useEffect, useLayoutEffect, useRef, useState } from 'react'
-import { createPortal } from 'react-dom'
+import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
import { usePermissions } from '../providers/permission-provider'
@@ -85,30 +84,15 @@ interface BulkActionBarProps {
// the precise type via `BulkAction<MyFormValues>`.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actions: BulkAction<any>[]
- onClear: () => void
/** Called after a successful run to refresh the table / clear selection. */
onDone: () => void
- /**
- * When set, the bar centers itself horizontally inside this element's
- * bounding rect on viewports wide enough to comfortably show it inside
- * (>= +md+ breakpoint). On smaller viewports it falls back to centering
- * against the visual viewport. Without this the bar always anchors to
- * the viewport.
- */
- anchorRef?: React.RefObject<HTMLElement | null>
}
function interpolate(template: string, n: number) {
return template.replace(/\{n\}/g, String(n))
}
-export function BulkActionBar({
- selectedIds,
- actions,
- onClear,
- onDone,
- anchorRef,
-}: BulkActionBarProps) {
+export function BulkActionBar({ selectedIds, actions, onDone }: BulkActionBarProps) {
const { t } = useTranslation()
const confirm = useConfirm()
const queryClient = useQueryClient()
@@ -126,13 +110,19 @@ export function BulkActionBar({
if (count === 0) setPendingForm(null)
}, [count])
- if (count === 0) return null
-
- // Filter by CanCanCan when subject is declared.
- const visibleActions = actions.filter((a) =>
- a.subject ? permissions.can(a.action ?? 'update', a.subject) : true,
+ // Filter by CanCanCan when subject is declared. Memoized so the layout below
+ // can treat a change here as a real change: it re-measures the overflow
+ // whenever the action set does, and a fresh array every render would make
+ // that run on every render instead. Must stay above the early return —
+ // hooks cannot be called conditionally.
+ const visibleActions = useMemo(
+ () =>
+ actions.filter((a) => (a.subject ? permissions.can(a.action ?? 'update', a.subject) : true)),
+ [actions, permissions],
)
+ if (count === 0) return null
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function execute(action: BulkAction<any>, formValues?: unknown) {
setRunning(true)
@@ -184,8 +174,6 @@ export function BulkActionBar({
<BulkActionBarLayout
count={count}
actions={visibleActions}
- anchorRef={anchorRef}
- onClear={onClear}
onClickAction={handleClick}
running={running}
pendingForm={pendingForm}
@@ -205,8 +193,6 @@ interface BulkActionBarLayoutProps {
count: number
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actions: BulkAction<any>[]
- anchorRef?: React.RefObject<HTMLElement | null>
- onClear: () => void
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onClickAction: (action: BulkAction<any>) => void
running: boolean
@@ -228,8 +214,6 @@ interface BulkActionBarLayoutProps {
function BulkActionBarLayout({
count,
actions,
- anchorRef,
- onClear,
onClickAction,
running,
pendingForm,
@@ -239,104 +223,30 @@ function BulkActionBarLayout({
}: BulkActionBarLayoutProps) {
const { t } = useTranslation()
- // The bar is centered (+w-fit+) so the parent doesn't constrain it; instead
- // we cap against the viewport with a sensible margin.
const containerRef = useRef<HTMLDivElement | null>(null)
const measureRef = useRef<HTMLDivElement | null>(null)
// Width of the bar's leading section (clear button + label + divider).
const leadingRef = useRef<HTMLDivElement | null>(null)
const [visibleCount, setVisibleCount] = useState(actions.length)
- // JS-computed position so it's immune to transformed ancestors.
- const [barLeft, setBarLeft] = useState(0)
- const [barTop, setBarTop] = useState(0)
-
- // Max-width state so the bar never extends past its host region (the
- // table card on desktop, the visual viewport on mobile).
- const [maxWidth, setMaxWidth] = useState<number | null>(null)
-
- // Reposition + remeasure on viewport resize, scroll, and font load.
- useLayoutEffect(() => {
- function reposition() {
- const el = containerRef.current
- if (!el) return
- const width = el.offsetWidth
- const height = el.offsetHeight
- // visualViewport accounts for the mobile browser URL bar collapsing;
- // falls back to window dimensions on browsers without the API.
- const vv = window.visualViewport
- const vpWidth = vv?.width ?? window.innerWidth
- const vpHeight = vv?.height ?? window.innerHeight
- const vpLeft = vv?.offsetLeft ?? 0
- const vpTop = vv?.offsetTop ?? 0
-
- // Pin to viewport bottom. The bar should always stay reachable —
- // anchoring to the table card pinned it to the table's bottom, which
- // sits off-screen when the table is taller than the viewport.
- let left = vpLeft + Math.round((vpWidth - width) / 2)
- // Cap width at viewport - 2rem on mobile.
- let cap = vpWidth - 32
- // If an anchor element is provided, clamp the horizontal center AND
- // the max width to the anchor's bounding rect, so on desktop the bar
- // reads as part of the table region rather than free-floating across
- // the whole page.
- const anchor = anchorRef?.current
- if (anchor && vpWidth >= 768) {
- const rect = anchor.getBoundingClientRect()
- left = rect.left + Math.round((rect.width - width) / 2)
- cap = Math.round(rect.width * 0.9) // 90% of the table card width
- }
- setBarLeft(left)
- setBarTop(vpTop + vpHeight - height - 16) // 16px from bottom
- setMaxWidth(cap)
- }
- reposition()
- window.addEventListener('resize', reposition)
- window.addEventListener('scroll', reposition, true)
- window.visualViewport?.addEventListener('resize', reposition)
- window.visualViewport?.addEventListener('scroll', reposition)
- // Track the anchor's own size/position changes (sidebar collapse,
- // pagination footer height swaps, etc.).
- let ro: ResizeObserver | undefined
- if (anchorRef?.current) {
- ro = new ResizeObserver(reposition)
- ro.observe(anchorRef.current)
- }
- return () => {
- window.removeEventListener('resize', reposition)
- window.removeEventListener('scroll', reposition, true)
- window.visualViewport?.removeEventListener('resize', reposition)
- window.visualViewport?.removeEventListener('scroll', reposition)
- ro?.disconnect()
- }
- // Re-run when the anchor element resolves (refs are null on first render
- // and populated on the next commit). The +ResizeObserver+ + window
- // listeners re-attach to whatever anchor the consumer passed.
- }, [anchorRef?.current])
// Measure once on mount + whenever the container or action set changes.
// +useLayoutEffect+ so the user never sees a flash of overflowing actions.
useLayoutEffect(() => {
function recompute() {
+ const container = containerRef.current
const measure = measureRef.current
const leading = leadingRef.current
- if (!measure || !leading) return
+ if (!container || !measure || !leading) return
- // Compute available action-area width against the same cap that the
- // bar's +max-width+ uses (table card width on desktop, viewport on
- // mobile) so the overflow count matches what the user will see.
- const anchor = anchorRef?.current
- const vpWidth = document.documentElement.clientWidth
- const cap =
- anchor && vpWidth >= 768
- ? Math.round(anchor.getBoundingClientRect().width * 0.9)
- : vpWidth - 32
- // 16px for the bar's own +p-1+ + border + subpixel safety pad.
- const available = cap - 16 - leading.offsetWidth
+ // The bar spans the header row, so the budget is its own width less the
+ // leading section (the "n selected" count + divider). The container sits
+ // inside the host cell's padding and after the select-all checkbox, so
+ // neither needs subtracting here.
+ const available = container.clientWidth - leading.offsetWidth
// +⋯+ button (icon-sm = 28px) + gap on each side + safety margin.
- // 64px keeps the dropdown comfortably visible on narrow viewports
- // and gives the menu room to position without spilling off-screen.
const moreWidth = 64
- const children = Array.from(measure.children) as HTMLElement[]
+ // One measured child per action, in order.
+ const children = Array.from(measure.children).slice(0, actions.length) as HTMLElement[]
const widths = children.map((el) => el.offsetWidth)
let used = 0
@@ -357,50 +267,34 @@ function BulkActionBarLayout({
recompute()
const ro = new ResizeObserver(recompute)
if (containerRef.current) ro.observe(containerRef.current)
- if (anchorRef?.current) ro.observe(anchorRef.current)
window.addEventListener('resize', recompute)
return () => {
ro.disconnect()
window.removeEventListener('resize', recompute)
}
- // Re-run only when the anchor element resolves (refs are null on first
- // render and populated on commit). Changes to +actions+ don't need an
- // explicit dep — the +ResizeObserver+ on the container fires when
- // children render/unrender, which re-triggers +recompute+.
- }, [anchorRef?.current])
+ // Re-measure when the action set changes, not only when the container
+ // resizes: the list is filtered by permission, so it can gain or lose
+ // buttons — and a language switch relabels them — with the bar's own width
+ // unchanged. The measuring row is zero-width by design, so observing it
+ // would not catch either case.
+ }, [actions])
const visible = actions.slice(0, visibleCount)
const overflow = actions.slice(visibleCount)
- // JS-driven positioning: +position: fixed+ silently re-anchors to a
- // transformed/contained ancestor (sidebar wrapper, Card, etc.) on this
- // app. Portaling to +document.body+ should sidestep that, but in
- // practice the bar still landed at the table's bottom on mobile. So we
- // set explicit +top/left+ in pixels from +window+ measurements every
- // frame the viewport changes. No CSS positioning, no ambiguity.
- const bar = (
+ // `w-full` matters for more than layout: this is the element the overflow
+ // calculation measures, and as a bare flex item it would size to its own
+ // content instead of the header cell, leaving almost no budget and pushing
+ // every action into the `⋯` menu.
+ return (
<>
<div
ref={containerRef}
- style={{
- position: 'fixed',
- left: `${barLeft}px`,
- top: `${barTop}px`,
- maxWidth: maxWidth != null ? `${maxWidth}px` : 'calc(100vw - 2rem)',
- }}
- className="z-50 flex w-fit items-center gap-0.5 rounded-xl border bg-popover p-1 shadow-md"
+ className="flex w-full items-center gap-0.5 overflow-hidden animate-in fade-in slide-in-from-left-2 duration-150 ease-out"
>
+ {/* No clear button: the bar sits beside the header's select-all
+ checkbox, which already clears the selection. */}
<div ref={leadingRef} className="flex items-center gap-0.5">
- <Button
- type="button"
- variant="ghost"
- size="icon-sm"
- onClick={onClear}
- aria-label={t('admin.actions.clear')}
- className="text-muted-foreground"
- >
- <XIcon className="size-4" />
- </Button>
<span className="whitespace-nowrap px-1.5 text-sm">
{t('admin.components.bulk_action_bar.selected', { count })}
</span>
@@ -450,7 +344,11 @@ function BulkActionBarLayout({
<div
ref={measureRef}
aria-hidden
- className="pointer-events-none invisible absolute left-0 top-0 flex items-center gap-0.5"
+ // `overflow-hidden` on a zero-width box: the buttons keep their
+ // natural `offsetWidth` for measurement, but nothing escapes to
+ // stretch the table's scroll width — without it every list becomes
+ // horizontally scrollable whenever rows are selected.
+ className="pointer-events-none invisible absolute left-0 top-0 flex w-0 items-center gap-0.5 overflow-hidden"
>
{actions.map((action) => (
<BulkActionButton
@@ -470,9 +368,6 @@ function BulkActionBarLayout({
})}
</>
)
-
- if (typeof document === 'undefined') return bar
- return createPortal(bar, document.body)
}
function BulkActionButton({
@@ -495,7 +390,11 @@ function BulkActionButton({
onClick={onClick}
disabled={disabled}
tabIndex={tabIndex}
- className="gap-1.5 whitespace-nowrap px-2"
+ // `shrink-0` so the zero-width measuring layer can't squeeze these and
+ // report a width smaller than the button really renders at. Hover is the
+ // ghost variant's own `bg-accent` — no override needed now that the bar's
+ // muted background sits well clear of it.
+ className="shrink-0 gap-1.5 whitespace-nowrap px-2"
>
{action.icon}
{action.label}
diff --git a/packages/dashboard-core/src/components/nav-main.tsx b/packages/dashboard-core/src/components/nav-main.tsx
index 1d3bbd6ac3..edeb071dd2 100644
--- a/packages/dashboard-core/src/components/nav-main.tsx
+++ b/packages/dashboard-core/src/components/nav-main.tsx
@@ -2,6 +2,7 @@ import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuSeparator,
DropdownMenuTrigger,
SidebarGroup,
SidebarMenu,
@@ -167,6 +168,16 @@ function CollapsedDropdown({
onMouseLeave={closeSoon}
onMouseEnter={openNow}
>
+ {/* The section itself leads the list. Collapsed, the icon is the only
+ route to it, and hovering opens this panel instead — so without an
+ entry here "Products" is reachable by a click most people won't
+ guess at, and not at all by keyboard. */}
+ <DropdownMenuItem asChild>
+ <Link to={item.url} className="no-underline font-medium">
+ {item.title}
+ </Link>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
{item.items!.map((subItem) => (
<DropdownMenuItem key={subItem.title} asChild>
<Link to={subItem.url} className="no-underline">
diff --git a/packages/dashboard-core/src/components/resource-table.tsx b/packages/dashboard-core/src/components/resource-table.tsx
index 9c4f63233f..1431c11ca3 100644
--- a/packages/dashboard-core/src/components/resource-table.tsx
+++ b/packages/dashboard-core/src/components/resource-table.tsx
@@ -34,6 +34,7 @@ import {
TableEmpty,
TableHead,
TableHeader,
+ TableHeaderRow,
TableRow,
} from '@spree/dashboard-ui'
import { useQuery, useQueryClient } from '@tanstack/react-query'
@@ -45,7 +46,6 @@ import {
useDeferredValue,
useEffect,
useMemo,
- useRef,
useState,
} from 'react'
import { useTranslation } from 'react-i18next'
@@ -218,9 +218,8 @@ export function ResourceTable<T extends Record<string, any>>({
const selectionEnabled = !!bulkActions?.length && !reorder
const rowActionsEnabled = !!rowActions
const [selectedIds, setSelectedIds] = useState<Set<string>>(() => new Set())
- // Used by +BulkActionBar+ to anchor itself within the table card on
- // desktop (instead of free-floating at the viewport bottom).
- const cardRef = useRef<HTMLDivElement | null>(null)
+ // Whether the bulk bar is covering the column labels.
+ const bulkActive = selectionEnabled && selectedIds.size > 0
const {
page,
@@ -457,7 +456,7 @@ export function ResourceTable<T extends Record<string, any>>({
: actions
return (
- <Card ref={cardRef} className="rounded-xl">
+ <Card className="rounded-xl">
<TableToolbar
columns={displayableColumns}
visibleColumns={visibleColumnKeys}
@@ -485,9 +484,9 @@ export function ResourceTable<T extends Record<string, any>>({
items={rows.map((r) => (r as any).id)}
strategy={verticalListSortingStrategy}
>
- <Table>
+ <Table stickyHeader>
<TableHeader>
- <tr>
+ <TableHeaderRow>
<TableHead className="w-8" />
{headerColumns.map((col) => (
<TableHead key={col.key} className={col.headerClassName}>
@@ -499,7 +498,7 @@ export function ResourceTable<T extends Record<string, any>>({
<span className="sr-only">{t('admin.row_actions.menu_label')}</span>
</TableHead>
)}
- </tr>
+ </TableHeaderRow>
</TableHeader>
<TableBody>
{isLoading ? (
@@ -539,90 +538,145 @@ export function ResourceTable<T extends Record<string, any>>({
</SortableContext>
</DndContext>
) : (
- <Table>
- <TableHeader>
- <tr>
- {selectionEnabled && (
- <TableHead className="w-8">
- <Checkbox
- checked={allPageSelected}
- indeterminate={somePageSelected}
- onCheckedChange={togglePage}
- aria-label={t('admin.a11y.select_all_rows')}
+ <>
+ {/* The bulk actions overlay the header row but live OUTSIDE the
+ table's horizontal scroller: out there their width is the
+ visible card rather than the table's full scroll width, so the
+ overflow-into-⋯ budget is right and the controls hold still
+ while the columns scroll sideways. A zero-height wrapper with
+ the same sticky offset as the pinned header keeps the two
+ travelling together; the start padding clears the select-all
+ checkbox, which stays visible and interactive underneath. */}
+ {bulkActive && (
+ // `pointer-events-none` on the overlay, re-enabled only on the
+ // bar itself: the start-padding gutter is part of this div and
+ // would otherwise swallow every click aimed at the select-all
+ // checkbox sitting beneath it — checking once, then never
+ // unchecking.
+ <div className="pointer-events-none sticky top-header-height z-30 h-0">
+ <div className="flex h-[2.1875rem] items-center ps-10 pe-4">
+ <div className="pointer-events-auto min-w-0 flex-1">
+ <BulkActionBar
+ selectedIds={Array.from(selectedIds)}
+ actions={bulkActions!}
+ onDone={() => {
+ setSelectedIds(new Set())
+ queryClient.invalidateQueries({ queryKey: queryKeyPrefix })
+ }}
/>
- </TableHead>
- )}
- {headerColumns.map((col) => (
- <TableHead key={col.key} className={col.headerClassName}>
- {col.label}
- </TableHead>
- ))}
- {rowActionsEnabled && (
- <TableHead className="w-12">
- <span className="sr-only">{t('admin.row_actions.menu_label')}</span>
- </TableHead>
- )}
- </tr>
- </TableHeader>
- <TableBody>
- {isLoading ? (
- <TableEmpty
- colSpan={
- visibleColumns.length + (selectionEnabled ? 1 : 0) + (rowActionsEnabled ? 1 : 0)
- }
- >
- {t('admin.common.loading')}
- </TableEmpty>
- ) : rows.length === 0 ? (
- <TableEmpty
- colSpan={
- visibleColumns.length + (selectionEnabled ? 1 : 0) + (rowActionsEnabled ? 1 : 0)
- }
- >
- <Empty className="border-0 p-0">
- <EmptyHeader>
- {table.emptyIcon && <EmptyMedia variant="icon">{table.emptyIcon}</EmptyMedia>}
- <EmptyTitle>{table.emptyMessage ?? t('admin.common.no_results')}</EmptyTitle>
- {(deferredSearch || (filters as FilterRule[]).length > 0) && (
- <EmptyDescription>
- {t('admin.common.adjust_search_or_filters')}
- </EmptyDescription>
+ </div>
+ </div>
+ </div>
+ )}
+ <Table stickyHeader>
+ <TableHeader>
+ {/* Column headers stay mounted with rows selected, and the bulk
+ bar is laid over them. Swapping them for one `colSpan` cell
+ instead would drop the width constraints they impose on an
+ auto-layout table, and every column would resize the moment a
+ row was ticked. `bulkActive` only hides the labels. */}
+ <TableHeaderRow>
+ {selectionEnabled && (
+ <TableHead className="w-8">
+ <Checkbox
+ checked={allPageSelected}
+ indeterminate={somePageSelected}
+ onCheckedChange={togglePage}
+ aria-label={t('admin.a11y.select_all_rows')}
+ />
+ </TableHead>
+ )}
+ {headerColumns.map((col) => (
+ <TableHead
+ key={col.key}
+ className={cn(
+ col.headerClassName,
+ 'transition-colors duration-150 ease-out',
+ // Hide the text, not the cell: `opacity-0` would erase
+ // the cell's muted background and bottom rule too,
+ // leaving rows visible through the band behind the
+ // bulk actions overlay.
+ bulkActive && 'text-transparent select-none',
)}
- </EmptyHeader>
- </Empty>
- </TableEmpty>
- ) : (
- rows.map((row, i) => {
- const rowId = String((row as any).id ?? i)
- const isSelected = selectionEnabled && selectedIds.has(rowId)
- return (
- <TableRow
- key={(row as any).id ?? i}
- className={isSelected ? 'bg-muted/40' : undefined}
>
- {selectionEnabled && (
- <TableCell className="w-8">
- <Checkbox
- checked={isSelected}
- onCheckedChange={() => toggleRow(rowId)}
- aria-label={t('admin.a11y.select_row')}
- />
- </TableCell>
- )}
- {visibleColumns.map((col) => (
- <TableCell key={col.key} className={col.className}>
- {col.render ? col.render(row) : String((row as any)[col.key] ?? '—')}
- </TableCell>
- ))}
- {rowActionsEnabled && (
- <TableCell className="w-12 text-right">{rowActions?.(row)}</TableCell>
- )}
- </TableRow>
- )
- })
- )}
- </TableBody>
- </Table>
+ {col.label}
+ </TableHead>
+ ))}
+ {rowActionsEnabled && (
+ <TableHead className="w-12">
+ <span className="sr-only">{t('admin.row_actions.menu_label')}</span>
+ </TableHead>
+ )}
+ </TableHeaderRow>
+ </TableHeader>
+ <TableBody>
+ {isLoading ? (
+ <TableEmpty
+ colSpan={
+ visibleColumns.length +
+ (selectionEnabled ? 1 : 0) +
+ (rowActionsEnabled ? 1 : 0)
+ }
+ >
+ {t('admin.common.loading')}
+ </TableEmpty>
+ ) : rows.length === 0 ? (
+ <TableEmpty
+ colSpan={
+ visibleColumns.length +
+ (selectionEnabled ? 1 : 0) +
+ (rowActionsEnabled ? 1 : 0)
+ }
+ >
+ <Empty className="border-0 p-0">
+ <EmptyHeader>
+ {table.emptyIcon && (
+ <EmptyMedia variant="icon">{table.emptyIcon}</EmptyMedia>
+ )}
+ <EmptyTitle>
+ {table.emptyMessage ?? t('admin.common.no_results')}
+ </EmptyTitle>
+ {(deferredSearch || (filters as FilterRule[]).length > 0) && (
+ <EmptyDescription>
+ {t('admin.common.adjust_search_or_filters')}
+ </EmptyDescription>
+ )}
+ </EmptyHeader>
+ </Empty>
+ </TableEmpty>
+ ) : (
+ rows.map((row, i) => {
+ const rowId = String((row as any).id ?? i)
+ const isSelected = selectionEnabled && selectedIds.has(rowId)
+ return (
+ <TableRow
+ key={(row as any).id ?? i}
+ className={isSelected ? 'bg-muted/40' : undefined}
+ >
+ {selectionEnabled && (
+ <TableCell className="w-8">
+ <Checkbox
+ checked={isSelected}
+ onCheckedChange={() => toggleRow(rowId)}
+ aria-label={t('admin.a11y.select_row')}
+ />
+ </TableCell>
+ )}
+ {visibleColumns.map((col) => (
+ <TableCell key={col.key} className={col.className}>
+ {col.render ? col.render(row) : String((row as any)[col.key] ?? '—')}
+ </TableCell>
+ ))}
+ {rowActionsEnabled && (
+ <TableCell className="w-12 text-right">{rowActions?.(row)}</TableCell>
+ )}
+ </TableRow>
+ )
+ })
+ )}
+ </TableBody>
+ </Table>
+ </>
)}
{meta && (
<Pagination
@@ -631,18 +685,6 @@ export function ResourceTable<T extends Record<string, any>>({
onPageSizeChange={(size) => updateSearch({ limit: size, page: 1 })}
/>
)}
- {selectionEnabled && (
- <BulkActionBar
- selectedIds={Array.from(selectedIds)}
- actions={bulkActions!}
- anchorRef={cardRef}
- onClear={() => setSelectedIds(new Set())}
- onDone={() => {
- setSelectedIds(new Set())
- queryClient.invalidateQueries({ queryKey: queryKeyPrefix })
- }}
- />
- )}
</CardContent>
</Card>
)
diff --git a/packages/dashboard-core/src/components/table-toolbar.tsx b/packages/dashboard-core/src/components/table-toolbar.tsx
index ad973b31c2..5dbb5363e1 100644
--- a/packages/dashboard-core/src/components/table-toolbar.tsx
+++ b/packages/dashboard-core/src/components/table-toolbar.tsx
@@ -183,7 +183,7 @@ export function TableToolbar({
{title && <CardTitle>{title}</CardTitle>}
<div className="flex gap-2 items-center flex-wrap ml-auto">
{/* Search */}
- <div className="flex items-center gap-2 border border-border bg-card rounded-lg shadow-xs px-2.5 h-[2.125rem] lg:w-[300px] focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] transition-all duration-100 ease-in-out">
+ <div className="flex items-center gap-2 border border-border bg-card rounded-lg shadow-xs px-2.5 h-[2.125rem] lg:w-[300px] focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] transition-all duration-100 ease-in-out">
<SearchIcon className="size-4 text-muted-foreground shrink-0" />
<input
ref={searchRef}
@@ -216,7 +216,7 @@ export function TableToolbar({
<Tooltip>
<TooltipTrigger asChild>
<PopoverTrigger asChild>
- <Button variant="outline" size="sm" className="h-[2.125rem]">
+ <Button variant="ghost" size="sm" className="h-[2.125rem]">
<FilterIcon className="size-4" />
{activeFilterCount > 0 && (
<Badge variant="outline" className="ml-1 px-1.5 py-0 text-xs">
@@ -469,7 +469,7 @@ function SortDropdown({
<Tooltip>
<TooltipTrigger asChild>
<DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm" className="h-[2.125rem]">
+ <Button variant="ghost" size="sm" className="h-[2.125rem]">
<ArrowUpDownIcon className="size-4" />
</Button>
</DropdownMenuTrigger>
@@ -536,7 +536,7 @@ function ColumnSelector({
<Tooltip>
<TooltipTrigger asChild>
<DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm" className="h-[2.125rem]">
+ <Button variant="ghost" size="sm" className="h-[2.125rem]">
<Columns3Icon className="size-4" />
</Button>
</DropdownMenuTrigger>
@@ -563,16 +563,14 @@ function ColumnSelector({
</DropdownMenuCheckboxItem>
))}
<DropdownMenuSeparator />
- <div className="px-1 py-1">
- <Button
- variant="ghost"
- size="sm"
- className="w-full justify-center"
- onClick={() => onVisibleColumnsChange(defaults)}
- >
- {t('admin.components.table_toolbar.reset_to_default')}
- </Button>
- </div>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="w-full justify-center"
+ onClick={() => onVisibleColumnsChange(defaults)}
+ >
+ {t('admin.components.table_toolbar.reset_to_default')}
+ </Button>
</DropdownMenuContent>
</DropdownMenu>
)
diff --git a/packages/dashboard-core/src/components/top-bar.tsx b/packages/dashboard-core/src/components/top-bar.tsx
index ba9588d710..43eee58725 100644
--- a/packages/dashboard-core/src/components/top-bar.tsx
+++ b/packages/dashboard-core/src/components/top-bar.tsx
@@ -17,6 +17,7 @@ import {
} from '@spree/dashboard-ui'
import {
BookOpenIcon,
+ CommandIcon,
ExternalLinkIcon,
LogOutIcon,
MailIcon,
@@ -111,12 +112,18 @@ function SearchTrigger() {
<button
type="button"
onClick={() => setOpen(true)}
- className="flex w-full max-w-md items-center gap-2 rounded-lg border border-border bg-muted/40 px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-muted"
+ // Focus matches the form inputs — the soft blue glow from `--ring`,
+ // rather than a hard offset ring. It looks like a search field, so it
+ // should focus like one.
+ className="flex w-full max-w-md cursor-pointer items-center gap-1 rounded-xl border border-border px-2 py-1.5 text-sm text-muted-foreground outline-none transition-[color,background-color,border-color,box-shadow] duration-100 ease-out hover:bg-accent focus-visible:border-ring focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]"
>
<SearchIcon className="size-4" />
<span className="flex-1 text-left">{t('admin.components.command_palette.placeholder')}</span>
- <kbd className="hidden rounded border bg-background px-1.5 py-0.5 font-mono text-xs sm:inline-flex">
- {IS_MAC ? '⌘K' : 'Ctrl+K'}
+ <kbd className="hidden rounded-lg border bg-background px-2 py-1 font-mono text-xs sm:inline-flex shadow-xs h-full">
+ {IS_MAC ? <CommandIcon size={15} /> : 'Ctrl'}
+ </kbd>
+ <kbd className="hidden rounded-lg border bg-background px-2 py-1 font-mono text-xs sm:inline-flex shadow-xs">
+ K
</kbd>
</button>
)
diff --git a/packages/dashboard-starter/index.html b/packages/dashboard-starter/index.html
index dec13fbb57..efd6d3785a 100644
--- a/packages/dashboard-starter/index.html
+++ b/packages/dashboard-starter/index.html
@@ -3,6 +3,9 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<title>Spree Admin</title>
</head>
<body>
diff --git a/packages/dashboard-starter/public/apple-touch-icon.png b/packages/dashboard-starter/public/apple-touch-icon.png
new file mode 100644
index 0000000000..f0d223ec7d
Binary files /dev/null and b/packages/dashboard-starter/public/apple-touch-icon.png differ
diff --git a/packages/dashboard-starter/public/favicon-32x32.png b/packages/dashboard-starter/public/favicon-32x32.png
new file mode 100644
index 0000000000..17270e998d
Binary files /dev/null and b/packages/dashboard-starter/public/favicon-32x32.png differ
diff --git a/packages/dashboard-starter/public/favicon.svg b/packages/dashboard-starter/public/favicon.svg
new file mode 100644
index 0000000000..3aee087a3f
--- /dev/null
+++ b/packages/dashboard-starter/public/favicon.svg
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50.5 13 220 220">
+ <style>
+ /* Tabs render on light or dark chrome; a single fixed colour disappears
+ against one of them. */
+ path { fill: #061932; }
+ @media (prefers-color-scheme: dark) { path { fill: #fcfaf7; } }
+ </style>
+ <path d="m67.1952 155.931c-7.4439 0-14.8975-.251-22.3268.078-6.8002.3-10.7399-2.546-13.0437-8.906-3.0928-8.528-6.9744-16.77-10.1107-25.289-1.3939-3.785-3.5138-5.14-7.3568-4.714-2.0279.223-4.172.174-6.17094-.223-5.04809-.997-8.077907-4.036-8.18438672-9.37-.09679938-4.937 3.56706672-9.0747 8.86198672-9.3796 5.97254-.3485 11.99344-.2662 17.97564-.0242 4.2592.1694 7.2019 2.4198 8.833 6.5918 3.6106 9.225 7.6132 18.295 11.127 27.554 1.2875 3.388 2.9331 4.826 6.7082 4.719 9.2976-.271 18.6097-.295 27.9025.015 3.8332.126 5.3481-1.399 6.6162-4.743 3.4315-9.071 7.1825-18.02 10.9674-26.949 2.6422-6.2295 7.2742-8.5091 12.6802-6.5731 5.557 1.9891 7.691 6.6311 5.228 13.1501-4.889 12.928-10.082 25.744-15.329 38.531-1.679 4.095-5.3186 5.532-9.5681 5.537-8.2716.015-16.5382 0-24.8097 0z"/><path d="m57.4414 74.7414c0-9.1815 0-18.3629 0-27.5395 0-4.961-.1065-9.922.0242-14.8781.1694-6.3307 4.8012-11.2239 10.1833-10.9819 5.4691.2468 9.3847 4.6463 9.4282 10.9335.0823 12.1919.0242 24.3838.0242 36.5709v7.5649c4.1769-3.9833 7.3858-6.9599 10.4979-10.0333 4.748-4.6899 10.8803-5.3385 14.8638-1.4907 4.269 4.1236 4.152 9.6799-.77 14.7038-8.8182 8.9976-17.7286 17.9031-26.8181 26.625-5.1158 4.908-10.1107 4.695-15.2797-.358-8.8572-8.6639-17.6272-17.4146-26.3246-26.2331-5.0626-5.1352-5.3143-10.4011-.9922-14.5974 4.1139-3.9978 10.0139-3.6348 14.8103 1.2875 2.9669 3.0443 5.4837 6.5339 8.2037 9.8251.7163-.4646 1.4278-.9244 2.1441-1.389z"/><path d="m66.9811 223.999c-11.2965-.6-21.5718-4.187-30.1772-12.013-4.4528-4.051-5.1498-9.752-1.6747-13.731 3.0637-3.509 9.2444-3.683 13.4745-.377 13.1502 10.28 24.5677 10.323 37.2339.145 4.7577-3.824 10.2946-3.737 13.8568.213 3.3446 3.707 2.6086 9.748-1.5827 13.774-8.6538 8.315-19.2921 11.428-31.1258 11.984z"/><path d="m46.1606 165.786c6.05.01 10.7302 4.545 10.677 10.343-.0484 5.542-5.2078 10.416-10.89 10.285-5.4062-.121-10.2655-4.908-10.3623-10.193-.1065-5.818 4.5883-10.449 10.5753-10.44z"/><path d="m99.2824 176.157c-.0484 5.44-4.8255 10.183-10.343 10.265-5.8419.087-10.6722-4.714-10.5947-10.532.0822-6.137 4.5689-10.309 10.856-10.096 5.7935.199 10.1349 4.656 10.0865 10.367z"/>
+</svg>
diff --git a/packages/dashboard-ui/src/spree/language-menu-items.tsx b/packages/dashboard-ui/src/spree/language-menu-items.tsx
index e9d51d4dbb..67dfdebf0b 100644
--- a/packages/dashboard-ui/src/spree/language-menu-items.tsx
+++ b/packages/dashboard-ui/src/spree/language-menu-items.tsx
@@ -1,10 +1,4 @@
-import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react'
-import {
- DropdownMenuItem,
- DropdownMenuSub,
- DropdownMenuSubContent,
- DropdownMenuSubTrigger,
-} from '../ui/dropdown-menu'
+import { ChevronsUpDownIcon } from 'lucide-react'
interface LanguageMenuItemsProps {
/** Translated "Language" label for the row (passed by the app). */
@@ -18,9 +12,14 @@ interface LanguageMenuItemsProps {
/**
* Admin UI language picker rendered inside the user dropdown's Preferences
- * section. The row shows a select-style pill with the current language; opening
- * it reveals the full list as a nested submenu (kept within the menu system so
- * it stays robust inside the dropdown's portal tree).
+ * section, as a native `<select>`.
+ *
+ * Native rather than the design system's `Select`: a menu nested inside a menu
+ * is awkward to drive with a pointer and stacks two portal layers, while the
+ * platform control opens as its own popup outside the dropdown entirely — and
+ * gives long locale lists native scrolling and type-ahead for free. The
+ * `<select>` is transparent and overlaid on the styled pill, so the row still
+ * matches the Theme row above it.
*
* Headless: the label, locale list, and change handler are passed in, so this
* component imports no i18n/data runtime. Renders nothing when fewer than two
@@ -32,26 +31,31 @@ export function LanguageMenuItems({ label, locales, value, onSelect }: LanguageM
const current = locales.find((l) => l.code === value)
return (
- <DropdownMenuSub>
- <DropdownMenuSubTrigger hideChevron className="justify-between">
- <span className="text-sm text-foreground">{label}</span>
- <span className="ml-auto inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 text-xs font-normal text-foreground">
+ // Not a DropdownMenuItem: the row is a container for the select, and menu
+ // items steal the pointer and close the menu on click.
+ <div className="flex items-center justify-between gap-2 rounded-lg px-2 py-1.5">
+ <span className="text-sm text-foreground">{label}</span>
+ {/* The select is transparent and stretched over the pill, so the hit area
+ tracks the pill's width whatever the locale name is. `focus-within`
+ carries the focus ring, since `opacity-0` hides the native one. */}
+ <span className="relative inline-flex rounded-lg focus-within:ring-2 focus-within:ring-ring">
+ <span className="pointer-events-none inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 text-xs font-normal text-foreground">
{current?.name ?? value}
<ChevronsUpDownIcon className="size-3 text-muted-foreground" />
</span>
- </DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
- {locales.map((locale) => (
- <DropdownMenuItem
- key={locale.code}
- closeOnClick={false}
- onClick={() => onSelect(locale.code)}
- >
- {locale.name}
- {value === locale.code && <CheckIcon className="ml-auto size-3.5" />}
- </DropdownMenuItem>
- ))}
- </DropdownMenuSubContent>
- </DropdownMenuSub>
+ <select
+ aria-label={label}
+ value={value}
+ onChange={(event) => onSelect(event.target.value)}
+ className="absolute inset-0 h-full w-full cursor-pointer opacity-0"
+ >
+ {locales.map((locale) => (
+ <option key={locale.code} value={locale.code}>
+ {locale.name}
+ </option>
+ ))}
+ </select>
+ </span>
+ </div>
)
}
diff --git a/packages/dashboard-ui/src/styles.css b/packages/dashboard-ui/src/styles.css
index d51cbf1a65..53e6a11617 100644
--- a/packages/dashboard-ui/src/styles.css
+++ b/packages/dashboard-ui/src/styles.css
@@ -29,43 +29,66 @@
Adapted from spree/admin Tailwind design system to match look & feel.
============================================================================ */
+/* Brand palette, taken from spreecommerce.org.
+ *
+ * The marketing site is built on a warm sand neutral ramp (hue ~80) rather
+ * than a pure greyscale, with a single blue accent. Neutrals below carry a
+ * small amount of chroma on that hue so surfaces, borders and text read as
+ * one family; the accent is the only saturated colour in the palette.
+ *
+ * Primary CTAs stay near-black rather than adopting the site's blue button:
+ * in a dense admin UI the blue has to stay meaningful as a selection and
+ * focus signal, which it stops being once every page renders a saturated
+ * blue button. */
:root {
- /* Vercel/Geist-style neutral palette — pure greyscale. */
- --background: oklch(0.985 0 0); /* #fafafa — gray-50 */
- --foreground: oklch(0.145 0 0); /* near-black */
- --card: oklch(1 0 0);
- --card-foreground: oklch(0.145 0 0);
+ --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 */
+
+ --background: oklch(0.9858 0.0045 78.3); /* #fcfaf7 — site page background */
+ --foreground: oklch(0.2136 0.0555 255.9); /* #061932 — site body text */
+ --card: oklch(1 0 0); /* white cards, as on the site */
+ --card-foreground: oklch(0.2136 0.0555 255.9);
--popover: oklch(1 0 0);
- --popover-foreground: oklch(0.145 0 0);
- --primary: oklch(0 0 0); /* pure black for primary CTAs */
+ --popover-foreground: oklch(0.2136 0.0555 255.9);
+ --primary: oklch(0.2136 0.0555 255.9); /* near-black navy for primary CTAs */
--primary-foreground: oklch(1 0 0);
- --secondary: oklch(0.97 0 0); /* #f5f5f5 — gray-100 */
- --secondary-foreground: oklch(0.205 0 0);
- --muted: oklch(0.985 0 0); /* #fafafa — gray-50 */
- --muted-foreground: oklch(0.4685 0 0); /* #737373 — Vercel #666 */
- --accent: oklch(0.97 0 0); /* #f5f5f5 */
- --accent-foreground: oklch(0.205 0 0);
+ /* Halfway from the site's #f7f5f2 to white — filled surfaces (table headers,
+ badges, secondary buttons) read as a whisper against the card rather than
+ a distinct band. */
+ --secondary: oklch(0.9854 0.0022 78.3);
+ --secondary-foreground: oklch(0.2136 0.0555 255.9);
+ --muted: oklch(0.9854 0.0022 78.3);
+ --muted-foreground: oklch(0.5232 0.0122 76.5); /* warm mid-grey on the same ramp */
+ /* Hover/highlight for menu items and table rows. Deliberately a lighter step
+ than the site's #e9e5dd: these sit on white surfaces, where that value is
+ a ~8% drop in lightness and reads as a pressed state rather than a hover.
+ The sidebar keeps the stronger tone via --sidebar-accent, since it sits on
+ the sand sidebar rather than on white. */
+ --accent: oklch(0.965 0.006 84.6);
+ --accent-foreground: oklch(0.2136 0.0555 255.9);
--destructive: oklch(0.58 0.22 27); /* red-600 */
--destructive-foreground: oklch(1 0 0); /* #ffffff */
- --border: oklch(0.928 0 0); /* #eaeaea — Vercel border */
- --input: oklch(0.928 0 0);
- --ring: oklch(0.546 0.245 262.881); /* blue-500 focus ring (UNCHANGED) */
- --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);
- --chart-4: oklch(0.488 0.243 264.376);
- --chart-5: oklch(0.424 0.199 265.638);
+ /* A quarter of the way from the site's #e2dfd8 to white — rules stay legible
+ but recede, so a dense table reads as rows of content rather than a grid. */
+ --border: oklch(0.928 0.0075 87.5);
+ --input: oklch(0.928 0.0075 87.5);
+ --ring: var(--brand-blue);
+ --chart-1: oklch(0.7663 0.1067 254.4);
+ --chart-2: oklch(0.5967 0.2212 258); /* brand blue */
+ --chart-3: oklch(0.5106 0.1868 257.7);
+ --chart-4: oklch(0.4232 0.1524 257.4);
+ --chart-5: oklch(0.3358 0.118 257.1);
--radius: 0.75rem;
- /* Sidebar — slightly muted off-white surface. */
- --sidebar: oklch(0.985 0 0); /* #fafafa */
- --sidebar-foreground: oklch(0.145 0 0);
- --sidebar-primary: oklch(0 0 0);
+ /* Sidebar — the site's raised warm surface, one step off the page. */
+ --sidebar: oklch(0.9858 0.0045 78.3); /* #fcfaf7 — site page background */
+ --sidebar-foreground: oklch(0.2136 0.0555 255.9);
+ --sidebar-primary: oklch(0.2136 0.0555 255.9);
--sidebar-primary-foreground: oklch(1 0 0);
- --sidebar-accent: oklch(0.945 0 0); /* slightly darker than sidebar bg for hover */
- --sidebar-accent-foreground: oklch(0.145 0 0);
- --sidebar-border: oklch(0.928 0 0);
- --sidebar-ring: oklch(0.546 0.245 262.881); /* blue-500 focus ring (UNCHANGED) */
+ --sidebar-accent: oklch(0.965 0.006 84.6);
+ --sidebar-accent-foreground: oklch(0.2136 0.0555 255.9);
+ --sidebar-border: oklch(0.928 0.0075 87.5);
+ --sidebar-ring: var(--brand-blue);
}
.dark {
@@ -76,13 +99,20 @@
--card-foreground: oklch(0.95 0 0);
--popover: oklch(0.145 0 0);
--popover-foreground: oklch(0.95 0 0);
- --primary: oklch(0.95 0 0); /* light-on-dark primary */
- --primary-foreground: oklch(0 0 0);
- --secondary: oklch(0.205 0 0); /* #1a1a1a */
+ /* Mirrors the light theme's primary: there a navy fill carries white text,
+ so here the two swap rather than the button taking on its own colour. */
+ --primary: oklch(0.95 0 0);
+ --primary-foreground: oklch(0.2136 0.0555 255.9); /* #061932 — light theme's primary */
+ /* Above --card, but only just. These fill elements that sit *on* a card
+ (combobox chips, badges, secondary buttons, table header rows), so a value
+ at or under the card's lightness erases them — while too big a step reads
+ as a bright band across a full-width table header. Dark mode raises where
+ light mode lowers, since a surface reads as raised by getting lighter. */
+ --secondary: oklch(0.225 0 0);
--secondary-foreground: oklch(0.95 0 0);
- --muted: oklch(0.18 0 0); /* #161616 */
+ --muted: oklch(0.185 0 0);
--muted-foreground: oklch(0.62 0 0); /* #888 */
- --accent: oklch(0.27 0 0); /* hover surface */
+ --accent: oklch(0.225 0 0); /* hover surface, a step above --muted */
--accent-foreground: oklch(0.95 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 12%);
@@ -96,7 +126,7 @@
--sidebar: oklch(0.145 0 0); /* #0a0a0a — slightly elevated from background */
--sidebar-foreground: oklch(0.95 0 0);
--sidebar-primary: oklch(0.95 0 0);
- --sidebar-primary-foreground: oklch(0 0 0);
+ --sidebar-primary-foreground: oklch(0.2136 0.0555 255.9);
--sidebar-accent: oklch(0.27 0 0);
--sidebar-accent-foreground: oklch(0.95 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
@@ -175,6 +205,16 @@
--color-warning: var(--color-yellow-500);
--color-info: var(--color-sky-500);
--color-danger: var(--color-rose-500);
+
+ /* Re-point Tailwind's blue ramp at the brand accent. Interactive blue is
+ used throughout the component layer for focus borders, checked states and
+ selected calendar days (`border-blue-500`, `bg-blue-500/15`, …); mapping
+ the palette entry keeps every one of those on the site's accent without
+ each component having to know the token name. Only the interactive steps
+ are overridden — the rest of the ramp keeps Tailwind's values for
+ incidental use such as charts and illustrations. */
+ --color-blue-500: var(--brand-blue);
+ --color-blue-600: var(--brand-blue-strong);
}
@utility focus-ring {
@@ -264,8 +304,8 @@
@layer base {
:root {
- --scrollbar-thumb: oklch(0.7 0 0); /* gray-400-ish */
- --scrollbar-thumb-hover: oklch(0.55 0 0);
+ --scrollbar-thumb: oklch(0.78 0.012 84.6); /* warm sand, sits on the brand ramp */
+ --scrollbar-thumb-hover: oklch(0.62 0.014 84.6);
}
.dark {
--scrollbar-thumb: oklch(0.35 0 0); /* zinc-700-ish */
diff --git a/packages/dashboard-ui/src/ui/button.tsx b/packages/dashboard-ui/src/ui/button.tsx
index fc7a73064e..407fdcffcc 100644
--- a/packages/dashboard-ui/src/ui/button.tsx
+++ b/packages/dashboard-ui/src/ui/button.tsx
@@ -4,12 +4,11 @@ import { cn } from '../lib/utils'
import { Slot } from './slot'
const buttonVariants = cva(
- "group/button inline-flex shrink-0 items-center justify-center gap-2 rounded-xl border border-transparent text-sm font-medium whitespace-nowrap cursor-pointer select-none no-underline transition-[color,background-color,border-color,box-shadow,transform,translate,scale] duration-100 ease-out outline-none active:scale-[0.98] motion-reduce:active:scale-100 focus-visible:border-blue-500 focus-visible:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] disabled:pointer-events-none disabled:opacity-70 disabled:cursor-not-allowed aria-invalid:border-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "group/button inline-flex shrink-0 items-center justify-center gap-2 rounded-xl border border-transparent text-sm font-medium whitespace-nowrap cursor-pointer select-none no-underline transition-[color,background-color,border-color,box-shadow,transform,translate,scale] duration-100 ease-out outline-none active:scale-[0.98] motion-reduce:active:scale-100 focus-visible:border-blue-500 focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:opacity-70 disabled:cursor-not-allowed aria-invalid:border-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
{
variants: {
variant: {
- default:
- 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/85 dark:bg-blue-600 dark:text-white dark:hover:bg-blue-500',
+ default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/85',
outline:
'border-border bg-muted text-foreground shadow-xs hover:bg-accent hover:text-foreground aria-expanded:bg-accent',
ghost: 'hover:bg-accent hover:text-accent-foreground aria-expanded:bg-accent',
diff --git a/packages/dashboard-ui/src/ui/combobox.tsx b/packages/dashboard-ui/src/ui/combobox.tsx
index db15311f5e..506287063c 100644
--- a/packages/dashboard-ui/src/ui/combobox.tsx
+++ b/packages/dashboard-ui/src/ui/combobox.tsx
@@ -209,7 +209,7 @@ function ComboboxChips({
// resize lets the positioner follow the anchor smoothly; making it
// instant jumps the open popup out from under the pointer, so the next
// option click lands on nothing.
- 'flex flex-wrap items-center gap-1 rounded-lg border border-border bg-card text-foreground shadow-xs px-2.5 py-1.5 text-base transition-all duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] has-aria-invalid:border-destructive has-data-[slot=combobox-chip]:px-1',
+ 'flex flex-wrap items-center gap-1 rounded-lg border border-border bg-card text-foreground shadow-xs px-2.5 py-1.5 text-base transition-all duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-aria-invalid:border-destructive has-data-[slot=combobox-chip]:px-1',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/data-table.tsx b/packages/dashboard-ui/src/ui/data-table.tsx
index 33d67f4838..deeb4236c8 100644
--- a/packages/dashboard-ui/src/ui/data-table.tsx
+++ b/packages/dashboard-ui/src/ui/data-table.tsx
@@ -1,14 +1,177 @@
-import type { ReactNode } from 'react'
+import {
+ Children,
+ cloneElement,
+ isValidElement,
+ type ReactElement,
+ type ReactNode,
+ useEffect,
+ useLayoutEffect,
+ useRef,
+} from 'react'
import { cn } from '../lib/utils'
-function Table({ className, ...props }: React.ComponentProps<'table'>) {
+interface TableProps extends React.ComponentProps<'table'> {
+ /**
+ * Pins the header below the app bar while the page scrolls, and lets the
+ * table scroll horizontally so many columns keep readable widths instead of
+ * squeezing until cells wrap. Opt-in: it assumes the table is the page's
+ * main content — inside cards, sheets or dialogs, keep the default.
+ */
+ stickyHeader?: boolean
+}
+
+/**
+ * The sticky variant renders two tables. CSS can't deliver this with one:
+ * `overflow-x` on a wrapper computes `overflow-y` to `auto` as well, so a
+ * sticky header inside the horizontal scroller can only pin to that box —
+ * which would mean capping its height and scrolling the body inside the card.
+ *
+ * So the header is rendered twice from the same React element:
+ *
+ * - A pinned table above the scroller carries the *interactive* header. It is
+ * live React — sort controls, the select-all checkbox and the bulk actions
+ * bar all work — pinned via a zero-height sticky wrapper so it overlays the
+ * space the body's header row reserves rather than stacking above it.
+ * - The body table keeps an `invisible` copy as a sizer: it reserves that row,
+ * drives natural column widths, and being `visibility: hidden` is out of the
+ * click path, the tab order and the accessibility tree.
+ *
+ * A layout-effect measurement copies the sizer's column widths onto the pinned
+ * header's cells (same content → same natural widths, so this only nails down
+ * rounding), and a scroll listener mirrors the body's `scrollLeft` onto the
+ * pinned table so the header tracks horizontal scrolling.
+ */
+function Table({ className, children, stickyHeader = false, ...props }: TableProps) {
+ const scrollRef = useRef<HTMLDivElement | null>(null)
+ const bodyTableRef = useRef<HTMLTableElement | null>(null)
+ const pinnedTableRef = useRef<HTMLTableElement | null>(null)
+
+ const kids = Children.toArray(children)
+ const headerElement = kids.find(
+ (kid): kid is ReactElement<React.ComponentProps<'thead'>> =>
+ isValidElement(kid) && kid.type === TableHeader,
+ )
+ const pinned = stickyHeader && headerElement != null
+
+ // Copy the sizer's column widths onto the pinned header on every commit —
+ // column toggles, data loads and label changes all land here. Written to the
+ // DOM directly rather than through state: a state round-trip re-renders,
+ // re-measures, and on tables whose widths don't settle to the exact same
+ // fraction each pass (the drag-reorder variant), that loop never terminates.
+ // DOM writes can't re-enter React, so oscillation is impossible by
+ // construction.
+ useLayoutEffect(() => {
+ if (pinned) syncColumnWidths(bodyTableRef.current, pinnedTableRef.current)
+ })
+
+ // Viewport-driven resizes don't pass through React, so track them directly.
+ useEffect(() => {
+ if (!pinned) return
+ const table = bodyTableRef.current
+ if (!table) return
+ const observer = new ResizeObserver(() => syncColumnWidths(table, pinnedTableRef.current))
+ observer.observe(table)
+ return () => observer.disconnect()
+ }, [pinned])
+
+ // Mirror the body's horizontal scroll onto the pinned header. Imperative —
+ // going through state would re-render the whole table every scroll frame.
+ useEffect(() => {
+ if (!pinned) return
+ const scroller = scrollRef.current
+ if (!scroller) return
+ const sync = () => {
+ const pinnedTable = pinnedTableRef.current
+ if (pinnedTable) pinnedTable.style.transform = `translate3d(${-scroller.scrollLeft}px,0,0)`
+ }
+ sync()
+ scroller.addEventListener('scroll', sync, { passive: true })
+ return () => scroller.removeEventListener('scroll', sync)
+ }, [pinned])
+
+ if (!pinned) {
+ return (
+ // `overflow-x: auto` computes `overflow-y` to `auto` as well, which makes
+ // this a scroll container and traps a sticky <thead> inside it — the
+ // header would scroll away with the page. `clip` leaves `overflow-y:
+ // visible`, so sticky resolves against the page instead. Narrow viewports
+ // keep `auto`, where scrolling a wide table sideways matters more than a
+ // sticky header.
+ <div className="overflow-x-auto md:overflow-x-clip">
+ <table className={cn('w-full align-top text-foreground', className)} {...props}>
+ {children}
+ </table>
+ </div>
+ )
+ }
+
+ // `w-max` + `min-w-full`: size to the content, but never narrower than the
+ // card, so a table with few columns still fills the width.
+ const tableClasses = cn('w-max min-w-full align-top text-foreground', className)
+
return (
- <div className="overflow-x-auto">
- <table className={cn('w-full align-top text-foreground', className)} {...props} />
+ <div className="relative">
+ {/* Zero-height sticky wrapper: the pinned header overlays the sizer row
+ below instead of occupying its own band. The inner div clips the
+ horizontal overhang the translateX mirror produces. */}
+ <div className="sticky top-header-height z-20 h-0">
+ <div className="overflow-hidden">
+ {/* `presentation`: this table exists to paint a header that stays put
+ and to host its controls. Announcing it as a second table — one
+ with column headers but no rows — would just duplicate the header
+ names the real table below already provides. The controls inside
+ keep their own roles and stay reachable. */}
+ <table ref={pinnedTableRef} className={tableClasses} role="presentation">
+ {headerElement}
+ </table>
+ </div>
+ </div>
+ <div ref={scrollRef} className="themed-scrollbar overflow-x-auto">
+ <table ref={bodyTableRef} className={tableClasses} {...props}>
+ {cloneElement(headerElement, {
+ // The sizer: reserves the header row and drives column widths. It
+ // stays in the accessibility tree, because this is the table that
+ // holds the data rows — hiding it outright would leave every cell
+ // with no column header to resolve against. So hide what it draws
+ // rather than the row itself, one concern per utility:
+ // `[&_th]:text-transparent` — the labels, which are bare text on
+ // the cells, so this has to out-specify the colour `TableHead`
+ // sets there.
+ // `[&_th>*]:invisible` — any control in a cell, which also drops
+ // it from hit-testing and the tab order.
+ // `[&>tr]:!static` — the sticky positioning the header row
+ // carries for the plain table, which here would lift this row
+ // out of flow and let the first data row slide up under the
+ // pinned copy.
+ className: cn(
+ headerElement.props.className,
+ 'select-none [&>tr]:!static [&_th]:text-transparent [&_th>*]:invisible',
+ ),
+ })}
+ {kids.filter((kid) => kid !== headerElement)}
+ </table>
+ </div>
</div>
)
}
+function syncColumnWidths(
+ bodyTable: HTMLTableElement | null,
+ pinnedTable: HTMLTableElement | null,
+) {
+ if (!bodyTable || !pinnedTable) return
+ const inFlowCells = (table: HTMLTableElement) =>
+ Array.from(table.querySelectorAll<HTMLElement>('thead tr:first-child > th')).filter(
+ // Out-of-flow cells (overlays) don't form columns.
+ (cell) => getComputedStyle(cell).position !== 'absolute',
+ )
+ const sizerCells = inFlowCells(bodyTable)
+ const pinnedCells = inFlowCells(pinnedTable)
+ for (let i = 0; i < Math.min(sizerCells.length, pinnedCells.length); i++) {
+ pinnedCells[i].style.width = `${sizerCells[i].getBoundingClientRect().width}px`
+ }
+}
+
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
return <thead className={cn('align-bottom', className)} {...props} />
}
@@ -23,11 +186,18 @@ function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
)
}
+/**
+ * The bottom rule is an inset shadow rather than `border-b` so it stays flush
+ * with the bulk action bar, which overlays this row and draws the same shadow.
+ * Don't add a border alongside it — a border sits outside the padding box and
+ * the shadow inside, so the two stack into a 2px line.
+ */
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
return (
<th
className={cn(
- 'text-left text-sm font-medium text-muted-foreground bg-muted/50 p-2 border-b border-border whitespace-nowrap first:pl-4 last:pr-4',
+ 'text-left text-sm font-medium text-muted-foreground bg-muted p-2 whitespace-nowrap first:pl-4 last:pr-4',
+ 'shadow-[inset_0_-1px_0_0_var(--color-border)]',
className,
)}
{...props}
@@ -35,6 +205,22 @@ function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
)
}
+/**
+ * Header row. `relative` because the bulk action bar positions against it: a
+ * cell can't serve as that anchor, since absolute children of a table cell are
+ * clipped to the cell's own width.
+ *
+ * The `md:sticky` matters only for the plain (non-`stickyHeader`) table, whose
+ * wrapper clips instead of scrolling, so the row pins to the page. Inside the
+ * sticky variant neither copy has a vertically scrolling ancestor, so it
+ * behaves as `relative` there.
+ */
+function TableHeaderRow({ className, ...props }: React.ComponentProps<'tr'>) {
+ return (
+ <tr className={cn('relative md:sticky md:top-header-height md:z-20', className)} {...props} />
+ )
+}
+
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
return (
<td
@@ -57,4 +243,4 @@ function TableEmpty({ children, colSpan }: { children: ReactNode; colSpan: numbe
)
}
-export { Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableRow }
+export { Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableHeaderRow, TableRow }
diff --git a/packages/dashboard-ui/src/ui/dialog.tsx b/packages/dashboard-ui/src/ui/dialog.tsx
index 9ebc90389b..48f1b4aa21 100644
--- a/packages/dashboard-ui/src/ui/dialog.tsx
+++ b/packages/dashboard-ui/src/ui/dialog.tsx
@@ -83,7 +83,7 @@ function DialogOverlay({
<DialogPrimitive.Backdrop
data-slot="dialog-overlay"
className={cn(
- 'fixed inset-0 isolate z-50 bg-gray-100/75 dark:bg-black/60 duration-100 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 transition-opacity',
+ 'fixed inset-0 isolate z-50 bg-accent/75 dark:bg-black/60 duration-100 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 transition-opacity',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/dropdown-menu.tsx b/packages/dashboard-ui/src/ui/dropdown-menu.tsx
index d02730cd39..cf0ad441e9 100644
--- a/packages/dashboard-ui/src/ui/dropdown-menu.tsx
+++ b/packages/dashboard-ui/src/ui/dropdown-menu.tsx
@@ -119,7 +119,7 @@ function DropdownMenuItem({
data-variant={variant}
render={children}
className={cn(
- "group/dropdown-menu-item relative flex cursor-default items-center gap-3 rounded-xl px-2.5 py-2 text-sm outline-hidden select-none transition-colors duration-75 focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "group/dropdown-menu-item relative flex cursor-default items-center gap-3 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none transition-colors duration-75 focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
@@ -133,7 +133,7 @@ function DropdownMenuItem({
data-inset={inset}
data-variant={variant}
className={cn(
- "group/dropdown-menu-item relative flex cursor-default items-center gap-3 rounded-xl px-2.5 py-2 text-sm outline-hidden select-none transition-colors duration-75 focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "group/dropdown-menu-item relative flex cursor-default items-center gap-3 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none transition-colors duration-75 focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
@@ -199,7 +199,7 @@ function DropdownMenuRadioItem({
data-slot="dropdown-menu-radio-item"
data-inset={inset}
className={cn(
- "relative flex cursor-default items-center gap-3 rounded-xl py-2 pr-8 pl-2.5 text-sm outline-hidden select-none transition-colors duration-75 focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "relative flex cursor-default items-center gap-3 rounded-xl py-1.5 pr-8 pl-2.5 text-sm outline-hidden select-none transition-colors duration-75 focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
@@ -230,7 +230,7 @@ function DropdownMenuLabel({
data-slot="dropdown-menu-label"
data-inset={inset}
className={cn(
- 'px-2.5 py-2 text-sm font-normal text-muted-foreground data-inset:pl-7',
+ 'px-2 py-1.5 text-sm font-normal text-muted-foreground data-inset:pl-7',
className,
)}
{...props}
@@ -294,7 +294,7 @@ function DropdownMenuSubTrigger({
data-slot="dropdown-menu-sub-trigger"
data-inset={inset}
className={cn(
- "flex cursor-default items-center gap-3 rounded-xl px-2.5 py-2 text-sm outline-hidden select-none transition-colors duration-75 focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "flex cursor-default items-center gap-3 rounded-xl px-2 py-1.5 text-sm outline-hidden select-none transition-colors duration-75 focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/input-group.tsx b/packages/dashboard-ui/src/ui/input-group.tsx
index cd29758e93..d48d594f34 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 shadow-xs 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_rgba(59,130,246,0.15)] 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 shadow-xs 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',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/input.tsx b/packages/dashboard-ui/src/ui/input.tsx
index 668cc1410f..14e6c00f81 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 shadow-xs 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_rgba(59,130,246,0.15)] 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 shadow-xs 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',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/pagination.tsx b/packages/dashboard-ui/src/ui/pagination.tsx
index ca489e1d4b..6f155fcf68 100644
--- a/packages/dashboard-ui/src/ui/pagination.tsx
+++ b/packages/dashboard-ui/src/ui/pagination.tsx
@@ -37,7 +37,7 @@ export function Pagination({
if (meta.pages <= 1 && !onPageSizeChange) return null
return (
- <div className="flex items-center justify-between border-t border-border px-4 py-3">
+ <div className="flex items-center justify-between border-t border-border px-3 py-2.5">
<div className="text-sm text-muted-foreground">
{t('admin.components.pagination.range', {
from: meta.from,
diff --git a/packages/dashboard-ui/src/ui/rich-text-editor.tsx b/packages/dashboard-ui/src/ui/rich-text-editor.tsx
index b0e95516c7..da807c30f8 100644
--- a/packages/dashboard-ui/src/ui/rich-text-editor.tsx
+++ b/packages/dashboard-ui/src/ui/rich-text-editor.tsx
@@ -139,7 +139,7 @@ export function RichTextEditor({
<div
ref={wrapperRef}
className={cn(
- 'rounded-lg border border-border bg-card text-foreground shadow-xs transition-[color,background-color,border-color,box-shadow] duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_rgba(59,130,246,0.15)]',
+ 'rounded-lg border border-border bg-card text-foreground shadow-xs transition-[color,background-color,border-color,box-shadow] duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]',
disabled && 'pointer-events-none bg-muted border-border',
className,
)}
diff --git a/packages/dashboard-ui/src/ui/select.tsx b/packages/dashboard-ui/src/ui/select.tsx
index 4cd5726202..f49eed100c 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 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 shadow-xs transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] 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 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 shadow-xs 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",
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/sheet.tsx b/packages/dashboard-ui/src/ui/sheet.tsx
index df09609324..4fe5e34928 100644
--- a/packages/dashboard-ui/src/ui/sheet.tsx
+++ b/packages/dashboard-ui/src/ui/sheet.tsx
@@ -94,7 +94,7 @@ function SheetOverlay({
<SheetPrimitive.Backdrop
data-slot="sheet-overlay"
className={cn(
- 'fixed inset-0 z-50 bg-gray-100/75 dark:bg-black/60 duration-200 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 transition-opacity',
+ 'fixed inset-0 z-50 bg-accent/75 dark:bg-black/60 duration-200 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 transition-opacity',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/sidebar.tsx b/packages/dashboard-ui/src/ui/sidebar.tsx
index 6bec79fad5..0ddf12e846 100644
--- a/packages/dashboard-ui/src/ui/sidebar.tsx
+++ b/packages/dashboard-ui/src/ui/sidebar.tsx
@@ -315,7 +315,11 @@ function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
<main
data-slot="sidebar-inset"
className={cn(
- 'relative z-0 flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',
+ // `min-w-0`: `w-full` sets the flex basis to the wrapper's full width,
+ // and a flex item's default `min-width: auto` then refuses to shrink
+ // below it — so beside the collapsed icon rail the inset stays a full
+ // viewport wide and its content runs off the right edge.
+ 'relative z-0 flex w-full min-w-0 flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',
className,
)}
{...props}
@@ -413,7 +417,7 @@ function SidebarGroupLabel({
data-slot="sidebar-group-label"
data-sidebar="group-label"
className={cn(
- 'flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] [&>svg]:size-4 [&>svg]:shrink-0',
+ 'flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] [&>svg]:size-4 [&>svg]:shrink-0',
className,
)}
{...props}
@@ -433,7 +437,7 @@ function SidebarGroupAction({
data-slot="sidebar-group-action"
data-sidebar="group-action"
className={cn(
- 'absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0',
+ 'absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0',
className,
)}
{...props}
@@ -483,7 +487,7 @@ const sidebarMenuButtonVariants = cva(
// badge. Without it the flex line wraps and the label visibly squashes to two
// lines inside the fixed height until the animation lands. Labels clip
// instead — which is what the `truncate` below already intends.
- 'peer/menu-button group/menu-button flex gap-2 w-full items-center overflow-hidden whitespace-nowrap rounded-xl p-1 text-left text-base text-sidebar-foreground/80 outline-hidden transition-colors duration-100 ease-out group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-10! group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:overflow-visible group-data-[collapsible=icon]:p-0! group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:[&>span:last-child]:hidden hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-foreground data-active:bg-sidebar-accent data-active:text-foreground data-active:font-semibold [&>span:last-child]:truncate',
+ 'peer/menu-button group/menu-button flex gap-2 w-full items-center overflow-hidden whitespace-nowrap rounded-xl p-1 text-left text-base text-sidebar-foreground/80 outline-hidden transition-colors duration-100 ease-out group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-10! group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:overflow-visible group-data-[collapsible=icon]:p-0! group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:[&>span:last-child]:hidden hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-foreground data-active:bg-sidebar-accent data-active:text-foreground data-active:font-semibold [&>span:last-child]:truncate',
{
variants: {
variant: {
@@ -570,7 +574,7 @@ function SidebarMenuAction({
data-slot="sidebar-menu-action"
data-sidebar="menu-action"
className={cn(
- 'absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0',
+ 'absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0',
showOnHover &&
'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0',
className,
@@ -672,7 +676,7 @@ function SidebarMenuSubButton({
data-size={size}
data-active={isActive}
className={cn(
- 'relative flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-xl p-1 text-sidebar-foreground/80 outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:shadow-[0_0_0_3px_rgba(59,130,246,0.15)] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-base data-[size=sm]:text-xs data-active:font-semibold data-active:text-foreground data-active:bg-transparent data-active:shadow-none data-active:before:absolute data-active:before:-left-4 data-active:before:top-[10%] data-active:before:h-[80%] data-active:before:w-[3px] data-active:before:rounded-sm data-active:before:bg-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
+ 'relative flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-xl p-1 text-sidebar-foreground/80 outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-base data-[size=sm]:text-xs data-active:font-semibold data-active:text-foreground data-active:bg-transparent data-active:shadow-none data-active:before:absolute data-active:before:-left-4 data-active:before:top-[10%] data-active:before:h-[80%] data-active:before:w-[3px] data-active:before:rounded-sm data-active:before:bg-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/textarea.tsx b/packages/dashboard-ui/src/ui/textarea.tsx
index eb8e9a0764..51f89f5072 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 shadow-xs 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_rgba(59,130,246,0.15)] 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 shadow-xs 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',
className,
)}
{...props}
diff --git a/packages/dashboard/e2e/profile.spec.ts b/packages/dashboard/e2e/profile.spec.ts
index 9143dd429f..878b3f8810 100644
--- a/packages/dashboard/e2e/profile.spec.ts
+++ b/packages/dashboard/e2e/profile.spec.ts
@@ -86,21 +86,26 @@ test.describe('profile', () => {
test('switches the language from the top-bar menu and persists it', async ({ page }) => {
await login(page)
- // Switch to Polish via the top-bar user menu → Language submenu. The
- // submenu trigger's accessible name is "Language <current>", so match by
- // prefix and hover to open the nested content.
+ // Switch to Polish via the top-bar user menu. The picker is a native
+ // <select> labelled "Language", so pick the option by its visible name.
await page.getByRole('button', { name: /user menu/i }).click()
- await page.getByRole('menuitem', { name: /^language/i }).hover()
- await page.getByRole('menuitem', { name: /polski/i }).click()
+ await page.getByRole('combobox', { name: /^language$/i }).selectOption({ label: 'Polski' })
- // The switch persists to the account (PATCH /me) so it survives the reload
- // instead of being reverted by the auth provider. Nav renders in Polish.
await expect(page.getByRole('link', { name: /produkty/i })).toBeVisible({ timeout: 15_000 })
- // Reset to English via the top-bar menu (the submenu is now "Język …").
+ // The switch is saved to the account (PATCH /me), so it has to survive a
+ // reload rather than be reverted by the auth provider. Reloading is also
+ // what proves the save landed: nothing else here waits on that request.
+ await page.reload()
+ await expect(page.getByRole('link', { name: /produkty/i })).toBeVisible({ timeout: 15_000 })
+
+ // Reset to English via the top-bar menu (the picker is now "Język"), and
+ // confirm that save landed too — later specs in this serial run expect
+ // English, and this user is shared across them.
await page.getByRole('button', { name: /menu użytkownika/i }).click()
- await page.getByRole('menuitem', { name: /^język/i }).hover()
- await page.getByRole('menuitem', { name: /english/i }).click()
+ await page.getByRole('combobox', { name: /^język$/i }).selectOption({ label: 'English' })
+ await expect(page.getByRole('link', { name: /^products$/i })).toBeVisible({ timeout: 15_000 })
+ await page.reload()
await expect(page.getByRole('link', { name: /^products$/i })).toBeVisible({ timeout: 15_000 })
})
})
diff --git a/packages/dashboard/index.html b/packages/dashboard/index.html
index dec13fbb57..efd6d3785a 100644
--- a/packages/dashboard/index.html
+++ b/packages/dashboard/index.html
@@ -3,6 +3,9 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<title>Spree Admin</title>
</head>
<body>
diff --git a/packages/dashboard/public/apple-touch-icon.png b/packages/dashboard/public/apple-touch-icon.png
new file mode 100644
index 0000000000..f0d223ec7d
Binary files /dev/null and b/packages/dashboard/public/apple-touch-icon.png differ
diff --git a/packages/dashboard/public/favicon-32x32.png b/packages/dashboard/public/favicon-32x32.png
new file mode 100644
index 0000000000..17270e998d
Binary files /dev/null and b/packages/dashboard/public/favicon-32x32.png differ
diff --git a/packages/dashboard/public/favicon.svg b/packages/dashboard/public/favicon.svg
new file mode 100644
index 0000000000..3aee087a3f
--- /dev/null
+++ b/packages/dashboard/public/favicon.svg
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50.5 13 220 220">
+ <style>
+ /* Tabs render on light or dark chrome; a single fixed colour disappears
+ against one of them. */
+ path { fill: #061932; }
+ @media (prefers-color-scheme: dark) { path { fill: #fcfaf7; } }
+ </style>
+ <path d="m67.1952 155.931c-7.4439 0-14.8975-.251-22.3268.078-6.8002.3-10.7399-2.546-13.0437-8.906-3.0928-8.528-6.9744-16.77-10.1107-25.289-1.3939-3.785-3.5138-5.14-7.3568-4.714-2.0279.223-4.172.174-6.17094-.223-5.04809-.997-8.077907-4.036-8.18438672-9.37-.09679938-4.937 3.56706672-9.0747 8.86198672-9.3796 5.97254-.3485 11.99344-.2662 17.97564-.0242 4.2592.1694 7.2019 2.4198 8.833 6.5918 3.6106 9.225 7.6132 18.295 11.127 27.554 1.2875 3.388 2.9331 4.826 6.7082 4.719 9.2976-.271 18.6097-.295 27.9025.015 3.8332.126 5.3481-1.399 6.6162-4.743 3.4315-9.071 7.1825-18.02 10.9674-26.949 2.6422-6.2295 7.2742-8.5091 12.6802-6.5731 5.557 1.9891 7.691 6.6311 5.228 13.1501-4.889 12.928-10.082 25.744-15.329 38.531-1.679 4.095-5.3186 5.532-9.5681 5.537-8.2716.015-16.5382 0-24.8097 0z"/><path d="m57.4414 74.7414c0-9.1815 0-18.3629 0-27.5395 0-4.961-.1065-9.922.0242-14.8781.1694-6.3307 4.8012-11.2239 10.1833-10.9819 5.4691.2468 9.3847 4.6463 9.4282 10.9335.0823 12.1919.0242 24.3838.0242 36.5709v7.5649c4.1769-3.9833 7.3858-6.9599 10.4979-10.0333 4.748-4.6899 10.8803-5.3385 14.8638-1.4907 4.269 4.1236 4.152 9.6799-.77 14.7038-8.8182 8.9976-17.7286 17.9031-26.8181 26.625-5.1158 4.908-10.1107 4.695-15.2797-.358-8.8572-8.6639-17.6272-17.4146-26.3246-26.2331-5.0626-5.1352-5.3143-10.4011-.9922-14.5974 4.1139-3.9978 10.0139-3.6348 14.8103 1.2875 2.9669 3.0443 5.4837 6.5339 8.2037 9.8251.7163-.4646 1.4278-.9244 2.1441-1.389z"/><path d="m66.9811 223.999c-11.2965-.6-21.5718-4.187-30.1772-12.013-4.4528-4.051-5.1498-9.752-1.6747-13.731 3.0637-3.509 9.2444-3.683 13.4745-.377 13.1502 10.28 24.5677 10.323 37.2339.145 4.7577-3.824 10.2946-3.737 13.8568.213 3.3446 3.707 2.6086 9.748-1.5827 13.774-8.6538 8.315-19.2921 11.428-31.1258 11.984z"/><path d="m46.1606 165.786c6.05.01 10.7302 4.545 10.677 10.343-.0484 5.542-5.2078 10.416-10.89 10.285-5.4062-.121-10.2655-4.908-10.3623-10.193-.1065-5.818 4.5883-10.449 10.5753-10.44z"/><path d="m99.2824 176.157c-.0484 5.44-4.8255 10.183-10.343 10.265-5.8419.087-10.6722-4.714-10.5947-10.532.0822-6.137 4.5689-10.309 10.856-10.096 5.7935.199 10.1349 4.656 10.0865 10.367z"/>
+</svg>
diff --git a/packages/dashboard/src/assets/login_sidebar_background.png b/packages/dashboard/src/assets/login_sidebar_background.png
index de3e6a7d6a..af823cac70 100644
Binary files a/packages/dashboard/src/assets/login_sidebar_background.png and b/packages/dashboard/src/assets/login_sidebar_background.png differ
diff --git a/packages/dashboard/src/assets/login_sidebar_background_dark.png b/packages/dashboard/src/assets/login_sidebar_background_dark.png
new file mode 100644
index 0000000000..f8d140e5c6
Binary files /dev/null and b/packages/dashboard/src/assets/login_sidebar_background_dark.png differ
diff --git a/packages/dashboard/src/components/spree/auth-shell.tsx b/packages/dashboard/src/components/spree/auth-shell.tsx
index d0ca74040c..6230ca1b89 100644
--- a/packages/dashboard/src/components/spree/auth-shell.tsx
+++ b/packages/dashboard/src/components/spree/auth-shell.tsx
@@ -1,5 +1,7 @@
+import { useTheme } from '@spree/dashboard-ui'
import type { ReactNode } from 'react'
import loginSidebarBackground from '../../assets/login_sidebar_background.png'
+import loginSidebarBackgroundDark from '../../assets/login_sidebar_background_dark.png'
/**
* Two-column layout shared by the unauthenticated auth pages (login,
@@ -8,16 +10,20 @@ import loginSidebarBackground from '../../assets/login_sidebar_background.png'
* (hidden below the `lg` breakpoint).
*/
export function AuthShell({ children }: { children: ReactNode }) {
+ // `resolved` rather than a CSS `prefers-color-scheme` swap, so the artwork
+ // follows an explicit theme choice too — not just the OS setting.
+ const { resolved } = useTheme()
+
return (
<div className="grid min-h-svh lg:grid-cols-2">
- <div className="flex flex-col gap-6 bg-muted p-6 md:p-10">
+ <div className="flex flex-col gap-6 bg-background p-6 md:p-10">
<div className="flex flex-1 items-center justify-center">
<div className="flex w-full max-w-sm flex-col gap-6">{children}</div>
</div>
</div>
- <div className="relative hidden bg-muted lg:block border-l">
+ <div className="relative hidden bg-background lg:block border-l">
<img
- src={loginSidebarBackground}
+ src={resolved === 'dark' ? loginSidebarBackgroundDark : loginSidebarBackground}
alt=""
className="absolute inset-0 h-full w-full object-cover"
/>
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index f7dc864cd5..b854adf1ae 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -2321,6 +2321,7 @@
},
"inventory": {
"in_stock": "{{count}} في المخزون",
+ "in_stock_short": "في المخزون",
"on_backorder": "على المؤجل",
"out_of_stock": "إنتهى من المخزن"
},
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index c24c9c7a34..a7530b8f6b 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -2311,6 +2311,7 @@
},
"inventory": {
"in_stock": "{{count}} auf Lager",
+ "in_stock_short": "Auf Lager",
"on_backorder": "Im Rückstand",
"out_of_stock": "Nicht auf Lager"
},
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index bbd9ac5340..11e71b8a8f 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -2311,6 +2311,7 @@
},
"inventory": {
"in_stock": "{{count}} in stock",
+ "in_stock_short": "In stock",
"on_backorder": "On backorder",
"out_of_stock": "Out of stock"
},
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 1ae3d45c46..f9814bb721 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -2311,6 +2311,7 @@
},
"inventory": {
"in_stock": "{{count}} en stock",
+ "in_stock_short": "En stock",
"on_backorder": "En réapprovisionnement",
"out_of_stock": "En rupture de stock"
},
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index fd097f8739..e26862db66 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -2335,6 +2335,7 @@
},
"inventory": {
"in_stock": "{{count}} w magazynie",
+ "in_stock_short": "W magazynie",
"on_backorder": "Na zamówienie",
"out_of_stock": "Brak w magazynie"
},
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index 3b06d885f4..6f90e1922b 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -2307,6 +2307,7 @@
},
"inventory": {
"in_stock": "库存 {{count}} 件",
+ "in_stock_short": "有库存",
"on_backorder": "可延期交货",
"out_of_stock": "缺货"
},
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/getting-started.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/getting-started.tsx
index 765fcb9085..97b76d44ba 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/getting-started.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/getting-started.tsx
@@ -6,6 +6,8 @@ import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
+ Progress,
+ ProgressValue,
Skeleton,
} from '@spree/dashboard-ui'
import { createFileRoute, Link } from '@tanstack/react-router'
@@ -68,17 +70,16 @@ function GettingStartedPage() {
subtitle={t('admin.pages.getting_started.description')}
/>
- <div className="flex items-center gap-3">
- <div className="h-2 grow overflow-hidden rounded-full bg-muted">
- <div
- className="h-full rounded-full bg-primary transition-all"
- style={{ width: `${tasks.length ? (doneCount / tasks.length) * 100 : 0}%` }}
- />
- </div>
- <span className="shrink-0 text-sm text-muted-foreground">
- {t('admin.pages.getting_started.progress', { done: doneCount, total: tasks.length })}
- </span>
- </div>
+ {/* `flex-nowrap` overrides the component's default wrap: the caption is
+ short enough to sit beside the track at any width, and wrapping it
+ below leaves the bar looking orphaned. */}
+ <Progress value={doneCount} max={tasks.length || 1} className="flex-nowrap gap-3">
+ <ProgressValue className="order-last shrink-0">
+ {() =>
+ t('admin.pages.getting_started.progress', { done: doneCount, total: tasks.length })
+ }
+ </ProgressValue>
+ </Progress>
<div className="flex flex-col gap-4">
{tasks.map((task) => {
diff --git a/packages/dashboard/src/search/default.tsx b/packages/dashboard/src/search/default.tsx
index 5d0edfda67..bd8a39166d 100644
--- a/packages/dashboard/src/search/default.tsx
+++ b/packages/dashboard/src/search/default.tsx
@@ -1,6 +1,6 @@
import type { Category, Collection, Customer, Order, Product, Promotion } from '@spree/admin-sdk'
import { adminClient, defineSearchEntry, Subject, searchRegistry } from '@spree/dashboard-core'
-import { StatusBadge } from '@spree/dashboard-ui'
+import { cn, StatusBadge } from '@spree/dashboard-ui'
import {
FolderTreeIcon,
LayersIcon,
@@ -10,6 +10,7 @@ import {
UsersIcon,
} from 'lucide-react'
import type { ReactNode } from 'react'
+import { useTranslation } from 'react-i18next'
// Each entry teaches the command palette how to search one resource: how to
// fetch matches, render a result row, and where a row navigates. Resources are
@@ -26,11 +27,22 @@ searchRegistry.add(
fetch: (search, limit) => adminClient.products.list({ search, limit }).then((r) => r.data),
getKey: (p) => p.id,
getRoute: (p, storeId) => ({ to: `/${storeId}/products/${p.id}` }),
+ // Two lines, as a product row is rarely identifiable by name alone: near
+ // duplicates ("… 18V" / "… 25V") differ only in stock and price.
renderRow: (p) => (
<>
- <IconOrThumbnail thumbnailUrl={p.primary_media?.mini_url ?? null} icon={<TagIcon />} />
- <span className="flex-1 truncate">{p.name}</span>
- <StatusBadge status={p.status} />
+ <IconOrThumbnail
+ thumbnailUrl={p.primary_media?.mini_url ?? p.thumbnail_url ?? null}
+ icon={<TagIcon />}
+ size="lg"
+ />
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <span className="flex items-center gap-2">
+ <span className="truncate">{p.name}</span>
+ <StatusBadge status={p.status} />
+ </span>
+ <ProductMeta product={p} />
+ </span>
</>
),
}),
@@ -159,14 +171,47 @@ searchRegistry.add(
* glyph rather than an empty framed box, so a category or a page does not look
* like a product whose photo failed to load.
*/
-function IconOrThumbnail({ thumbnailUrl, icon }: { thumbnailUrl: string | null; icon: ReactNode }) {
- if (!thumbnailUrl) return icon
+function IconOrThumbnail({
+ thumbnailUrl,
+ icon,
+ size = 'sm',
+}: {
+ thumbnailUrl: string | null
+ icon: ReactNode
+ /** `lg` for the two-line product row, whose taller row a 20px image floats in. */
+ size?: 'sm' | 'lg'
+}) {
+ if (!thumbnailUrl) {
+ // Keep the icon on the first line rather than centred against two.
+ return size === 'lg' ? <span className="self-start pt-0.5">{icon}</span> : icon
+ }
return (
<img
src={thumbnailUrl}
alt=""
- className="size-5 shrink-0 rounded object-cover"
+ className={cn(
+ 'shrink-0 rounded object-cover',
+ size === 'lg' ? 'size-8 self-start' : 'size-5',
+ )}
loading="lazy"
/>
)
}
+
+/** Stock and price beneath a product's name — the pair that tells near-identical
+ * variants apart. Renders nothing when neither is known. */
+function ProductMeta({ product }: { product: Product }) {
+ const { t } = useTranslation()
+ const stock = product.in_stock
+ ? t('admin.pages.products.inventory.in_stock_short')
+ : product.backorderable
+ ? t('admin.pages.products.inventory.on_backorder')
+ : t('admin.pages.products.inventory.out_of_stock')
+ const price = product.price?.display_amount
+
+ return (
+ <span className="truncate text-muted-foreground text-xs">
+ {price ? `${stock} • ${price}` : stock}
+ </span>
+ )
+}
diff --git a/packages/dashboard/src/tables/products.tsx b/packages/dashboard/src/tables/products.tsx
index 2c5ddf586a..b83c6b6020 100644
--- a/packages/dashboard/src/tables/products.tsx
+++ b/packages/dashboard/src/tables/products.tsx
@@ -169,7 +169,6 @@ defineTable('products', {
// expands of visible columns into the list request.
expand: 'product_type',
default: false,
- className: 'text-sm text-muted-foreground',
render: (product) => product.product_type?.name ?? '—',
},
],