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.

Redesigned the dashboard app shell and design system (#14630)

Damian Legawiec2f3a597c88af
diff --git a/packages/dashboard-core/src/components/app-shell.tsx b/packages/dashboard-core/src/components/app-shell.tsx
new file mode 100644
index 0000000000..8408138623
--- /dev/null
+++ b/packages/dashboard-core/src/components/app-shell.tsx
@@ -0,0 +1,171 @@
+import { SidebarInset, SidebarProvider } from '@spree/dashboard-ui'
+import { useRouterState } from '@tanstack/react-router'
+import type { ReactNode } from 'react'
+import { useEffect, useRef, useState } from 'react'
+import { useAutoCollapseSidebar } from '../hooks/use-auto-collapse-sidebar'
+import { StickyHeaderProvider } from '../providers/sticky-header-provider'
+import { AppSidebar } from './app-sidebar'
+import { MobileTopBar } from './mobile-top-bar'
+import { SettingsNavSheet, SettingsSidebar } from './settings-sidebar'
+import { SheetTopBar } from './sheet-top-bar'
+import { SkipLink } from './skip-link'
+import { MobileBreadcrumbBar } from './top-bar-breadcrumbs'
+
+/**
+ * The frame every panel renders inside: the nav rail, and the page as a sheet
+ * beside it.
+ *
+ * There is no top bar. The rail carries what one used to — tenant switcher,
+ * search, account — so the only chrome above a page is the page's own header,
+ * and the content sits in an inset sheet rather than running to the window
+ * edge.
+ *
+ * Both panels mount this rather than composing the same pieces twice: the
+ * seller panel previously hand-rolled its own `<header>`, which had already
+ * drifted from the dashboard's (a different border, a translucent fill the
+ * dashboard had deliberately abandoned). One frame means one place to fix.
+ */
+export function AppShell({
+ tenantId,
+ sidebarHeader,
+ inSettings,
+ uiLocales,
+ onEditProfile,
+ children,
+}: {
+ /** Prefix for the nav links. Defaults to the route's `storeId`. */
+ tenantId?: string
+ /** Sidebar header — a store switcher by default, a seller switcher here. */
+ sidebarHeader?: ReactNode
+ /** True on a settings route, which brings its own secondary rail. */
+ inSettings: boolean
+ /** Admin UI languages for the account menu's language switcher. */
+ uiLocales?: ReadonlyArray<{ code: string; name: string }>
+ /** Opens the app's edit-profile dialog from the account menu. */
+ onEditProfile?: () => void
+ children: ReactNode
+}) {
+ // The settings area brings a full-width nav of its own, and two stacked
+ // columns leave the content squeezed, so the primary rail folds to icons
+ // while the user is in there.
+ useAutoCollapseSidebar(inSettings)
+
+ // Below `lg` the settings rail is hidden, so its sheet is the only way
+ // between two settings pages. The trigger lives in the breadcrumb bar.
+ const [settingsNavOpen, setSettingsNavOpen] = useState(false)
+
+ // Put focus on the scroll container after each navigation, so Page Up/Down,
+ // Home and End work on a freshly opened page without clicking into it first.
+ // Those keys act on the focused element, and the shell's scroller is the only
+ // thing that scrolls — left on <body>, they would have nothing to move.
+ //
+ // Skipped when focus is already inside the sheet: a route change that came
+ // from typing in a filter must not pull the caret out of the field.
+ const scrollerRef = useRef<HTMLDivElement | null>(null)
+ const pathname = useRouterState({ select: (state) => state.location.pathname })
+ useEffect(() => {
+ // Read so the dependency is a real one: this effect exists to run on every
+ // navigation, and `pathname` is what changes.
+ if (!pathname) return
+ const scroller = scrollerRef.current
+ if (!scroller) return
+ if (scroller.contains(document.activeElement)) return
+ scroller.focus({ preventScroll: true })
+ }, [pathname])
+
+ return (
+ <>
+ {/* First in the tab order by construction — it has to precede the
+ sidebar's thirty-odd links to be able to skip them. */}
+ <SkipLink />
+ <AppSidebar
+ tenantId={tenantId}
+ header={sidebarHeader}
+ uiLocales={uiLocales}
+ onEditProfile={onEditProfile}
+ />
+ {/* The sheet is exactly as tall as the viewport and scrolls internally,
+ rather than growing with the page and letting the document scroll.
+ Both of its rounded ends then stay on screen — with a document-length
+ sheet the bottom two corners sit below the fold and the shape reads as
+ a panel that has come unstuck. It also gives the page's sticky header
+ a scroll container of its own to pin inside, so it can never ride up
+ over the rail's switcher.
+
+ `flex-row` so the secondary sidebar sits flush against the primary and
+ spans the sheet's full height. */}
+ <SidebarInset className="min-h-0 flex-row overflow-hidden">
+ <SettingsSidebar open={inSettings} tenantId={tenantId} />
+ {/* `tabIndex={-1}`: Page Up/Down, Home and End act on the focused
+ element, and this is the element that scrolls. Without it focus
+ stays on <body>, which has nothing to scroll now that the sheet
+ owns the overflow — so those keys did nothing at all. `-1` keeps it
+ out of the tab order while still letting a click or the skip link
+ put focus here. `outline-none` because it is a scroll container
+ rather than a control; the focus ring belongs to what is inside.
+
+ `themed-scrollbar` because this is the last scroll container still
+ on the browser default: the sheet owns the page's overflow, so its
+ bar is the one a merchant sees most, and a chrome-grey native bar
+ down the edge of the white sheet was the one piece of the frame
+ that did not belong to the design. Not the quiet variant the
+ settings nav uses — that one hides its thumb until hover, which
+ suits chrome but not the surface being read, where the thumb is
+ how you know where you are in a long list.
+
+ `me-[5px]` insets the bar from the sheet's right edge. An arbitrary
+ value rather than a scale step because the scale has no 5px rung —
+ `1.5` is 6px — and this is measured against the sheet's edge by eye,
+ so the exact figure is the point. A native
+ scrollbar is painted by the browser at the scroll container's own
+ border edge and no property can offset it, so the box itself has to
+ end short of the sheet — margin does that, where padding would not:
+ padding is inside the box, so the container would still end flush
+ with the sheet and only the content would move, leaving the bar
+ exactly where it was. Logical `me-` rather than `mr-` so the inset
+ follows the bar to the left edge under RTL. */}
+ <div
+ ref={scrollerRef}
+ tabIndex={-1}
+ className="themed-scrollbar flex min-w-0 flex-1 flex-col overflow-y-auto me-[5px] outline-none"
+ >
+ <MobileTopBar uiLocales={uiLocales} onEditProfile={onEditProfile} />
+ <SheetTopBar tenantId={tenantId} inSettings={inSettings} />
+ <MobileBreadcrumbBar
+ tenantId={tenantId}
+ onOpenSettingsNav={() => setSettingsNavOpen(true)}
+ />
+ <SettingsNavSheet
+ open={settingsNavOpen}
+ onOpenChange={setSettingsNavOpen}
+ tenantId={tenantId}
+ />
+ {/* Settings pages own their container so the secondary rail can sit
+ flush; everything else gets the shell's. */}
+ {inSettings ? (
+ children
+ ) : (
+ <div className="container mx-auto flex flex-1 flex-col gap-4 p-4 lg:p-6">
+ {children}
+ </div>
+ )}
+ </div>
+ </SidebarInset>
+ </>
+ )
+}
+
+/**
+ * `AppShell` under the sidebar provider it needs.
+ *
+ * Split so the shell itself can call `useAutoCollapseSidebar`, which only
+ * works inside the provider. `StickyHeaderProvider` rides along: it tracks
+ * whether a page has a `PageHeader`, which decides heading levels below it.
+ */
+export function AppShellProvider({ children }: { children: ReactNode }) {
+ return (
+ <StickyHeaderProvider>
+ <SidebarProvider>{children}</SidebarProvider>
+ </StickyHeaderProvider>
+ )
+}
diff --git a/packages/dashboard-core/src/components/app-sidebar.tsx b/packages/dashboard-core/src/components/app-sidebar.tsx
index 64c7dc9312..cb9d22e2de 100644
--- a/packages/dashboard-core/src/components/app-sidebar.tsx
+++ b/packages/dashboard-core/src/components/app-sidebar.tsx
@@ -1,11 +1,14 @@
import {
Sidebar,
SidebarContent,
+ SidebarFooter,
SidebarGroup,
SidebarHeader,
SidebarMenu,
SidebarMenuItem,
+ SidebarTrigger,
Skeleton,
+ useSidebar,
} from '@spree/dashboard-ui'
import { PackageIcon } from '@spree/dashboard-ui/icons'
import { useParams } from '@tanstack/react-router'
@@ -16,6 +19,8 @@ import { type NavEntry, resolveNavLabel, useNavEntries } from '../lib/nav-regist
import { type Permissions, usePermissions } from '../providers/permission-provider'
import { useOptionalStore } from '../providers/store-provider'
import { type NavItem, NavMain } from './nav-main'
+import { SidebarSearch } from './sidebar-search'
+import { SidebarUser } from './sidebar-user'
import { StoreSwitcher } from './store-switcher'
/**
@@ -98,10 +103,16 @@ export function useNavItems(tenantId: string): {
* both are props. Everything else (side-by-language, collapsible rail,
* permission filtering) is the same in either, and a panel that copied this to
* change the header would silently miss every later fix to the rest.
+ *
+ * The rail carries the whole of the app's chrome: the tenant switcher and
+ * search above the nav, the account menu at its foot. There is no top bar —
+ * the page's own header is the only thing above the content.
*/
export function AppSidebar({
tenantId,
header,
+ uiLocales,
+ onEditProfile,
...props
}: ComponentProps<typeof Sidebar> & {
/**
@@ -111,14 +122,31 @@ export function AppSidebar({
tenantId?: string
/** Rendered in the header. Defaults to the store switcher. */
header?: ReactNode
+ /** Admin UI languages offered by the account menu's language switcher. */
+ uiLocales?: ReadonlyArray<{ code: string; name: string }>
+ /** Opens the app's edit-profile dialog from the account menu. */
+ onEditProfile?: () => void
}) {
const { i18n } = useTranslation()
const { storeId } = useParams({ strict: false }) as { storeId?: string }
const { navItems, bottomItems, isLoading } = useNavItems(tenantId ?? storeId ?? 'default')
return (
- <Sidebar collapsible="icon" side={primarySidebarSide(i18n.language)} {...props}>
- <SidebarHeader>{header ?? <StoreSwitcher />}</SidebarHeader>
+ <Sidebar collapsible="icon" variant="inset" side={primarySidebarSide(i18n.language)} {...props}>
+ <SidebarHeader>
+ {/* The switcher, search and the account row are all hidden on a phone:
+ the top bar already names the store and carries both search and the
+ account menu, so repeating them inside the drawer spends rows of a
+ small screen saying what is visible behind it. The drawer is for
+ navigating. */}
+ <div className="hidden items-center gap-1 md:flex">
+ <div className="min-w-0 flex-1">{header ?? <StoreSwitcher />}</div>
+ <CollapseTrigger />
+ </div>
+ <div className="hidden md:block">
+ <SidebarSearch />
+ </div>
+ </SidebarHeader>
<SidebarContent>
{/* Permissions decide which links exist, and until they arrive every
`can()` answers false — so the real nav is not "empty", it is not
@@ -131,6 +159,9 @@ export function AppSidebar({
list is never actually empty and a length check would never fire. */}
{isLoading ? <NavSkeleton /> : <NavMain items={navItems} bottomItems={bottomItems} />}
</SidebarContent>
+ <SidebarFooter className="hidden md:flex">
+ <SidebarUser uiLocales={uiLocales} onEditProfile={onEditProfile} />
+ </SidebarFooter>
</Sidebar>
)
}
@@ -160,3 +191,21 @@ function NavSkeleton() {
</SidebarGroup>
)
}
+
+/**
+ * Collapses the rail to its icon width, beside the tenant switcher.
+ *
+ * It lives here because the rail is now the app's only chrome — the top bar
+ * that used to carry this control is gone, and without it the rail could be
+ * collapsed by keyboard alone. Hidden once collapsed: at icon width there is
+ * no room beside the avatar, and the rail's own edge handle (`SidebarRail`)
+ * expands it again.
+ */
+function CollapseTrigger() {
+ const { isMobile, state } = useSidebar()
+ if (isMobile || state === 'collapsed') return null
+
+ return (
+ <SidebarTrigger className="shrink-0 text-muted-foreground hover:bg-sidebar-accent hover:text-foreground" />
+ )
+}
diff --git a/packages/dashboard-core/src/components/currency-select.tsx b/packages/dashboard-core/src/components/currency-select.tsx
index 3bd350f842..bb4ab14f47 100644
--- a/packages/dashboard-core/src/components/currency-select.tsx
+++ b/packages/dashboard-core/src/components/currency-select.tsx
@@ -30,6 +30,10 @@ export const ALL_CURRENCY_CODES: string[] = (() => {
})()
interface CurrencySelectProps {
+ /** Classes for the trigger — used to match a neighbouring control's height. */
+ triggerClassName?: string
+ /** `sm` matches the toolbar controls beside it — see `SelectTrigger`. */
+ triggerSize?: 'sm' | 'default'
/** ID for the trigger — paired with the parent `<FieldLabel htmlFor>`. */
id?: string
/** Submit name — a hidden input mirrors the value so plain `FormData` works. */
@@ -87,6 +91,8 @@ export function CurrencySelect({
searchPlaceholder,
invalid,
onBlur,
+ triggerClassName,
+ triggerSize,
}: CurrencySelectProps) {
const { t } = useTranslation()
// Optional: the operator's dashboard always has a store, the seller panel
@@ -154,6 +160,8 @@ export function CurrencySelect({
>
<ComboboxButtonTrigger
id={id}
+ size={triggerSize}
+ className={triggerClassName}
onBlur={onBlur}
disabled={disabled}
aria-required={required}
diff --git a/packages/dashboard-core/src/components/file-upload-field.tsx b/packages/dashboard-core/src/components/file-upload-field.tsx
index b6f223c1a1..6c7e3cae63 100644
--- a/packages/dashboard-core/src/components/file-upload-field.tsx
+++ b/packages/dashboard-core/src/components/file-upload-field.tsx
@@ -213,7 +213,7 @@ export function FileUploadField({
Enter/Space; the label paints a focus ring via has-[:focus-visible]. */}
<label
className={cn(
- 'flex cursor-pointer flex-col items-center justify-center gap-2 rounded-md border border-border border-dashed bg-muted/40 px-4 py-8 text-center transition-colors hover:bg-accent/50',
+ 'flex cursor-pointer flex-col items-center justify-center gap-2 rounded-md border border-border border-dashed px-4 py-8 text-center transition-colors hover:bg-accent/50',
'has-[:focus-visible]:border-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50',
(disabled || !!pending) && 'pointer-events-none opacity-60',
)}
diff --git a/packages/dashboard-core/src/components/media-picker-sheet.tsx b/packages/dashboard-core/src/components/media-picker-sheet.tsx
index 892297424c..949f666583 100644
--- a/packages/dashboard-core/src/components/media-picker-sheet.tsx
+++ b/packages/dashboard-core/src/components/media-picker-sheet.tsx
@@ -183,7 +183,7 @@ export function MediaPickerSheet<T extends MediaPickerOption>({
<SheetDescription>{description ?? t('admin.media_picker.description')}</SheetDescription>
</SheetHeader>
- <div className="flex items-center gap-2 border-b border-border p-4">
+ <div className="flex items-center gap-2 border-b border-border-subtle p-4">
<SearchInput
value={input}
onValueChange={setInput}
diff --git a/packages/dashboard-core/src/components/mobile-top-bar.tsx b/packages/dashboard-core/src/components/mobile-top-bar.tsx
new file mode 100644
index 0000000000..b3d03cca2e
--- /dev/null
+++ b/packages/dashboard-core/src/components/mobile-top-bar.tsx
@@ -0,0 +1,75 @@
+import { SidebarTrigger, Skeleton } from '@spree/dashboard-ui'
+import { SearchIcon } from '@spree/dashboard-ui/icons'
+import { useTranslation } from 'react-i18next'
+import { useOptionalCommandPalette } from '../hooks/use-command-palette'
+import { useOptionalStore } from '../providers/store-provider'
+import { SidebarUser } from './sidebar-user'
+
+/**
+ * The bar a phone gets in place of the nav rail.
+ *
+ * On a narrow screen the rail is an off-canvas drawer, so something on the
+ * page has to open it — and after the shell moved the account menu and the
+ * search box into the rail, that trigger is the only way to reach either of
+ * them. Without this bar the drawer has no opener at all and the nav is
+ * simply unreachable, which is why it renders unconditionally rather than
+ * only where a breadcrumb trail exists.
+ *
+ * Deliberately thin: the trigger, the store it belongs to, and search. Page
+ * titles and actions stay with `PageHeader` below, so this never becomes a
+ * second place to look for them.
+ */
+export function MobileTopBar({
+ uiLocales = [],
+ onEditProfile,
+ title,
+}: {
+ uiLocales?: ReadonlyArray<{ code: string; name: string }>
+ onEditProfile?: () => void
+ /** Name shown beside the controls. Defaults to the store's, for panels that have one. */
+ title?: string
+} = {}) {
+ const { t } = useTranslation()
+ // `useOptionalStore` rather than `useStore`: the seller panel mounts this
+ // under a `TenantProvider` with no store at all, and a hard `useStore`
+ // throws there — taking every seller page down at phone width. A panel
+ // without a store passes its own `title` instead.
+ const storeContext = useOptionalStore()
+ // Absent in panels that mount no palette (the seller panel), where the
+ // search button would open nothing.
+ const palette = useOptionalCommandPalette()
+
+ const label = title ?? storeContext?.store?.name
+ // Only a store-backed panel has a name still loading; one that passes its
+ // own title has nothing to wait for.
+ const isLoading = title === undefined && (storeContext?.isLoading ?? false)
+
+ return (
+ // `h-14` (56px) is the phone top-bar height on Android, and comfortably
+ // clears the 44pt iOS navigation bar; the controls inside are `size-11`
+ // (44px), the touch target both platforms ask for and the size this
+ // codebase already uses for mobile controls in the table toolbar.
+ <div className="sticky top-0 z-30 flex h-14 shrink-0 items-center gap-1 border-b border-border bg-card px-2 md:hidden">
+ <SidebarTrigger className="size-11 shrink-0 text-muted-foreground hover:bg-accent hover:text-foreground" />
+
+ {isLoading ? (
+ <Skeleton className="h-4 w-28" />
+ ) : (
+ <span className="min-w-0 flex-1 truncate font-medium text-sm">{label}</span>
+ )}
+
+ {palette && (
+ <button
+ type="button"
+ onClick={() => palette.setOpen(true)}
+ aria-label={t('admin.components.command_palette.search_label')}
+ className="inline-flex size-11 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors duration-100 hover:bg-accent hover:text-foreground"
+ >
+ <SearchIcon className="size-5" />
+ </button>
+ )}
+
+ <SidebarUser variant="bar" uiLocales={uiLocales} onEditProfile={onEditProfile} />
+ </div>
+ )
+}
diff --git a/packages/dashboard-core/src/components/page-header.tsx b/packages/dashboard-core/src/components/page-header.tsx
index ca9427ffad..876d1d15e7 100644
--- a/packages/dashboard-core/src/components/page-header.tsx
+++ b/packages/dashboard-core/src/components/page-header.tsx
@@ -6,6 +6,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
+ ExternalLink,
useConfirm,
useCopyToClipboard,
useScrolled,
@@ -20,7 +21,8 @@ import {
import type { JsonPreviewDrawerProps } from '@spree/dashboard-ui/spree/json-preview-drawer'
import { lazy, type ReactNode, Suspense, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { useRegisterPageHeader } from '../providers/sticky-header-provider'
+import { docsUrl } from '../lib/docs'
+import { useRegisterPageHeader, useStickyHeaderOffset } from '../providers/sticky-header-provider'
import { Slot } from './slot'
// JSON drawer is a developer-only feature; pulling its tree (which includes
@@ -53,8 +55,34 @@ export interface PageHeaderResource {
interface PageHeaderProps {
/** Main title, on its own line. */
title: ReactNode
+ /**
+ * Whether the header pins to the top of the scroll container. Default true,
+ * which is right for a detail page: the title and its Save button have to
+ * stay reachable down a long form.
+ *
+ * A list page passes `false`. There the table's own column row is the band
+ * worth pinning — it is what a reader needs while scrolling rows — and two
+ * stacked sticky bands spend a third of a short viewport on chrome. Turning
+ * this off also stops the header publishing a sticky offset, so the column
+ * row pins to the top of the sheet rather than below a header that is no
+ * longer there.
+ */
+ sticky?: boolean
/** Small text beside the badges (updated_at badge, customer email, etc.). */
subtitle?: ReactNode
+ /**
+ * One line under the title saying what the page is for. Unlike `subtitle`,
+ * which shares the badge row and answers "where is this now", this explains
+ * the feature itself — worth writing for something a merchant meets for the
+ * first time (catalogs, price lists, transfers) and worth leaving off a page
+ * that explains itself.
+ */
+ description?: ReactNode
+ /**
+ * Documentation for the feature, linked at the end of the description.
+ * Relative to the user guide, or a full URL for a plugin's own docs.
+ */
+ docsPath?: string
/** Back button target — passed to <BackButton fallback="..."/>. Omit for top-level pages. */
backTo?: string
/** Status badges, on the line under the title. Use <StatusBadge />. */
@@ -119,7 +147,10 @@ interface PageHeaderProps {
*/
export function PageHeader({
title,
+ sticky = true,
subtitle,
+ description,
+ docsPath,
backTo,
badges,
actions,
@@ -148,24 +179,26 @@ export function PageHeader({
setJsonOpen(true)
}
const scrolled = useScrolled()
- // Tells the TopBar there's a header here to take over the top of the
- // viewport, so it may slide away once the user scrolls, and reports when
- // that hand-over is happening.
- const collapsed = useRegisterPageHeader()
+ // Publishes this header's measured height as the sticky offset every other
+ // pinned band reads (`top-header-height`): the table's pinned column row,
+ // the bulk-action bar. There is no top bar any more, so this header IS the
+ // chrome above the scroll area — and its height genuinely varies with
+ // badges, a subtitle and wrapped actions, which a fixed constant could only
+ // approximate. Measured rather than assumed, so those bands sit flush
+ // against it at every size.
+ const headerRef = useStickyHeaderOffset(sticky)
+ // Announces this header so the page's other headings pick the right level —
+ // a table below one renders its title as `h2` rather than a second `h1`.
+ useRegisterPageHeader()
return (
- // This parks at `top-header-height`, directly below the TopBar, so the
- // title, badges, and primary actions (notably Save on form pages) stay
- // reachable as the user scrolls long detail pages.
- //
- // On scroll the TopBar retreats and this header rises to take its place.
- // That rise is a `translateY`, not a change of `top`: `top` is a layout
- // property with no transition, so animating it would teleport this header
- // 58px while the TopBar slid, visibly breaking the pair apart. Both now
- // move by the same distance, over the same duration and curve, off one
- // shared scroll flag.
+ // Pins at the very top of the viewport — with the top bar gone, the title,
+ // badges and primary actions (notably Save on form pages) are the only
+ // chrome that needs to stay reachable down a long page.
//
- // `bg-background` masks the content scrolling behind it;
+ // `bg-card` masks the content scrolling behind it — the same surface as
+ // the content sheet this sits in, so the pinned band is invisible at rest
+ // rather than a stripe of the page ground across the top of a white sheet;
// `-mx-4 px-4 lg:-mx-6 lg:px-6` and `-mt-4 lg:-mt-6 pt-4 lg:pt-6` undo
// and re-apply the parent padding so the sticky band runs edge-to-edge.
//
@@ -176,6 +209,7 @@ export function PageHeader({
// collide with the page edges; the `border-border` color it carries is
// the same hairline used elsewhere in the app.
<header
+ ref={headerRef}
className={cn(
// One row at every width. The title truncates rather than wrapping,
// so it yields space to the actions instead of pushing them onto a
@@ -184,19 +218,11 @@ export function PageHeader({
// Opaque for the same reason as the top bar: this band pins over the
// page's own scrolling content, so a translucent fill lets that content
// ghost through it.
- 'sticky top-header-height z-20 -mx-4 -mt-4 flex flex-row items-start gap-2 bg-background px-4 pt-4 pb-3 sm:gap-3 lg:-mx-6 lg:-mt-6 lg:px-6 lg:pt-6',
- // `translate` is listed explicitly: Tailwind v4 compiles
- // `-translate-y-*` to the standalone `translate` property, so a
- // `transform`-only transition never animates it and the header would
- // jump to its raised position while the TopBar slid — the exact desync
- // this pairing exists to avoid.
- 'transition-[transform,translate,box-shadow] duration-200 ease-out',
- // Reduced motion: hold position rather than teleport. Suppressing only
- // the transition would leave the 58px jump this pairing exists to avoid.
- 'motion-reduce:transition-none motion-reduce:translate-y-0',
+ '-mx-4 -mt-4 flex flex-row items-start gap-2 bg-card p-4 sm:gap-3 lg:-mx-6 lg:-mt-6 lg:px-6 lg:pt-6',
+ sticky && 'sticky top-0 z-20',
+ 'transition-[box-shadow] duration-200 ease-out motion-reduce:transition-none',
'after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-border after:opacity-0 after:transition-opacity after:duration-200 after:[mask-image:linear-gradient(to_right,transparent,black_8%,black_92%,transparent)]',
- collapsed && '-translate-y-header-height',
- scrolled && 'after:opacity-100 shadow-xs',
+ sticky && scrolled && 'after:opacity-100 shadow-xs',
)}
>
{/* Row one: back button beside the title, so the arrow keeps its
@@ -211,7 +237,7 @@ export function PageHeader({
{/* Smaller and clipped on a phone: sharing the row with the actions
leaves a long product name too little width to wrap into
anything readable. */}
- <h1 className="min-w-0 truncate font-medium text-xl leading-tight sm:text-2xl sm:whitespace-normal">
+ <h1 className="min-w-0 truncate font-semibold text-xl leading-tight sm:text-2xl sm:whitespace-normal">
{title}
</h1>
{/* Statuses and the timestamp share the second line: both answer
@@ -228,6 +254,19 @@ export function PageHeader({
)}
</div>
)}
+ {description && (
+ <p className="text-muted-foreground text-sm">
+ {description}
+ {docsPath && (
+ <>
+ {' '}
+ <ExternalLink href={docsUrl(docsPath)}>
+ {t('admin.common.learn_more')}
+ </ExternalLink>
+ </>
+ )}
+ </p>
+ )}
</div>
</div>
diff --git a/packages/dashboard-core/src/components/resource-picker-sheet.tsx b/packages/dashboard-core/src/components/resource-picker-sheet.tsx
index 2b1a749dcb..205148f776 100644
--- a/packages/dashboard-core/src/components/resource-picker-sheet.tsx
+++ b/packages/dashboard-core/src/components/resource-picker-sheet.tsx
@@ -237,7 +237,7 @@ export function ResourcePickerSheet<T extends PickerOption>({
{description && <SheetDescription>{description}</SheetDescription>}
</SheetHeader>
- <div className="border-b border-border p-4">
+ <div className="border-b border-border-subtle p-4">
<SearchInput
value={input}
onValueChange={(value) => {
@@ -268,7 +268,7 @@ export function ResourcePickerSheet<T extends PickerOption>({
) : (
<>
{matchCount > 0 && (
- <div className="flex items-center justify-between gap-3 border-b border-border px-4 py-2">
+ <div className="flex items-center justify-between gap-3 border-b border-border-subtle px-4 py-2">
<button
type="button"
disabled={selectableOnPage.length === 0 || selectingAll}
diff --git a/packages/dashboard-core/src/components/resource-table.tsx b/packages/dashboard-core/src/components/resource-table.tsx
index ef89ca9e9d..f15b3d2e5b 100644
--- a/packages/dashboard-core/src/components/resource-table.tsx
+++ b/packages/dashboard-core/src/components/resource-table.tsx
@@ -17,7 +17,6 @@ import {
import { CSS } from '@dnd-kit/utilities'
import {
Card,
- CardContent,
Checkbox,
cn,
DragHandle,
@@ -68,9 +67,9 @@ import {
getTable,
type SortOption,
} from '../lib/table-registry'
-import { useStickyHeader } from '../providers/sticky-header-provider'
import { useTenantId } from '../providers/tenant-provider'
import { type BulkAction, BulkActionBar } from './bulk-action-bar'
+import { PageHeader } from './page-header'
import { TableToolbar } from './table-toolbar'
// ============================================================================
@@ -184,14 +183,16 @@ interface ResourceTableProps<T> {
/** Title displayed in the toolbar header. Overrides the table definition's title. */
title?: string
/**
- * Heading level for the title.
+ * Set when the PAGE already renders its own `PageHeader` and this table is a
+ * panel inside it, so the table renders no heading of its own.
*
- * Resolved automatically: `h1` when the table is the page (the admin's list
- * routes render nothing else), `h2` when a `PageHeader` is mounted and has
- * already claimed the `h1` — which is how the seller panel's list pages are
- * built. Set it explicitly only to override that.
+ * Declared rather than detected. The shell tracks how many headers are
+ * mounted, but during a route change the outgoing page's header has not
+ * unregistered by the time the incoming table first renders — so a table
+ * reading that count saw a header that was on its way out and silently
+ * dropped its own. Only the page knows this, and it knows it statically.
*/
- titleAs?: 'h1' | 'h2' | 'h3'
+ hideHeader?: boolean
/** One line under the title. Overrides the table definition's description. */
description?: string
/** Docs for the feature, linked after the description. Overrides the table definition's. */
@@ -256,7 +257,7 @@ export function ResourceTable<T extends Record<string, any>>({
queryFn,
searchParams,
title,
- titleAs,
+ hideHeader = false,
description,
docsPath,
defaultParams,
@@ -343,9 +344,14 @@ export function ResourceTable<T extends Record<string, any>>({
const sortString = dir === 'desc' ? `-${sort}` : sort
const tenantId = useTenantId()
- // A `PageHeader` on the same page already renders the `h1`, so the table's
- // title becomes an `h2` rather than a second one.
- const { hasPageHeader } = useStickyHeader()
+ // Whether the PAGE mounted a header of its own, in which case this table is
+ // a panel inside it and renders no heading.
+ //
+ // Latched from the first render, before this component's own `PageHeader`
+ // can register: the flag counts every mounted header, so reading it live
+ // would see the one rendered below, conclude the page already had one, and
+ // unmount it — which re-clears the flag and mounts it again, forever.
+ const pageOwnsHeader = hideHeader
// Auto-inject the tenant id so every list query — and the matching mutation
// invalidation — is tenant-scoped without each page re-implementing it.
// Goes through +withStoreScope+ so the slot ordering matches +useResourceKey+
@@ -537,10 +543,48 @@ export function ResourceTable<T extends Record<string, any>>({
// Below `sm` the table spans the full width: the page gutter plus the
// card's own border spends ~34px of a 390px screen on chrome, and a table
// is the one place that width is worth reclaiming. Negative margins cancel
- // the gutter the page container applies, and the frame drops to a plain
- // surface — background only, no border, radius or shadow. Scoped to this
- // card so every other card on the page keeps its frame.
- <Card className="-mx-4 rounded-none border-0 bg-transparent sm:bg-card sm:mx-0 sm:rounded-xl sm:border">
+ // The frame belongs to the ROWS, not to the screen. The toolbar sits above
+ // it and the pagination below it, both on the sheet itself — so the border
+ // encloses exactly the tabular data, and the controls that act on it read
+ // as chrome rather than as its first and last rows.
+ //
+ // Below `sm` the table loses its frame and spans the gutter the page
+ // container applies, so narrow screens spend no width on a box.
+ //
+ // No shadow at any width: the sheet under it is already a raised surface,
+ // so the table is a region drawn on it rather than a second card floating
+ // above one. Its hairline is `--border`, the same weight as the rules
+ // between its own rows, so the frame and its contents read as one table.
+ <div className="flex flex-col gap-3">
+ {/* The page's own header, not a title bar of the table's own: a list page
+ IS this table, so its title and actions are the page's. Rendering
+ `PageHeader` here rather than a parallel implementation means a list
+ page and a detail page share one heading — the same type, spacing,
+ sticky behaviour and action slot — and the `page.actions` slot a
+ plugin registers into reaches both.
+
+ Skipped via `hideHeader` when the page already mounts its own
+ `PageHeader` (a table embedded as a panel), which would otherwise
+ give the page two. */}
+ {!pageOwnsHeader && (
+ <PageHeader
+ // Not pinned: on a list page the table's own column row is the band
+ // worth keeping on screen, and stacking a sticky title above it
+ // spends a third of a short viewport on chrome.
+ sticky={false}
+ title={title ?? table.title}
+ description={description ?? table.description}
+ docsPath={docsPath ?? table.docsPath}
+ actions={resolvedActions}
+ />
+ )}
+ {/* A page that owns its header still passes `actions` here, and they
+ would otherwise vanish with the suppressed `PageHeader` — taking the
+ orders export and the policies Add button with them. Render them
+ above the toolbar so the control keeps a home either way. */}
+ {pageOwnsHeader && resolvedActions && (
+ <div className="flex flex-wrap items-center justify-end gap-2">{resolvedActions}</div>
+ )}
<TableToolbar
columns={displayableColumns}
visibleColumns={visibleColumnKeys}
@@ -553,14 +597,14 @@ export function ResourceTable<T extends Record<string, any>>({
filters={filters as FilterRule[]}
onFiltersChange={handleFiltersChange}
allColumns={allColumns}
- title={title ?? table.title}
- titleAs={titleAs ?? (hasPageHeader ? 'h2' : 'h1')}
- description={description ?? table.description}
- docsPath={docsPath ?? table.docsPath}
- actions={resolvedActions}
hideSort={reorderActive}
/>
- <CardContent className="p-0">
+ {/* `overflow-x-clip`, never `overflow-hidden`: the rows clip to the
+ rounded frame horizontally, but a `hidden` overflow on either axis
+ makes this a scroll container, and the pinned column row inside
+ would then stick to THIS box rather than to the page — which is to
+ say, scroll away with it. */}
+ <Card className="-mx-4 gap-0 overflow-x-clip rounded-none border-0 bg-transparent py-0 shadow-none sm:mx-0 sm:rounded-xl sm:border">
{reorderActive ? (
<DndContext
sensors={sensors}
@@ -571,7 +615,7 @@ export function ResourceTable<T extends Record<string, any>>({
items={rows.map((r) => (r as any).id)}
strategy={verticalListSortingStrategy}
>
- <Table stickyHeader>
+ <Table stickyHeader roundedTop roundedBottom>
<TableHeader>
<TableHeaderRow>
<TableHead className="w-8" />
@@ -691,7 +735,7 @@ export function ResourceTable<T extends Record<string, any>>({
</section>,
document.body,
)}
- <Table stickyHeader>
+ <Table stickyHeader roundedTop roundedBottom>
<TableHeader>
{/* Column headers stay mounted with rows selected, and the bulk
bar is laid over them. Swapping them for one `colSpan` cell
@@ -815,25 +859,23 @@ export function ResourceTable<T extends Record<string, any>>({
</Table>
</>
)}
- {/* Clears the fixed bottom bar so it can't cover the pagination or the
- last row while a selection is active. Carries the same safe-area
- inset the bar pads itself by, or the home indicator's worth of bar
- still overlaps the last row. */}
- {bulkActive && isMobile && (
- <div
- className="h-[calc(4rem+max(0px,env(safe-area-inset-bottom)-0.75rem))]"
- aria-hidden
- />
- )}
- {meta && (
- <Pagination
- meta={meta}
- onPageChange={(p) => updateSearch({ page: p })}
- onPageSizeChange={(size) => updateSearch({ limit: size, page: 1 })}
- />
- )}
- </CardContent>
- </Card>
+ </Card>
+ {meta && (
+ <Pagination
+ meta={meta}
+ onPageChange={(p) => updateSearch({ page: p })}
+ onPageSizeChange={(size) => updateSearch({ limit: size, page: 1 })}
+ />
+ )}
+ {/* Clears the fixed bottom bar so it can't cover the pagination or the
+ last row while a selection is active. Carries the same safe-area
+ inset the bar pads itself by, or the home indicator's worth of bar
+ still overlaps the last row. Sits after the pagination, which is now
+ the last thing the bar can cover. */}
+ {bulkActive && isMobile && (
+ <div className="h-[calc(4rem+max(0px,env(safe-area-inset-bottom)-0.75rem))]" aria-hidden />
+ )}
+ </div>
)
}
diff --git a/packages/dashboard-core/src/components/section-heading.tsx b/packages/dashboard-core/src/components/section-heading.tsx
index fca0f191de..4a2d733c3a 100644
--- a/packages/dashboard-core/src/components/section-heading.tsx
+++ b/packages/dashboard-core/src/components/section-heading.tsx
@@ -1,5 +1,4 @@
-import { CardTitle, cn } from '@spree/dashboard-ui'
-import { ExternalLinkIcon } from '@spree/dashboard-ui/icons'
+import { CardTitle, cn, ExternalLink } from '@spree/dashboard-ui'
import { useTranslation } from 'react-i18next'
import { docsUrl } from '../lib/docs'
@@ -55,15 +54,9 @@ export function SectionHeading({
{docsPath && (
<>
{' '}
- <a
- href={docsUrl(docsPath)}
- target="_blank"
- rel="noreferrer"
- className="inline-flex items-center gap-0.5 text-link hover:text-link-hover"
- >
+ <ExternalLink href={docsUrl(docsPath)} className="text-sm">
{t('admin.common.learn_more')}
- <ExternalLinkIcon className="size-3" />
- </a>
+ </ExternalLink>
</>
)}
</p>
diff --git a/packages/dashboard-core/src/components/settings-sidebar.tsx b/packages/dashboard-core/src/components/settings-sidebar.tsx
index 961f359001..86177ae8de 100644
--- a/packages/dashboard-core/src/components/settings-sidebar.tsx
+++ b/packages/dashboard-core/src/components/settings-sidebar.tsx
@@ -1,5 +1,4 @@
import {
- Badge,
cn,
mobileDrawerClassName,
SearchInput,
@@ -11,6 +10,7 @@ import {
SidebarGroup,
SidebarGroupLabel,
SidebarMenu,
+ SidebarMenuBadge,
SidebarMenuButton,
SidebarMenuItem,
} from '@spree/dashboard-ui'
@@ -30,8 +30,8 @@ import { NavIcon } from './nav-main'
/**
* Secondary settings sidebar. Always mounted as a sibling to the primary
- * sidebar so it can extend full-height (top of viewport to bottom, beside
- * the TopBar rather than below it). Width animates between `0` and
+ * sidebar so it can extend the full height of the content sheet. Width
+ * animates between `0` and
* `--spacing-sidebar-width` driven by the `open` prop, so entering and
* leaving the settings area gets a slide-in/slide-out transition.
*
@@ -59,18 +59,26 @@ export function SettingsSidebar({
const { t } = useTranslation()
const { storeId } = useParams({ strict: false }) as { storeId?: string }
- // `sticky top-0 h-svh` keeps the nav at full viewport height as the page
- // scrolls. `overflow-hidden` clips the inner fixed-width content while the
- // outer `width` animates between 0 and `--spacing-sidebar-width`. `aria-hidden`
- // while closed prevents screen-reader and keyboard access to hidden links.
+ // `h-full` fills the content sheet, which is itself exactly viewport-height
+ // and scrolls internally — so the nav stays put as the page scrolls without
+ // needing to be sticky. `overflow-hidden` clips the inner fixed-width content
+ // while the outer `width` animates between 0 and `--spacing-sidebar-width`.
+ // `aria-hidden` while closed prevents screen-reader and keyboard access to
+ // hidden links.
return (
<aside
aria-label={t('admin.a11y.settings_navigation')}
aria-hidden={!open}
data-state={open ? 'open' : 'closed'}
className={cn(
- 'sticky top-0 z-30 hidden h-svh shrink-0 self-start overflow-hidden bg-sidebar text-sidebar-foreground transition-[width,border-color] duration-200 ease-out lg:block',
- open ? 'lg:w-(--spacing-sidebar-width) border-e' : 'lg:w-0 border-e-0 border-transparent',
+ // `bg-card`, the content sheet's own colour: this rail is a column OF
+ // the sheet rather than an extension of the nav rail beside it, so it
+ // reads as part of the page it is navigating rather than as a second
+ // band of chrome.
+ 'z-30 hidden h-full shrink-0 overflow-hidden bg-muted text-sidebar-foreground transition-[width,border-color] duration-200 ease-out lg:block',
+ open
+ ? 'lg:w-(--spacing-sidebar-width) border-e border-border-subtle'
+ : 'lg:w-0 border-e-0 border-transparent',
)}
>
{/* `quiet-scrollbar` rather than the browser default: this nav is an
@@ -85,9 +93,9 @@ export function SettingsSidebar({
{/* Names the area and offers the way out. Without it this panel is
visually identical to the primary sidebar, so nothing says the
merchant has entered a different part of the app — and the only
- exit is the icon rail beside it. `h-header-height` matches the
+ exit is the icon rail beside it. `h-rail-header-height` matches the
store switcher opposite, so the two line up. */}
- <div className="flex h-header-height items-center gap-1 px-2">
+ <div className="flex h-rail-header-height items-center gap-1 px-2">
<Link
to={`/${tenantId ?? storeId}` as never}
tabIndex={open ? 0 : -1}
@@ -167,10 +175,10 @@ export function SettingsNavSheet({
className={cn(mobileDrawerClassName, 'gap-0')}
style={{ width: SIDEBAR_WIDTH_MOBILE }}
>
- {/* `h-header-height` matches the store header in the primary drawer, so
+ {/* `h-rail-header-height` matches the store header in the primary drawer, so
the two nav sheets open to the same silhouette — and it gives the
close button a full-height touch target rather than a 42px band. */}
- <SheetHeader className="h-header-height justify-center border-b border-sidebar-border px-4 py-0">
+ <SheetHeader className="h-rail-header-height justify-center border-b border-sidebar-border px-4 py-0">
{/* Held at the default body size rather than the larger sheet
title: this is a nav band matched to the store header, not a
dialog heading. */}
@@ -235,7 +243,7 @@ function SettingsNavBody({
aria-label={t('admin.settings_page.search_placeholder')}
clearLabel={t('admin.common.clear')}
tabIndex={tabIndex}
- className="h-8 bg-sidebar text-sm in-data-[mobile=true]:h-11 in-data-[mobile=true]:text-base"
+ className="h-8 text-sm in-data-[mobile=true]:h-11 in-data-[mobile=true]:text-base"
/>
</div>
@@ -291,11 +299,7 @@ function SettingsItem({
<Link to={url} tabIndex={tabIndex}>
<NavIcon icon={Icon} isActive={isActive} />
<span>{label}</span>
- {entry.comingSoon && (
- <Badge className="ms-auto h-5 bg-sidebar-accent px-1.5 py-0 text-[10px] font-normal text-sidebar-foreground/70">
- Soon
- </Badge>
- )}
+ {entry.comingSoon && <SidebarMenuBadge className="ms-auto">Soon</SidebarMenuBadge>}
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
diff --git a/packages/dashboard-core/src/components/sheet-top-bar.tsx b/packages/dashboard-core/src/components/sheet-top-bar.tsx
new file mode 100644
index 0000000000..463297de7d
--- /dev/null
+++ b/packages/dashboard-core/src/components/sheet-top-bar.tsx
@@ -0,0 +1,44 @@
+import { SidebarTrigger, useSidebar } from '@spree/dashboard-ui'
+import { TopBarBreadcrumbs } from './top-bar-breadcrumbs'
+
+/**
+ * The thin row at the top of the content sheet, shown only while the nav rail
+ * is collapsed: the trigger that brings the rail back, and the location trail.
+ *
+ * Both belong to the same moment. The trigger is here rather than in the rail
+ * because a collapsed rail has no room for it, and the control that restores
+ * the nav should not live inside the thing that is hidden. The trail answers
+ * the question the collapsed rail stops answering — where in the nav am I —
+ * so with the rail open, where the active item is already lit, it would only
+ * restate what is on screen and cost a row of chrome to do it.
+ *
+ * One condition for both, so the band appears and disappears as a unit rather
+ * than leaving a stray trail floating above the page.
+ */
+export function SheetTopBar({
+ tenantId,
+ inSettings = false,
+}: {
+ tenantId?: string
+ /**
+ * Hides the rail trigger. Inside settings the rail is collapsed by the app
+ * rather than by the merchant, and the settings rail beside it carries its
+ * own way out — so a control offering to re-expand a rail the area will just
+ * re-collapse would not do what it says. The trail still shows.
+ */
+ inSettings?: boolean
+}) {
+ const { isMobile, state } = useSidebar()
+ const collapsed = state === 'collapsed' && !isMobile
+
+ if (!collapsed) return null
+
+ return (
+ <div className="hidden min-h-8 items-center gap-2 px-4 pt-3 md:flex lg:px-6">
+ {!inSettings && (
+ <SidebarTrigger className="-ms-1 shrink-0 text-muted-foreground hover:bg-accent hover:text-foreground" />
+ )}
+ <TopBarBreadcrumbs tenantId={tenantId} />
+ </div>
+ )
+}
diff --git a/packages/dashboard-core/src/components/sidebar-search.tsx b/packages/dashboard-core/src/components/sidebar-search.tsx
new file mode 100644
index 0000000000..5a6face2a2
--- /dev/null
+++ b/packages/dashboard-core/src/components/sidebar-search.tsx
@@ -0,0 +1,83 @@
+import {
+ SidebarMenu,
+ SidebarMenuItem,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+ useSidebar,
+} from '@spree/dashboard-ui'
+import { CommandIcon, SearchIcon } from '@spree/dashboard-ui/icons'
+import { useTranslation } from 'react-i18next'
+import { useOptionalCommandPalette } from '../hooks/use-command-palette'
+
+const IS_MAC = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform ?? '')
+
+/**
+ * Opens the global ⌘K palette, sitting under the store switcher.
+ *
+ * The shortcut itself is registered by the palette's provider, not here, so it
+ * works wherever focus is — this is only the visible affordance for it.
+ *
+ * Collapsed to the icon rail it becomes a plain square button: a search field
+ * with no room for text reads as a broken input, whereas an icon reads as a
+ * button that will open something.
+ *
+ * Renders nothing when no palette is mounted — the seller panel has none yet,
+ * and a search box that opens nothing is worse than no search box.
+ */
+export function SidebarSearch() {
+ const { t } = useTranslation()
+ const palette = useOptionalCommandPalette()
+ const { isMobile, state } = useSidebar()
+ const isCollapsed = state === 'collapsed' && !isMobile
+ // A short label, not the palette's own placeholder: the rail is 240px wide
+ // and the descriptive version truncates mid-word. The palette itself keeps
+ // the longer wording, where there is room to name what is searchable.
+ const label = t('admin.components.command_palette.search_label')
+
+ if (!palette) return null
+
+ return (
+ <SidebarMenu>
+ <SidebarMenuItem>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ onClick={() => palette.setOpen(true)}
+ aria-label={isCollapsed ? label : undefined}
+ // 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={
+ isCollapsed
+ ? // `size-10` matches what a nav item collapses to, so the rail reads
+ // as one column of equal targets rather than a search box that
+ // shrank. The glyph stays 16px, as `NavIcon` draws it.
+ 'flex size-10 items-center justify-center rounded-lg text-muted-foreground outline-none transition-colors duration-100 ease-out hover:bg-sidebar-accent-hover hover:text-foreground focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]'
+ : 'flex w-full cursor-pointer items-center gap-2 rounded-lg border border-border bg-card/60 hover:shadow-xs py-1.5 ps-2.5 pe-1.5 text-muted-foreground text-sm outline-none transition-[color,background-color,border-color,box-shadow] duration-100 ease-out hover:bg-card focus-visible:border-ring focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]'
+ }
+ >
+ <SearchIcon className="size-4 shrink-0" />
+ {!isCollapsed && (
+ <>
+ <span className="flex-1 truncate text-left">{label}</span>
+ <kbd className="hidden h-5 items-center gap-0.5 rounded border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground sm:inline-flex">
+ {IS_MAC ? <CommandIcon size={11} /> : 'CTRL'}
+ <span>K</span>
+ </kbd>
+ </>
+ )}
+ </button>
+ </TooltipTrigger>
+ {/* Only while collapsed: expanded, the label is already on screen and
+ a tooltip would repeat it. Matches how `SidebarMenuButton` gates
+ the nav items' own tooltips. */}
+ <TooltipContent side="right" align="center" hidden={!isCollapsed}>
+ {label}
+ </TooltipContent>
+ </Tooltip>
+ </SidebarMenuItem>
+ </SidebarMenu>
+ )
+}
diff --git a/packages/dashboard-core/src/components/sidebar-user.tsx b/packages/dashboard-core/src/components/sidebar-user.tsx
new file mode 100644
index 0000000000..2a249b6727
--- /dev/null
+++ b/packages/dashboard-core/src/components/sidebar-user.tsx
@@ -0,0 +1,213 @@
+import {
+ Avatar,
+ AvatarFallback,
+ AvatarImage,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+ LanguageMenuItems,
+ SidebarMenu,
+ SidebarMenuItem,
+ ThemeMenuItems,
+ useSidebar,
+} from '@spree/dashboard-ui'
+import {
+ BookOpenIcon,
+ ExternalLinkIcon,
+ LogOutIcon,
+ MailIcon,
+ MessageCircleIcon,
+ MoreHorizontalIcon,
+ UserIcon,
+} from '@spree/dashboard-ui/icons'
+import { useTranslation } from 'react-i18next'
+import { useAuth } from '../hooks/use-auth'
+import { useSwitchAdminLocale } from '../hooks/use-switch-admin-locale'
+import { COMMUNITY_URL, CONTACT_URL, DOCS_BASE_URL } from '../lib/docs'
+import { getInitials } from '../lib/formatters'
+import { i18n } from '../lib/i18n'
+import { storefrontHref } from '../lib/storefront'
+import { useOptionalStore } from '../providers/store-provider'
+
+/**
+ * The account menu, sitting at the foot of the primary sidebar.
+ *
+ * It holds what the top bar's user menu held — who is signed in, theme,
+ * language, the support links and sign out — because removing that bar left
+ * the account with nowhere else to live, and the foot of the nav is where a
+ * merchant already looks for it.
+ *
+ * `useOptionalStore` rather than `useStore`: the seller panel mounts this
+ * under a `TenantProvider` with no store at all, and a hard `useStore` would
+ * throw there. A panel without a store simply gets no "View store" entry.
+ */
+export function SidebarUser({
+ uiLocales = [],
+ onEditProfile,
+ variant = 'sidebar',
+}: {
+ uiLocales?: ReadonlyArray<{ code: string; name: string }>
+ onEditProfile?: () => void
+ /**
+ * `bar` renders just the avatar as a compact button, for the mobile top
+ * bar. The menu itself is identical — a phone should not get a smaller set
+ * of account actions than a desktop, only a smaller way in to them.
+ */
+ variant?: 'sidebar' | 'bar'
+}) {
+ const { t } = useTranslation()
+ const { isMobile, state } = useSidebar()
+ const { user, logout } = useAuth()
+ const switchAdminLocale = useSwitchAdminLocale()
+ const store = useOptionalStore()?.store ?? null
+ const viewStoreHref = storefrontHref(store)
+
+ // The desktop rail's icon mode. The mobile drawer is full width whatever
+ // that says, so honouring it there would hide the name for no reason.
+ const isCollapsed = state === 'collapsed' && !isMobile
+
+ if (!user) return null
+
+ const initials = getInitials(user.full_name, user.email)
+
+ // Persists to the account, mirrors it into the auth context, and reloads —
+ // see useSwitchAdminLocale for why all three steps are required.
+ const handleSelectLocale = (code: string) => {
+ void switchAdminLocale(code)
+ }
+
+ const inBar = variant === 'bar'
+
+ const trigger = (
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ aria-label={t('admin.a11y.user_menu')}
+ className={
+ inBar
+ ? 'inline-flex size-11 shrink-0 items-center justify-center rounded-lg outline-hidden transition-colors duration-100 hover:bg-accent data-[state=open]:bg-accent'
+ : 'flex w-full items-center gap-2 rounded-xl p-1.5 outline-hidden transition-colors duration-100 hover:bg-sidebar-accent data-[state=open]:bg-sidebar-accent'
+ }
+ >
+ <Avatar className="size-7 shrink-0 rounded-lg">
+ {user.avatar_url && <AvatarImage src={user.avatar_url} alt="" />}
+ <AvatarFallback className="rounded-lg bg-primary text-xs text-primary-foreground dark:bg-accent dark:text-foreground">
+ {initials}
+ </AvatarFallback>
+ </Avatar>
+ {!inBar && !isCollapsed && (
+ <>
+ <span className="min-w-0 flex-1 truncate text-left font-medium text-sm text-foreground">
+ {user.full_name || user.email}
+ </span>
+ <MoreHorizontalIcon className="size-4 shrink-0 text-muted-foreground" />
+ </>
+ )}
+ </button>
+ </DropdownMenuTrigger>
+ )
+
+ const menu = (
+ <DropdownMenu>
+ {trigger}
+ {/* In the rail the trigger sits at the bottom, so the menu opens
+ upward or to the side or it would run off-screen. In the top bar
+ it hangs below the avatar like any other header menu. */}
+ <DropdownMenuContent
+ className="w-56"
+ side={inBar ? 'bottom' : isMobile ? 'top' : 'right'}
+ align="end"
+ sideOffset={8}
+ >
+ <div className="flex items-center gap-2 p-1.5">
+ <Avatar className="size-8 rounded-lg">
+ {user.avatar_url && <AvatarImage src={user.avatar_url} alt="" />}
+ <AvatarFallback className="rounded-lg bg-primary text-xs text-primary-foreground dark:bg-accent dark:text-foreground">
+ {initials}
+ </AvatarFallback>
+ </Avatar>
+ <div className="grid min-w-0 flex-1 text-sm leading-tight">
+ <span className="truncate font-medium text-foreground">
+ {user.full_name || user.email}
+ </span>
+ {user.full_name && (
+ <span className="truncate text-muted-foreground text-xs">{user.email}</span>
+ )}
+ </div>
+ </div>
+ <DropdownMenuSeparator />
+ <DropdownMenuLabel className="font-medium text-muted-foreground text-xs uppercase tracking-wide">
+ {t('admin.account.preferences')}
+ </DropdownMenuLabel>
+ <ThemeMenuItems />
+ {/* Select-style pill; self-hides when < 2 languages are installed. */}
+ <LanguageMenuItems
+ label={t('admin.account.language.label')}
+ locales={uiLocales}
+ value={i18n.language}
+ onSelect={handleSelectLocale}
+ />
+ <DropdownMenuSeparator />
+ {onEditProfile && (
+ <>
+ <DropdownMenuItem onClick={onEditProfile}>
+ <UserIcon className="size-4" />
+ {t('admin.account.edit_profile')}
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ </>
+ )}
+ {/* The storefront link lost its home when the top bar went, and it
+ belongs with the other outbound links rather than as a button
+ competing with the nav. */}
+ {viewStoreHref && (
+ <DropdownMenuItem asChild>
+ <a href={viewStoreHref} target="_blank" rel="noopener noreferrer">
+ <ExternalLinkIcon className="size-4" />
+ {t('admin.account.view_store')}
+ </a>
+ </DropdownMenuItem>
+ )}
+ {/* All three carried over from the old top bar as inert rows — they
+ looked like links and did nothing. Destinations live in `lib/docs`
+ beside the docs base so a domain move is one edit. */}
+ <DropdownMenuItem asChild>
+ <a href={DOCS_BASE_URL} target="_blank" rel="noopener noreferrer">
+ <BookOpenIcon className="size-4" />
+ {t('admin.account.documentation')}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuItem asChild>
+ <a href={COMMUNITY_URL} target="_blank" rel="noopener noreferrer">
+ <MessageCircleIcon className="size-4" />
+ {t('admin.account.community')}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuItem asChild>
+ <a href={CONTACT_URL} target="_blank" rel="noopener noreferrer">
+ <MailIcon className="size-4" />
+ {t('admin.account.contact_support')}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onClick={logout}>
+ <LogOutIcon className="size-4" />
+ {t('admin.account.log_out')}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+
+ // The bar places the button itself; only the rail needs the menu wrapped in
+ // sidebar row markup.
+ if (inBar) return menu
+
+ return (
+ <SidebarMenu>
+ <SidebarMenuItem>{menu}</SidebarMenuItem>
+ </SidebarMenu>
+ )
+}
diff --git a/packages/dashboard-core/src/components/store-switcher.tsx b/packages/dashboard-core/src/components/store-switcher.tsx
index 86c4824605..68ce20a6f8 100644
--- a/packages/dashboard-core/src/components/store-switcher.tsx
+++ b/packages/dashboard-core/src/components/store-switcher.tsx
@@ -15,6 +15,7 @@ import { CheckIcon, ChevronsUpDownIcon } from '@spree/dashboard-ui/icons'
import { Link } from '@tanstack/react-router'
import { useTranslation } from 'react-i18next'
import { useAuth } from '../hooks/use-auth'
+import { getInitials } from '../lib/formatters'
import { useStore } from '../providers/store-provider'
/**
@@ -34,14 +35,14 @@ export function StoreSwitcher() {
const { store, isLoading } = useStore()
const { user } = useAuth()
- if (isLoading) return <Skeleton className="h-header-height w-full rounded-xl" />
+ if (isLoading) return <Skeleton className="h-rail-header-height w-full rounded-xl" />
const stores = user?.stores ?? []
- const storeInitials = store?.name
- .split(' ')
- .map((name) => name[0])
- .join('')
+ // `getInitials` rather than one letter per word: a store called "Shop With a
+ // Very Long Name" produced six characters and burst the avatar. This caps at
+ // two — first word and last — and is what the account avatar already uses.
+ const storeInitials = getInitials(store?.name, '?')
const header = (
<>
@@ -60,7 +61,7 @@ export function StoreSwitcher() {
if (stores.length < 2) {
return (
<SidebarMenu>
- <SidebarMenuItem className="h-header-height flex items-center">
+ <SidebarMenuItem className="h-rail-header-height flex items-center">
<div className="flex w-full items-center gap-2 p-1.5">{header}</div>
</SidebarMenuItem>
</SidebarMenu>
@@ -69,7 +70,7 @@ export function StoreSwitcher() {
return (
<SidebarMenu>
- <SidebarMenuItem className="h-header-height flex items-center">
+ <SidebarMenuItem className="h-rail-header-height flex items-center">
<DropdownMenu>
<DropdownMenuTrigger asChild className="flex w-full items-center">
<button
diff --git a/packages/dashboard-core/src/components/table-toolbar.tsx b/packages/dashboard-core/src/components/table-toolbar.tsx
index 2b7be70885..c08e4c8bd5 100644
--- a/packages/dashboard-core/src/components/table-toolbar.tsx
+++ b/packages/dashboard-core/src/components/table-toolbar.tsx
@@ -1,7 +1,6 @@
import {
Button,
Checkbox,
- cn,
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
@@ -54,7 +53,6 @@ import {
} from '../lib/table-registry'
import { useOptionalStore } from '../providers/store-provider'
import { useTenantId } from '../providers/tenant-provider'
-import { SectionHeading } from './section-heading'
import { StoreDatePicker } from './store-date-picker'
interface TableToolbarProps {
@@ -71,19 +69,6 @@ interface TableToolbarProps {
onFiltersChange: (filters: FilterRule[]) => void
/** All columns including filter-only ones (for the filter drawer). Falls back to `columns` if not provided. */
allColumns?: ColumnDef[]
- /** Title displayed in the toolbar header */
- title?: string
- /**
- * Heading level for the title. Defaults to `h1` because a list page is this
- * table and nothing else. Pass a lower level when the table is a panel
- * inside a page that already owns the `h1`.
- */
- titleAs?: 'h1' | 'h2' | 'h3'
- /** One line under the title saying what the list is for. */
- description?: string
- /** Documentation for the feature, linked at the end of the description. */
- docsPath?: string
- actions?: React.ReactNode
/** Hide the sort dropdown — used when the table is drag-reorderable, where free sorting would defeat the drag. */
hideSort?: boolean
}
@@ -186,11 +171,6 @@ export function TableToolbar({
filters,
onFiltersChange,
allColumns,
- title,
- titleAs = 'h1',
- description,
- docsPath,
- actions,
hideSort = false,
}: TableToolbarProps) {
const { t } = useTranslation()
@@ -267,34 +247,6 @@ export function TableToolbar({
return (
<>
- {/* Title and page actions only. Every control that acts on the list —
- search, filters, sort, columns — lives on the row below, so the two
- rows split by what they are for rather than by how they are built. */}
- <div
- className={cn(
- 'flex flex-row gap-2 border-b border-border-subtle p-3 pl-4 lg:justify-between',
- description ? 'items-start' : 'items-center',
- )}
- >
- {(title || description) && (
- // `h1`: a list page is a `ResourceTable` and nothing else, so this
- // title is the page's only heading. Rendered as a div it left those
- // pages with no heading at all — no document outline, and nothing
- // for the heading-navigation a screen reader user relies on.
- <SectionHeading
- // Only a real title becomes a heading. `title` and `description`
- // are independent, and a description-only caller would otherwise
- // emit an empty `<h1>` — which a screen reader still lists in
- // heading navigation, as a blank entry.
- as={title ? titleAs : undefined}
- title={title}
- description={description}
- docsPath={docsPath}
- />
- )}
- <div className="ml-auto flex shrink-0 items-center gap-2">{actions}</div>
- </div>
-
{/* One filter row: the quick controls and any filters set the long way
sit together, because to the operator they are the same thing — a
constraint currently on the list. Splitting them into a "controls"
@@ -308,17 +260,17 @@ export function TableToolbar({
search ||
(!hideSort && sortableColumns.length > 0) ||
columns.some((c) => c.default !== undefined)) && (
- <div className="flex items-start gap-2 border-b border-border-subtle px-3 py-2">
+ <div className="flex items-start gap-2">
{/* Only the filters wrap. They grow with what the operator has set,
where sort and columns are a fixed pair — letting the whole row
wrap dropped those two onto a line of their own the moment the
filters filled the width. */}
<div className="flex min-w-0 flex-1 flex-wrap items-center gap-2">
{/* Search leads: it is the widest net, and the filters beside it
- narrow what it finds. Hidden on a phone, where the TopBar already
- carries a search field — two search boxes stacked in one column is
- the more confusing cost. A term set on desktop still shows as a
- chip there, so it never filters a list invisibly. */}
+ narrow what it finds. Hidden on a phone, where the sidebar drawer
+ already carries a search field — two search boxes stacked in one
+ column is the more confusing cost. A term set on desktop still
+ shows as a chip there, so it never filters a list invisibly. */}
<SearchInput
value={search}
onValueChange={onSearchChange}
diff --git a/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx b/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx
index 7195433380..fad08dac4f 100644
--- a/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx
+++ b/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx
@@ -38,9 +38,9 @@ export function TopBarBreadcrumbs({ tenantId }: { tenantId?: string } = {}) {
}
/**
- * Breadcrumbs for a narrow screen, as a row beneath the TopBar rather than
- * inside it — the bar has no width to spare on a phone, so the trail lives on
- * its own line and scrolls sideways instead of wrapping.
+ * Breadcrumbs for a narrow screen, as a row beneath `MobileTopBar` rather
+ * than inside it — that bar has no width to spare on a phone, so the trail
+ * lives on its own line and scrolls sideways instead of wrapping.
*
* Only rendered where it earns the vertical space: inside settings, and on
* record pages. A top-level list page would only repeat its own heading.
diff --git a/packages/dashboard-core/src/components/top-bar.tsx b/packages/dashboard-core/src/components/top-bar.tsx
deleted file mode 100644
index 1a727946a8..0000000000
--- a/packages/dashboard-core/src/components/top-bar.tsx
+++ /dev/null
@@ -1,277 +0,0 @@
-import {
- Avatar,
- AvatarFallback,
- AvatarImage,
- Button,
- cn,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
- LanguageMenuItems,
- SidebarTrigger,
- ThemeMenuItems,
- usePrefersReducedMotion,
-} from '@spree/dashboard-ui'
-import {
- BookOpenIcon,
- CommandIcon,
- ExternalLinkIcon,
- LogOutIcon,
- MailIcon,
- MessageCircleIcon,
- SearchIcon,
- UserIcon,
-} from '@spree/dashboard-ui/icons'
-import { useTranslation } from 'react-i18next'
-import { useAuth } from '../hooks/use-auth'
-import { useCommandPalette } from '../hooks/use-command-palette'
-import { useSwitchAdminLocale } from '../hooks/use-switch-admin-locale'
-import { getInitials } from '../lib/formatters'
-import { i18n } from '../lib/i18n'
-import { storefrontHref } from '../lib/storefront'
-import { useStickyHeader } from '../providers/sticky-header-provider'
-import { useStore } from '../providers/store-provider'
-import { TopBarBreadcrumbs } from './top-bar-breadcrumbs'
-
-const IS_MAC = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform ?? '')
-
-/**
- * Top-bar shell for the admin SPA. Three-slot layout:
- * [☰ sidebar toggle] [global search] [view store · user menu]
- *
- * The search trigger opens the global ⌘K command palette (provider mounted at
- * the layout root). The keyboard shortcut is registered in the provider, not
- * here, so it works regardless of focus location.
- */
-/**
- * @param uiLocales Admin UI languages for the in-menu switcher. The app owns
- * which locale bundles ship (see the dashboard's `getAvailableUiLocales`) and
- * injects them here, so this core component stays free of bundle knowledge.
- * @param onEditProfile Opens the app's edit-profile dialog. Injected the same
- * way as `uiLocales` — the profile form lives in the app package (its hooks,
- * schema and locale list do), so core only offers the menu entry. The item is
- * hidden when no handler is supplied.
- */
-export function TopBar({
- uiLocales = [],
- onEditProfile,
-}: {
- uiLocales?: ReadonlyArray<{ code: string; name: string }>
- onEditProfile?: () => void
-}) {
- // Give the vertical space back to the page: once the user scrolls a detail
- // page, the PageHeader below carries the title and the primary actions, so
- // the search/account bar retreats out of the viewport rather than parking a
- // second band of chrome above it. The provider owns this flag so both bars
- // move off one signal; it stays false on pages with no PageHeader to take
- // over (list views), where hiding the bar would cost a header and give
- // nothing back.
- const { collapsed } = useStickyHeader()
- const prefersReducedMotion = usePrefersReducedMotion()
- // Under reduced motion the bar simply stays — sliding it is the movement
- // the setting asks us to drop, and cutting only the transition would
- // replace the slide with a jump, which is worse.
- const hidden = collapsed && !prefersReducedMotion
-
- return (
- <header
- className={cn(
- // Opaque, not frosted. A translucent bar works over a page background,
- // but this one sits above a scrolling table: at 75% every row that
- // passes under it shows through, and the blur smears the thumbnail and
- // title rather than hiding them — which reads as a rendering fault, not
- // as material. Measured, dark row text stays legible through the bar
- // until about 98% opacity, by which point there is no translucency left
- // to see. So the effect cannot survive this surface, and the bar takes
- // the page colour outright.
- 'sticky top-0 z-40 flex h-header-height shrink-0 items-center gap-3 bg-background px-4 border-b border-sidebar-border',
- 'transition-transform duration-200 ease-out motion-reduce:transition-none',
- hidden && '-translate-y-full',
- )}
- // Hidden from assistive tech and out of the tab order while off-screen,
- // so keyboard focus can't land on a control the user cannot see.
- inert={hidden || undefined}
- >
- {/* Size the glyph, not the button — `size="icon-sm"` sets a 28px hit area
- and overriding the box would shrink the target to 20px. */}
- <SidebarTrigger className="-ml-1 opacity-50 hover:bg-accent-strong hover:opacity-100 [&_svg]:size-5" />
-
- {/* A three-column grid keeps the search optically centred whatever the
- trail's length, with the trail truncating rather than pushing it. The
- third column is the grid's own empty track — no spacer element.
- Breadcrumbs hide below `md`, where they would crowd out the search
- box; `MobileBreadcrumbBar` carries the trail there instead. */}
- <div className="grid flex-1 grid-cols-1 items-center md:grid-cols-[1fr_minmax(0,28rem)_1fr]">
- <div className="hidden min-w-0 md:block">
- <TopBarBreadcrumbs />
- </div>
- <SearchTrigger />
- </div>
-
- <div className="flex items-center gap-2">
- <ViewStoreLink />
- <TopBarUser uiLocales={uiLocales} onEditProfile={onEditProfile} />
- </div>
- </header>
- )
-}
-
-// ---------------------------------------------------------------------------
-// Search trigger — opens the global command palette
-// ---------------------------------------------------------------------------
-
-function SearchTrigger() {
- const { t } = useTranslation()
- const { setOpen } = useCommandPalette()
-
- return (
- <button
- type="button"
- onClick={() => setOpen(true)}
- // 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 shrink cursor-pointer items-center gap-2 rounded-xl border border-border p-1.5 pl-3 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-md border px-2 py-1 font-mono text-lg sm:inline-flex h-7 items-center gap-1">
- {IS_MAC ? <CommandIcon size={15} /> : 'CTRL'}
- <span>K</span>
- </kbd>
- </button>
- )
-}
-
-// ---------------------------------------------------------------------------
-// View Store link
-// ---------------------------------------------------------------------------
-
-function ViewStoreLink() {
- const { t } = useTranslation()
- const { store } = useStore()
- const href = storefrontHref(store)
- if (!href) return null
-
- return (
- <Button asChild variant="ghost" size="sm">
- <a href={href} target="_blank" rel="noreferrer">
- <ExternalLinkIcon className="size-4" />
- <span className="hidden sm:inline">{t('admin.account.view_store')}</span>
- </a>
- </Button>
- )
-}
-
-// ---------------------------------------------------------------------------
-// User menu
-// ---------------------------------------------------------------------------
-
-/**
- * The account menu: who is signed in, theme and language, and sign out.
- *
- * Exported because it is the one piece of the top bar that needs nothing but
- * `useAuth` — no store, no command palette — so a panel with different chrome
- * (the seller panel) mounts this rather than forking a second user menu that
- * would then drift.
- */
-export function TopBarUser({
- uiLocales = [],
- onEditProfile,
-}: {
- uiLocales?: ReadonlyArray<{ code: string; name: string }>
- onEditProfile?: () => void
-}) {
- const { t } = useTranslation()
- const { user, logout } = useAuth()
- const switchAdminLocale = useSwitchAdminLocale()
- if (!user) return null
-
- const initials = getInitials(user.full_name, user.email)
-
- // Switching the admin UI language persists to the account, mirrors it into
- // the auth context, and reloads — see useSwitchAdminLocale for why all three
- // steps are required.
- const handleSelectLocale = (code: string) => {
- void switchAdminLocale(code)
- }
-
- return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- type="button"
- aria-label={t('admin.a11y.user_menu')}
- className="flex items-center gap-2 rounded-lg p-1 transition-colors hover:bg-accent-strong"
- >
- <Avatar className="size-7">
- {user.avatar_url && <AvatarImage src={user.avatar_url} alt="" />}
- <AvatarFallback className="bg-primary text-xs text-primary-foreground dark:bg-accent dark:text-foreground">
- {initials}
- </AvatarFallback>
- </Avatar>
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-56" sideOffset={8}>
- <div className="flex items-center gap-2 p-1.5">
- <Avatar className="size-8">
- {user.avatar_url && <AvatarImage src={user.avatar_url} alt="" />}
- <AvatarFallback className="bg-primary text-xs text-primary-foreground dark:bg-accent dark:text-foreground">
- {initials}
- </AvatarFallback>
- </Avatar>
- <div className="grid min-w-0 flex-1 text-sm leading-tight">
- <span className="truncate font-medium text-foreground">
- {user.full_name || user.email}
- </span>
- {user.full_name && (
- <span className="truncate text-xs text-muted-foreground">{user.email}</span>
- )}
- </div>
- </div>
- <DropdownMenuSeparator />
- <DropdownMenuLabel className="text-xs font-medium uppercase tracking-wide text-muted-foreground">
- {t('admin.account.preferences')}
- </DropdownMenuLabel>
- <ThemeMenuItems />
- {/* Select-style pill; self-hides when < 2 languages are installed. */}
- <LanguageMenuItems
- label={t('admin.account.language.label')}
- locales={uiLocales}
- value={i18n.language}
- onSelect={handleSelectLocale}
- />
- <DropdownMenuSeparator />
- {onEditProfile && (
- <>
- <DropdownMenuItem onClick={onEditProfile}>
- <UserIcon className="size-4" />
- {t('admin.account.edit_profile')}
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- </>
- )}
- <DropdownMenuItem>
- <BookOpenIcon className="size-4" />
- {t('admin.account.documentation')}
- </DropdownMenuItem>
- <DropdownMenuItem>
- <MessageCircleIcon className="size-4" />
- {t('admin.account.community')}
- </DropdownMenuItem>
- <DropdownMenuItem>
- <MailIcon className="size-4" />
- {t('admin.account.contact_support')}
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem onClick={logout}>
- <LogOutIcon className="size-4" />
- {t('admin.account.log_out')}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- )
-}
diff --git a/packages/dashboard-core/src/hooks/use-command-palette.tsx b/packages/dashboard-core/src/hooks/use-command-palette.tsx
index c248682b0b..504e246161 100644
--- a/packages/dashboard-core/src/hooks/use-command-palette.tsx
+++ b/packages/dashboard-core/src/hooks/use-command-palette.tsx
@@ -32,3 +32,16 @@ export function useCommandPalette(): CommandPaletteState {
}
return ctx
}
+
+/**
+ * The palette state when one is mounted, `null` otherwise.
+ *
+ * The shared app shell offers a search affordance, but not every panel has a
+ * palette behind it — the seller panel deliberately mounts none. This lets the
+ * shell omit the trigger there rather than render a button that throws on
+ * click, and keeps `useCommandPalette` strict for callers that genuinely
+ * require the provider.
+ */
+export function useOptionalCommandPalette(): CommandPaletteState | null {
+ return useContext(CommandPaletteContext)
+}
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.ts
index f9eb8b6248..afa47966ea 100644
--- a/packages/dashboard-core/src/index.ts
+++ b/packages/dashboard-core/src/index.ts
@@ -17,6 +17,7 @@ export * from './api-client'
// ---------------------------------------------------------------------------
export { adminClient } from './client'
export * from './components/address-form-dialog'
+export * from './components/app-shell'
export * from './components/app-sidebar'
export * from './components/bulk-action-bar'
export * from './components/can'
@@ -31,6 +32,7 @@ export * from './components/import-wizard-dialog'
export * from './components/locale-select'
export * from './components/market-combobox'
export * from './components/media-picker-sheet'
+export * from './components/mobile-top-bar'
export * from './components/nav-main'
export * from './components/page-header'
export * from './components/page-tabs'
@@ -42,13 +44,15 @@ export * from './components/resource-table'
export * from './components/route-announcer'
export * from './components/section-heading'
export * from './components/settings-sidebar'
+export * from './components/sheet-top-bar'
+export * from './components/sidebar-search'
+export * from './components/sidebar-user'
export * from './components/skip-link'
export * from './components/slot'
export * from './components/store-date-picker'
export * from './components/store-switcher'
export * from './components/table-toolbar'
export * from './components/tag-combobox'
-export * from './components/top-bar'
export * from './components/top-bar-breadcrumbs'
// ---------------------------------------------------------------------------
// Infra hooks
diff --git a/packages/dashboard-core/src/lib/docs.ts b/packages/dashboard-core/src/lib/docs.ts
index 8de4f3abb9..c9e7e7969f 100644
--- a/packages/dashboard-core/src/lib/docs.ts
+++ b/packages/dashboard-core/src/lib/docs.ts
@@ -6,6 +6,13 @@
*/
export const DOCS_BASE_URL = 'https://spreecommerce.org/docs'
+/**
+ * The other two destinations the account menu offers, kept here for the same
+ * reason as the docs base: one edit if a domain moves.
+ */
+export const COMMUNITY_URL = 'https://discord.spreecommerce.org'
+export const CONTACT_URL = 'https://spreecommerce.org/contact'
+
/**
* Resolves a documentation path to a full URL.
*
diff --git a/packages/dashboard-core/src/locales/ar.json b/packages/dashboard-core/src/locales/ar.json
index 2b587310fa..566405bad4 100644
--- a/packages/dashboard-core/src/locales/ar.json
+++ b/packages/dashboard-core/src/locales/ar.json
@@ -249,6 +249,7 @@
},
"no_results": "لا توجد نتائج لـ \"{{query}}\".",
"placeholder": "البحث في المنتجات والطلبات والعملاء…",
+ "search_label": "ابحث عن أي شيء…",
"title": "البحث والأوامر"
},
"confirm_dialog": {
diff --git a/packages/dashboard-core/src/locales/de.json b/packages/dashboard-core/src/locales/de.json
index b593a3af6c..2c53c581ae 100644
--- a/packages/dashboard-core/src/locales/de.json
+++ b/packages/dashboard-core/src/locales/de.json
@@ -249,6 +249,7 @@
},
"no_results": "Keine Ergebnisse für \"{{query}}\".",
"placeholder": "Produkte, Bestellungen, Kunden suchen…",
+ "search_label": "Alles durchsuchen…",
"title": "Suche und Befehle"
},
"confirm_dialog": {
diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.json
index ee03fa138a..9d84ac13d4 100644
--- a/packages/dashboard-core/src/locales/en.json
+++ b/packages/dashboard-core/src/locales/en.json
@@ -249,6 +249,7 @@
},
"no_results": "No results for \"{{query}}\".",
"placeholder": "Search products, orders, customers…",
+ "search_label": "Search anything…",
"title": "Search and commands"
},
"confirm_dialog": {
diff --git a/packages/dashboard-core/src/locales/fr.json b/packages/dashboard-core/src/locales/fr.json
index e5801f7c1a..981bb81e33 100644
--- a/packages/dashboard-core/src/locales/fr.json
+++ b/packages/dashboard-core/src/locales/fr.json
@@ -249,6 +249,7 @@
},
"no_results": "Aucun résultat pour « {{query}} ».",
"placeholder": "Rechercher des produits, des commandes, des clients…",
+ "search_label": "Rechercher…",
"title": "Recherche et commandes"
},
"confirm_dialog": {
diff --git a/packages/dashboard-core/src/locales/pl.json b/packages/dashboard-core/src/locales/pl.json
index 9551465400..7c280947ba 100644
--- a/packages/dashboard-core/src/locales/pl.json
+++ b/packages/dashboard-core/src/locales/pl.json
@@ -250,6 +250,7 @@
},
"no_results": "Brak wyników dla „{{query}}”.",
"placeholder": "Szukaj produktów, zamówień, klientów…",
+ "search_label": "Szukaj wszędzie…",
"title": "Wyszukiwanie i polecenia"
},
"confirm_dialog": {
diff --git a/packages/dashboard-core/src/locales/zh-CN.json b/packages/dashboard-core/src/locales/zh-CN.json
index 187e6b7904..ddc56313cf 100644
--- a/packages/dashboard-core/src/locales/zh-CN.json
+++ b/packages/dashboard-core/src/locales/zh-CN.json
@@ -249,6 +249,7 @@
},
"no_results": "未找到与“{{query}}”相关的结果。",
"placeholder": "搜索商品、订单、客户…",
+ "search_label": "搜索任何内容…",
"title": "搜索与命令"
},
"confirm_dialog": {
diff --git a/packages/dashboard-core/src/products/product-form-cards.tsx b/packages/dashboard-core/src/products/product-form-cards.tsx
index e6344a365e..1f02ad6b57 100644
--- a/packages/dashboard-core/src/products/product-form-cards.tsx
+++ b/packages/dashboard-core/src/products/product-form-cards.tsx
@@ -502,7 +502,7 @@ export function MediaCard({
return (
<>
- <Card className="scroll-mt-[calc(var(--spacing-header-height)*2+1.5rem)]">
+ <Card className="scroll-mt-[calc(var(--spacing-header-height)+1.5rem)]">
<CardHeader>
<CardTitle>{t('admin.pages.products.section_media')}</CardTitle>
</CardHeader>
diff --git a/packages/dashboard-core/src/providers/sticky-header-provider.tsx b/packages/dashboard-core/src/providers/sticky-header-provider.tsx
index 1ecfa891df..4aff3d6f60 100644
--- a/packages/dashboard-core/src/providers/sticky-header-provider.tsx
+++ b/packages/dashboard-core/src/providers/sticky-header-provider.tsx
@@ -1,81 +1,134 @@
-import { useScrolled } from '@spree/dashboard-ui'
-import { createContext, type ReactNode, useContext, useEffect, useMemo, useState } from 'react'
+import {
+ createContext,
+ type ReactNode,
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+} from 'react'
-interface StickyHeaderContextValue {
- /** True while a `PageHeader` is mounted on the current page. */
- hasPageHeader: boolean
- /**
- * True once the user has scrolled far enough for the TopBar to give up its
- * place to the PageHeader. Both headers read this single value so they move
- * as one — deriving it separately in each is what let them desync.
- */
- collapsed: boolean
- /** Registers a mounted `PageHeader`; returns the deregistration callback. */
- registerPageHeader: () => () => void
+/**
+ * The CSS variable every pinned band offsets itself by — the table's pinned
+ * column row, the bulk-action bar, scroll-margin on linked cards. It is
+ * declared in `styles.css` with a fallback for pages that have no
+ * `PageHeader`, and overwritten here with the real measurement when one is
+ * mounted.
+ */
+const OFFSET_VARIABLE = '--spacing-header-height'
+
+/**
+ * Tracks a mounted `PageHeader` and publishes its height as the shared sticky
+ * offset.
+ *
+ * The dashboard has no top bar: a page's own header is the only chrome above
+ * the scrolling content, so it is also the only thing other pinned bands need
+ * to clear. Its height is not a constant — badges, a subtitle and wrapped
+ * actions all change it, and so does a narrow viewport — so it is measured
+ * rather than assumed. A `ResizeObserver` keeps the variable current as the
+ * header reflows.
+ *
+ * The variable is set on `document.documentElement` because the elements
+ * reading it are not all descendants of the header (the pinned table row lives
+ * further down the tree, and Tailwind resolves `top-header-height` against
+ * whatever the cascade provides).
+ *
+ * @param enabled false for a header that does not pin — it then publishes no
+ * offset at all, so the bands below it pin to the top of the scroll
+ * container rather than clearing a header that never occupies that space.
+ * @returns a ref to attach to the `PageHeader` element
+ */
+export function useStickyHeaderOffset(enabled = true): (node: HTMLElement | null) => void {
+ const observerRef = useRef<ResizeObserver | null>(null)
+
+ useEffect(() => {
+ // Only on unmount: leaving a measured height behind would make the next
+ // page — which may have no header at all — pin its table that far down.
+ return () => {
+ observerRef.current?.disconnect()
+ document.documentElement.style.removeProperty(OFFSET_VARIABLE)
+ }
+ }, [])
+
+ return useCallback(
+ (node: HTMLElement | null) => {
+ observerRef.current?.disconnect()
+
+ if (!node || !enabled) {
+ document.documentElement.style.removeProperty(OFFSET_VARIABLE)
+ return
+ }
+
+ const publish = () => {
+ const { height } = node.getBoundingClientRect()
+ // Sub-pixel heights round up: rounding down leaves a hairline of the
+ // scrolling row visible above the pinned one.
+ document.documentElement.style.setProperty(OFFSET_VARIABLE, `${Math.ceil(height)}px`)
+ }
+
+ publish()
+
+ if (typeof ResizeObserver !== 'undefined') {
+ const observer = new ResizeObserver(publish)
+ observer.observe(node)
+ observerRef.current = observer
+ }
+ },
+ [enabled],
+ )
}
-const StickyHeaderContext = createContext<StickyHeaderContextValue | null>(null)
+// ---------------------------------------------------------------------------
+// Page-header presence — heading levels
+// ---------------------------------------------------------------------------
-// Engage only once the page has scrolled by more than the TopBar's own height,
-// and disengage well before that. Without the gap, a slow scroll around a
-// single boundary toggles repeatedly and both headers judder.
-const COLLAPSE_AT = 64
-const RELEASE_AT = 8
+const PageHeaderPresenceContext = createContext<{
+ hasPageHeader: boolean
+ register: () => () => void
+} | null>(null)
/**
- * Coordinates the two stacked sticky bars — the `TopBar` (search, store
- * switcher, account) and a page's `PageHeader` (title, badges, Save).
- *
- * Only one of them needs to stay on screen while the user scrolls a long
- * page: the PageHeader carries the actions, the TopBar carries navigation
- * the user isn't using mid-page. So the TopBar slides away on scroll and the
- * PageHeader rises to take its place, giving detail pages back a full
- * header's worth of vertical space.
+ * Tracks whether a `PageHeader` is mounted on the current page.
*
- * The TopBar only retreats when a PageHeader is actually mounted to replace
- * it — on pages without one (list views), the search bar stays put.
+ * This is not about layout — it is about heading levels. When a page has a
+ * `PageHeader` it owns the `h1`, so a table heading below it must be an `h2`;
+ * on a page without one the table's own title is the first heading. Getting
+ * that wrong produces a document with two `h1`s or none, which is exactly what
+ * a screen-reader user navigates by.
*/
export function StickyHeaderProvider({ children }: { children: ReactNode }) {
const [count, setCount] = useState(0)
- const scrolled = useScrolled(COLLAPSE_AT, RELEASE_AT)
- const hasPageHeader = count > 0
- const value = useMemo<StickyHeaderContextValue>(
+ const value = useMemo(
() => ({
- hasPageHeader,
- collapsed: scrolled && hasPageHeader,
- registerPageHeader: () => {
+ hasPageHeader: count > 0,
+ register: () => {
setCount((n) => n + 1)
return () => setCount((n) => n - 1)
},
}),
- [hasPageHeader, scrolled],
+ [count],
)
- return <StickyHeaderContext.Provider value={value}>{children}</StickyHeaderContext.Provider>
-}
-
-/**
- * Reads the shared sticky-header state. Returns inert defaults outside a
- * provider so `PageHeader`/`TopBar` remain usable standalone (tests, plugin
- * previews) without throwing.
- */
-export function useStickyHeader(): StickyHeaderContextValue {
return (
- useContext(StickyHeaderContext) ?? {
- hasPageHeader: false,
- collapsed: false,
- registerPageHeader: () => () => {},
- }
+ <PageHeaderPresenceContext.Provider value={value}>
+ {children}
+ </PageHeaderPresenceContext.Provider>
)
}
/**
- * Announces a mounted `PageHeader` for the lifetime of the calling component,
- * and reports whether the pair is currently collapsed.
+ * Whether a `PageHeader` is mounted. Returns an inert default outside a
+ * provider so components stay usable standalone (tests, plugin previews).
*/
-export function useRegisterPageHeader(): boolean {
- const { registerPageHeader, collapsed } = useStickyHeader()
- useEffect(() => registerPageHeader(), [registerPageHeader])
- return collapsed
+export function useStickyHeader(): { hasPageHeader: boolean } {
+ return useContext(PageHeaderPresenceContext) ?? { hasPageHeader: false }
+}
+
+/** Announces a mounted `PageHeader` for the lifetime of the calling component. */
+export function useRegisterPageHeader(): void {
+ const ctx = useContext(PageHeaderPresenceContext)
+ const register = ctx?.register
+ useEffect(() => register?.(), [register])
}
diff --git a/packages/dashboard-ui/src/hooks/use-scrolled.ts b/packages/dashboard-ui/src/hooks/use-scrolled.ts
index 93fa1ca842..6e50ef55e1 100644
--- a/packages/dashboard-ui/src/hooks/use-scrolled.ts
+++ b/packages/dashboard-ui/src/hooks/use-scrolled.ts
@@ -1,14 +1,19 @@
import * as React from 'react'
/**
- * Returns true once the document has been scrolled past `threshold` pixels
- * from the top, false at rest. Used to fade in subtle elevation on sticky
- * headers, top bars, etc. so they don't look heavy when nothing is scrolled
- * behind them.
+ * Returns true once the page has been scrolled past `threshold` pixels from
+ * the top, false at rest. Used to fade in subtle elevation on sticky headers
+ * so they don't look heavy when nothing is scrolled behind them.
*
- * Listens passively to `window` scroll. Default threshold is 4px to avoid
- * flickering at the boundary on devices that report fractional scroll
- * positions.
+ * Listens on the document in the capture phase rather than on `window`, and
+ * reads the offset from whichever element actually scrolled. The shell's
+ * content is an inset sheet that scrolls internally, so `window.scrollY` stays
+ * 0 there for the whole life of the page — a window listener would report "not
+ * scrolled" no matter how far down a long form the user went. Scroll events do
+ * not bubble, which is why this has to capture.
+ *
+ * Default threshold is 4px to avoid flickering at the boundary on devices that
+ * report fractional scroll positions.
*
* @param threshold Scroll offset, in pixels, at which the state flips to true.
* @param releaseThreshold Offset the user must scroll back above before it
@@ -25,17 +30,20 @@ export function useScrolled(threshold = 4, releaseThreshold = threshold) {
const [scrolled, setScrolled] = React.useState(false)
React.useEffect(() => {
- const onScroll = () =>
+ const onScroll = (event?: Event) => {
+ // The scrolled element for a container, `window.scrollY` for the page.
+ const target = event?.target
+ const offset = target instanceof HTMLElement ? target.scrollTop : window.scrollY
+
// Reading the previous value here (rather than from a dependency) keeps
// the listener stable while still letting the two thresholds apply
// directionally: past `threshold` to engage, back above
// `releaseThreshold` to disengage.
- setScrolled((wasScrolled) =>
- wasScrolled ? window.scrollY > releaseThreshold : window.scrollY > threshold,
- )
+ setScrolled((wasScrolled) => (wasScrolled ? offset > releaseThreshold : offset > threshold))
+ }
onScroll()
- window.addEventListener('scroll', onScroll, { passive: true })
- return () => window.removeEventListener('scroll', onScroll)
+ document.addEventListener('scroll', onScroll, { capture: true, passive: true })
+ return () => document.removeEventListener('scroll', onScroll, { capture: true })
}, [threshold, releaseThreshold])
return scrolled
diff --git a/packages/dashboard-ui/src/index.ts b/packages/dashboard-ui/src/index.ts
index 415fc1ec31..59f7f85230 100644
--- a/packages/dashboard-ui/src/index.ts
+++ b/packages/dashboard-ui/src/index.ts
@@ -62,6 +62,7 @@ export * from './spree/return-dialogs'
// `@spree/dashboard-ui/spree/json-value-view`. Types are available the same
// way — `import { type JsonPreviewDrawerProps } from '@spree/dashboard-ui/spree/json-preview-drawer'`.
+export * from './spree/external-link'
export * from './spree/language-menu-items'
export * from './spree/metadata/metadata-card'
export * from './spree/product-membership-list'
diff --git a/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx b/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
index 883663c6c3..c040509966 100644
--- a/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
+++ b/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
@@ -177,7 +177,7 @@ export function ClaimResolveDialog({
{lines.map((line) => (
<div
key={line.id}
- className="flex items-center justify-between gap-4 rounded-lg border p-3"
+ className="flex items-center justify-between gap-4 rounded-lg border border-border-subtle p-3"
>
<span className="truncate text-sm">
{line.label}
diff --git a/packages/dashboard-ui/src/spree/drag-handle.tsx b/packages/dashboard-ui/src/spree/drag-handle.tsx
index 974cc24bae..696696ff2c 100644
--- a/packages/dashboard-ui/src/spree/drag-handle.tsx
+++ b/packages/dashboard-ui/src/spree/drag-handle.tsx
@@ -38,7 +38,7 @@ export function DragHandle({ attributes, listeners, className, ...props }: DragH
type="button"
aria-label={t('admin.a11y.drag_to_reorder')}
className={cn(
- 'flex h-full w-full items-center justify-center rounded-lg p-2 text-muted-foreground cursor-grab active:cursor-grabbing hover:bg-accent',
+ 'flex h-full w-full items-center justify-center rounded-lg p-2 text-muted-foreground cursor-grab active:cursor-grabbing hover:bg-accent-strong hover:text-accent-foreground',
className,
)}
{...attributes}
diff --git a/packages/dashboard-ui/src/spree/external-link.tsx b/packages/dashboard-ui/src/spree/external-link.tsx
new file mode 100644
index 0000000000..cd202a6a0d
--- /dev/null
+++ b/packages/dashboard-ui/src/spree/external-link.tsx
@@ -0,0 +1,56 @@
+import type * as React from 'react'
+import { cn } from '../lib/utils'
+import { ExternalLinkIcon } from './icons'
+
+/**
+ * A link that leaves the dashboard — documentation, a storefront, a carrier's
+ * tracking page, a provider's console.
+ *
+ * The trailing arrow is the point: it tells the reader this one opens a new tab
+ * before they click it, which a bare link cannot. Four hand-rolled versions of
+ * this had grown across the two panels, each with its own colour, gap and icon
+ * size, so a docs link looked like one thing next to a title and another inside
+ * a card.
+ *
+ * `rel="noopener noreferrer"` is not optional on a `_blank` link: without
+ * `noopener` the opened page can reach back through `window.opener` and
+ * navigate this one. `target` and `rel` are therefore not part of the public
+ * props — a caller cannot spread them back in and undo the isolation.
+ */
+export function ExternalLink({
+ className,
+ children,
+ // Pulled out of `props` so they cannot be spread back in below, and typed
+ // `never` so a caller is told at compile time too. Types alone would not be
+ // enough: they vanish at runtime, so an untyped caller or a plain-JS
+ // consumer of this source-shipped package could still land its own
+ // `target`/`rel` after ours and undo the isolation.
+ target: _target,
+ rel: _rel,
+ ...props
+}: Omit<React.ComponentProps<'a'>, 'target' | 'rel'> & {
+ href: string
+ target?: never
+ rel?: never
+}) {
+ return (
+ <a
+ data-slot="external-link"
+ target="_blank"
+ rel="noopener noreferrer"
+ className={cn(
+ // `--link` rather than the accent: this is body-copy text, and the
+ // accent fails 4.5:1 on both the card and the page.
+ 'inline-flex items-center gap-1 text-link transition-colors duration-100 ease-out hover:text-link-hover',
+ // Sized relative to the text it sits in, so the arrow stays in
+ // proportion whether the link is in a heading or a caption.
+ '[&>svg]:size-[1em] [&>svg]:shrink-0',
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <ExternalLinkIcon aria-hidden />
+ </a>
+ )
+}
diff --git a/packages/dashboard-ui/src/spree/post-sale-create-dialogs.tsx b/packages/dashboard-ui/src/spree/post-sale-create-dialogs.tsx
index 86e97934b1..9564c1b5c7 100644
--- a/packages/dashboard-ui/src/spree/post-sale-create-dialogs.tsx
+++ b/packages/dashboard-ui/src/spree/post-sale-create-dialogs.tsx
@@ -154,7 +154,10 @@ export function CreateClaimDialog({
const chosenQuantity = selection[line.id] ?? 0
return (
- <div key={line.id} className="flex flex-col gap-2 rounded-lg border p-3">
+ <div
+ key={line.id}
+ className="flex flex-col gap-2 rounded-lg border border-border-subtle p-3"
+ >
<div className="flex items-center justify-between gap-4">
<span className="min-w-0 truncate text-sm">{line.label}</span>
<Input
diff --git a/packages/dashboard-ui/src/spree/post-sale-fields.tsx b/packages/dashboard-ui/src/spree/post-sale-fields.tsx
index 03de1b399b..fc89be0b1c 100644
--- a/packages/dashboard-ui/src/spree/post-sale-fields.tsx
+++ b/packages/dashboard-ui/src/spree/post-sale-fields.tsx
@@ -33,7 +33,7 @@ export function QuantityPicker({
{units.map((unit) => (
<div
key={unit.id}
- className="flex items-center justify-between gap-4 rounded-lg border p-3"
+ className="flex items-center justify-between gap-4 rounded-lg border border-border-subtle p-3"
>
<span className="min-w-0 truncate text-sm">{unit.label}</span>
<Input
diff --git a/packages/dashboard-ui/src/styles.css b/packages/dashboard-ui/src/styles.css
index 2ab134778a..dded0b818b 100644
--- a/packages/dashboard-ui/src/styles.css
+++ b/packages/dashboard-ui/src/styles.css
@@ -100,57 +100,76 @@
stay light enough for --muted-foreground to clear 4.5:1 on it — which
leaves it at 1.04:1 against the page, invisible as a selection. Two
different jobs, two tokens. Nothing but near-black text lands on this
- one (15.7:1), so it is free to be darker. */
- --accent-strong: oklch(92.3% 0.003 48.717); /* stone-200 */
- /* Hover, one step under --accent-strong so a nav item has somewhere to go
- on hover *and* somewhere further to go when it is the active one. Stone
- has no step between 100 and 200, so this is interpolated on stone's hue
- rather than snapped — deliberate, like --border-control.
+ one, so it is free to be darker.
+
+ Interpolated on stone's hue rather than snapped to a step (like
+ --accent-hover and --border-control): stone-200 read heavier than a
+ selection needs to, and stone-100 is --accent itself, which would collapse
+ the two tokens into one and leave a hovered item darker than a selected
+ one. This sits between them. */
+ --accent-strong: oklch(94.7% 0.002 56);
+ /* Hover, between --accent and --accent-strong so a nav item has somewhere to
+ go on hover *and* somewhere further to go when it is the active one.
+ Interpolated on stone's hue rather than snapped — deliberate, like
+ --border-control.
--accent is too light to be a hover here: on the sidebar's ground (the
page colour, not a card) it measures 1.04:1, which is invisible. */
- --accent-hover: oklch(94.7% 0.002 56);
+ --accent-hover: oklch(95.9% 0.002 56);
/* The active item hovered. It darkens rather than lightening: a selected
- row that goes paler under the pointer reads as being deselected. */
- --accent-strong-hover: oklch(86.9% 0.005 56.366); /* stone-300 */
+ row that goes paler under the pointer reads as being deselected. Stays one
+ step under --accent-strong, or the two land on the same value and a
+ selected item stops responding to the pointer. */
+ --accent-strong-hover: oklch(92.3% 0.003 48.717); /* stone-200 */
--destructive: oklch(0.58 0.22 27); /* red-600 */
--destructive-foreground: var(--card);
/* The full-strength rule colour. Nothing styles with it directly — the two
tokens below are both a share of it, so neither compounds the other's
- reduction. */
+ reduction.
+
+ stone-200. This is the floor for a hairline: anything lighter stops
+ holding a container's edge on a white sheet, and the row rules of a long
+ table start to disappear before the frame around them does. */
--border-base: oklch(92.3% 0.003 48.717); /* stone-200 */
- /* A container's own edge. Legible but receding, so a dense table reads as
- rows of content rather than a grid. Carries its strength in the token, so
- call sites never restate it — an `/80` utility would compound to 64%. */
- --border: color-mix(in srgb, var(--border-base) 90%, transparent);
- /* Half-strength rule for dividers *inside* a container — card header/footer
- splits, dialog and sheet separators, table chrome. Half of the base, not
- of --border, so it is a true 50% rather than 40%. Resolved to a real
- colour rather than an opacity utility so it also works inside arbitrary
- values such as the sticky table header's inset shadow, where `/50` has no
- effect. */
+ /* A structural edge — the content sheet, a dialog, a dropdown, a popover, a
+ table's frame. These are surfaces that float above the page or divide it,
+ and their edge is what says where one ends and the next begins, so it
+ carries the base at full strength. Cards take --border-card instead.
+
+ Carries its strength in the token, so call sites never restate it — an
+ `/80` utility would compound on top of this. */
+ --border: var(--border-base);
+ /* A card's own edge. Softer than a structural one: a card is a region OF the
+ sheet rather than a surface floating above it, so its edge only has to
+ suggest where the region ends. Used by `CardContent`'s frame; a dialog or
+ the sheet itself must keep --border, or the shell loses its outline. */
+ --border-card: color-mix(in srgb, var(--border-base) 50%, transparent);
+ /* Dividers *inside* a container — card header/footer splits, dialog and
+ sheet separators, table row rules.
+
+ Half of the BASE, not of --border, so it is a true 50% rather than one
+ token compounding the other. The same value as --border-card, so a card's
+ edge and the rules dividing its contents are one hairline weight.
+
+ Resolved to a real colour rather than an opacity utility so it also works
+ inside arbitrary values such as the sticky table header's inset shadow,
+ where `/50` has no effect. */
--border-subtle: color-mix(in srgb, var(--border-base) 50%, transparent);
- /* Controls carry two different problems, so they take two different tokens.
- WCAG 1.4.11 asks 3:1 only of what is needed to *identify* a control — so
- what matters is whether the border is the only thing doing that job.
-
- --border-control: for a control with nothing else to identify it. A
- checkbox and a radio are a transparent 16px box; erase the outline and
- there is nothing on the page. 3.25:1 on the white card, 3.11:1 on the page
- ground — the lightest step that clears the minimum on both.
-
- --border-field: for a text field, select or combobox. These sit on a card
- of the same colour, so the border is what draws them — but a form of ten
- fields outlined at the control value reads as a wall of boxes. This lands
- between the two: firmer than the old rule, quiet enough to disappear into
- a dense form.
-
- A tinted fill was tried here and reverted. Disabled fields are `--muted`,
- so any resting tint either collides with that meaning or (as happened)
- lands darker than it and inverts the signal outright. On this palette the
- enabled state has to stay on the card colour. */
- --border-control: oklch(65% 0.01 56.259);
- --border-field: oklch(86.9% 0.005 56.366); /* stone-300 */
+ /* A mark that has to hold its own against the surface with nothing else
+ drawing it — the bar of a scrollbar, the focus ring the skip link draws.
+ WCAG 1.4.11 asks 3:1 of exactly that case: 3.25:1 on the white card,
+ 3.11:1 on the page ground, the lightest step that clears the minimum on
+ both.
+
+ No form control uses this. Fields, selects, comboboxes, checkboxes and
+ radios all take `--border` with `--shadow-xs`, the same pair the outline
+ button wears, so every bordered control on a card reads as one family.
+
+ A tinted fill on fields was tried and reverted. Disabled fields are
+ `--muted`, so any resting tint either collides with that meaning or (as
+ happened) lands darker than it and inverts the signal outright. On this
+ palette the enabled state has to stay on the card colour. */
+ --border-control: oklch(86.9% 0.005 56.366);
/* A card that *holds* other records — an order's fulfillments, its returns,
its claims — rather than holding content directly.
@@ -186,17 +205,19 @@
--chart-5: oklch(0.3358 0.118 257.1);
--radius: 0.75rem;
- /* Sidebar — the same surface as the page, not a band beside it. Every value
- points at the page token it matches rather than repeating it, so the two
- cannot drift apart. */
- --sidebar: var(--background);
+ /* Sidebar — the ground the content sheet is inset into, so it sits one step
+ back from the page rather than level with it. That difference is what
+ makes the sheet's rounded edge and shadow read at all: when the two were
+ the same colour the inset was invisible. Everything else still points at
+ the page token it matches, so the rest cannot drift. */
+ --sidebar: oklch(97% 0.001 106.424); /* stone-100 */
--sidebar-foreground: oklch(26.8% 0.007 34.298);
--sidebar-primary: var(--primary);
--sidebar-primary-foreground: var(--primary-foreground);
--sidebar-accent: var(--accent);
--sidebar-accent-foreground: var(--accent-foreground);
--sidebar-accent-strong: var(--accent-strong);
- --sidebar-accent-hover: var(--accent-hover);
+ --sidebar-accent-hover: var(--accent-strong);
--sidebar-accent-strong-hover: var(--accent-strong-hover);
/* Matches the rule the top bar draws, so every edge framing the shell —
the sidebar's, the top bar's, the settings header's — is one weight. */
@@ -271,14 +292,18 @@
--accent-hover: oklch(31% 0.008 34.298);
--accent-strong-hover: oklch(44.4% 0.011 73.639); /* stone-600 */
--destructive: oklch(0.704 0.191 22.216);
- --border-base: oklch(1 0 0 / 12%);
- --border: color-mix(in srgb, var(--border-base) 80%, transparent);
+ /* A white veil over whatever surface it crosses, so one value works on the
+ page ground and the raised sheet alike. Both shares below are half of it,
+ as in light mode, so a container's edge and the rules inside it are one
+ hairline weight. */
+ --border-base: oklch(1 0 0 / 16%);
+ --border: var(--border-base);
+ --border-card: color-mix(in srgb, var(--border-base) 50%, transparent);
--border-subtle: color-mix(in srgb, var(--border-base) 50%, transparent);
/* Light mode darkens the control edge away from the card; dark mode lightens
it. Not the light value inverted — measured on this theme's own surfaces:
3.22:1 on the card, 3.34:1 on the page ground. */
--border-control: oklch(52% 0.01 56.259);
- --border-field: oklch(32% 0.007 34.298);
/* Same arrangement as light — container at the page colour, records raised
above it. 1.118:1 between them here. Records take `--nested-raised` rather
than `--card`: the card token is a step above the page, which is where the
@@ -290,7 +315,11 @@
track. --muted is the step under --nested-raised. */
--track-recessed: var(--muted);
--input: color-mix(in srgb, var(--border-base) 80%, transparent);
- --ring: oklch(0.552 0.016 285); /* same blue ring as light, for focus parity */
+ /* The same blue as light mode, lifted for a dark ground. The previous value
+ was a near-grey (chroma 0.016) despite claiming parity, so a focused field
+ in dark mode drew a grey halo and lost the one signal that says "this is
+ where typing goes". */
+ --ring: oklch(0.68 0.19 258);
--link: oklch(0.7 0.16 258);
--link-hover: oklch(0.78 0.14 258);
--chart-1: oklch(0.809 0.105 251.813);
@@ -298,7 +327,10 @@
--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);
- --sidebar: var(--background);
+ /* One step back from the page, as in light mode — see the note there. Darker
+ rather than lighter: the sheet is the raised surface, so the ground behind
+ it recedes. */
+ --sidebar: oklch(14.7% 0.004 49.25); /* stone-950 */
--sidebar-foreground: var(--foreground);
--sidebar-primary: var(--primary);
--sidebar-primary-foreground: var(--primary-foreground);
@@ -354,8 +386,14 @@
--text-3xl: 1.75rem;
--text-4xl: 2rem;
- --shadow-xs: rgba(43, 34, 51, 0.05) 0px 1px 1px;
- --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
+ /* The resting lift on a control that sits ON a surface — a field, a button,
+ a card. Measured off a reference: the ground under a field's bottom edge
+ recovers over about 2px and nothing spreads above it or to the sides, so
+ this is purely directional, with no ambient layer. */
+ --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
+ /* The same lift, under its Tailwind-conventional name. Points at the token
+ above rather than repeating the value, so the two cannot drift. */
+ --shadow-sm: var(--shadow-xs);
--shadow-nav: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.04) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 1px 2px -1px, rgba(0, 0, 0, 0.02) 0px 2px 4px 0px;
/* Floating surfaces — menus, popovers, dialogs, sheets. Wide and faint
@@ -378,8 +416,19 @@
--radius-2xl: 1.125rem;
/* Sidebar + header tokens */
- --spacing-sidebar-width: 220px;
- --spacing-header-height: 58px;
+ --spacing-sidebar-width: 240px;
+ /* The offset pinned bands (a table's column row, the bulk-action bar) sit
+ below. There is no top bar, so the only chrome above the scrolling content
+ is a page's own `PageHeader` — which measures itself and overwrites this
+ at runtime. `0px` is therefore the honest default: it is what a page with
+ no header should use, and a non-zero constant here would strand the column
+ row that far down on every one of them. */
+ --spacing-header-height: 0px;
+ /* The height of a rail header row — the store/seller switcher, the settings
+ rail's title. A fixed constant, deliberately NOT the sticky offset above:
+ that one is measured and can legitimately be zero, which would collapse
+ these rows to nothing. */
+ --spacing-rail-header-height: 42px;
/* Easing. Overrides Tailwind's built-in `ease-out`, so every `ease-out`
utility in the app picks this up: the stock curve is too weak to read as
@@ -411,9 +460,9 @@
--color-ring: var(--ring);
--color-input: var(--input);
--color-border: var(--border);
+ --color-border-card: var(--border-card);
--color-border-subtle: var(--border-subtle);
--color-border-control: var(--border-control);
- --color-border-field: var(--border-field);
--color-card-container: var(--card-container);
--color-nested-raised: var(--nested-raised);
--color-track-recessed: var(--track-recessed);
@@ -476,7 +525,10 @@
/* Unified focus treatment — matches the form-input focus (soft blue glow,
no hard outline). Apply to buttons, links, menu triggers, and any other
interactive control so every focusable element looks the same on
- keyboard focus. Inputs/textarea/select keep their inline equivalent. */
+ keyboard focus. Text fields spell the same treatment out inline with a
+ `focus:` variant rather than `focus-visible:` — clicking into a field puts
+ the caret there, so it must show it owns the keyboard even when the focus
+ came from a pointer. */
outline: none;
&:focus-visible {
border-color: var(--ring);
@@ -557,6 +609,27 @@
}
}
+/* A bare `divide-y`/`divide-x` is a rule *inside* a container — a list's row
+ splits, a stacked set of fields — which is exactly what --border-subtle is
+ for.
+
+ Tailwind v4's divide utilities set only the border WIDTH on the children;
+ their colour comes from `border-color`, which the universal `*` rule in the
+ base layer sets to --border. This has to live in the `utilities` layer to
+ outrank that — layer order decides before specificity does — and has to
+ match the same children the utilities do.
+
+ The WHOLE selector goes inside `:where()`, not just the parent: `:not()`
+ carries the specificity of its argument, so leaving `:not(:last-child)`
+ outside gave this rule a pseudo-class's weight and let it beat an explicit
+ `divide-border` at the call site — the opposite of the intent. Inside
+ `:where()` the rule has zero specificity and any named colour wins. */
+@layer utilities {
+ :where(.divide-y > :not(:last-child), .divide-x > :not(:last-child)) {
+ border-color: var(--border-subtle);
+ }
+}
+
@layer base {
:root {
--scrollbar-thumb: oklch(86.9% 0.005 56.366); /* stone-300 */
@@ -705,7 +778,12 @@
html {
@apply font-sans antialiased;
text-rendering: optimizeLegibility;
- overflow-y: scroll;
+ /* No `overflow-y: scroll` here. It used to reserve the scrollbar gutter so
+ * the page would not jump sideways between a short route and a tall one,
+ * back when the document was what scrolled. The inset shell ended that:
+ * it is exactly viewport-height and scrolls inside itself, so the document
+ * can never overflow — and the reserved gutter became a permanently
+ * disabled second scrollbar sitting beside the sheet's real one. */
/* Clip horizontal overflow at the document root so wide tables on mobile
* can't widen the page. Must live on <html>, not <body>: `overflow-x:
* hidden` on body makes `overflow-y` compute to `auto`, turning body into
diff --git a/packages/dashboard-ui/src/ui/alert.tsx b/packages/dashboard-ui/src/ui/alert.tsx
index 2da6c7d838..ace6eedc62 100644
--- a/packages/dashboard-ui/src/ui/alert.tsx
+++ b/packages/dashboard-ui/src/ui/alert.tsx
@@ -49,7 +49,7 @@ function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {
<div
data-slot="alert-title"
className={cn(
- 'font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',
+ 'font-semibold group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/badge.tsx b/packages/dashboard-ui/src/ui/badge.tsx
index 23ad1c8084..6259e9696a 100644
--- a/packages/dashboard-ui/src/ui/badge.tsx
+++ b/packages/dashboard-ui/src/ui/badge.tsx
@@ -9,7 +9,7 @@ const badgeVariants = cva(
// specificity, so the one Tailwind emits last wins regardless of the order
// they appear in the class list — which silently erased the outline
// variant's border. Each variant states its own border colour instead.
- 'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow] duration-100 ease-out focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!',
+ 'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-sm border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow] duration-100 ease-out focus-visible:border-ring focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!',
{
variants: {
variant: {
diff --git a/packages/dashboard-ui/src/ui/button.tsx b/packages/dashboard-ui/src/ui/button.tsx
index b3f3662527..84ed429059 100644
--- a/packages/dashboard-ui/src/ui/button.tsx
+++ b/packages/dashboard-ui/src/ui/button.tsx
@@ -8,7 +8,10 @@ const buttonVariants = cva(
{
variants: {
variant: {
- default: 'bg-primary text-primary-foreground hover:bg-primary/85',
+ // `shadow-xs` like the outline and destructive variants: the primary
+ // action is the one thing on a page that should sit slightly above it,
+ // and it was the only variant with no lift at all.
+ default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/85',
outline:
'border-border bg-card shadow-xs text-foreground hover:bg-accent hover:text-foreground aria-expanded:bg-accent',
// `group-hover/row:` — inside a hovered table row the row already wears
diff --git a/packages/dashboard-ui/src/ui/card.tsx b/packages/dashboard-ui/src/ui/card.tsx
index 14314fd6fa..73515e77b8 100644
--- a/packages/dashboard-ui/src/ui/card.tsx
+++ b/packages/dashboard-ui/src/ui/card.tsx
@@ -37,11 +37,15 @@ function Card({
// rather than `hidden` so `overflow-y` stays `visible` and sticky
// descendants keep resolving against the page.
'group/card flex flex-col min-w-0 overflow-x-clip break-words text-card-foreground shadow-xs',
- variant === 'nested' && 'rounded-lg border border-border-subtle bg-nested-raised px-3',
+ variant === 'nested' &&
+ 'rounded-lg border border-border-subtle bg-nested-raised px-3 shadow-none',
// Holds nested records rather than content, so it recedes and lets
// them be the raised, readable thing.
- variant === 'container' && 'rounded-xl border border-border bg-card-container',
- variant === 'default' && 'rounded-xl border border-border bg-card',
+ variant === 'container' && 'rounded-xl border border-border-card bg-card-container',
+ // `--border-card`, not `--border`: a card is a region of the sheet
+ // rather than a surface floating above it, so its edge is softer than
+ // the structural one the sheet, dialogs and dropdowns draw.
+ variant === 'default' && 'rounded-xl border border-border-card bg-card',
className,
)}
{...props}
@@ -68,7 +72,7 @@ function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
data-slot="card-title"
// Same size and weight as SheetTitle and DialogTitle: a card, a sheet
// and a dialog heading are the same rank of thing.
- className={cn('text-base font-medium flex items-center gap-2', className)}
+ className={cn('text-base font-semibold flex items-center gap-2', className)}
{...props}
/>
)
diff --git a/packages/dashboard-ui/src/ui/checkbox.tsx b/packages/dashboard-ui/src/ui/checkbox.tsx
index 89b5e824b7..05358bb5ea 100644
--- a/packages/dashboard-ui/src/ui/checkbox.tsx
+++ b/packages/dashboard-ui/src/ui/checkbox.tsx
@@ -25,7 +25,7 @@ function Checkbox({
disabled={disabled}
name={name}
className={cn(
- 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-[4px] border border-border-control align-[-3px] outline-none transition-shadow',
+ 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-[4px] border border-border bg-card align-[-3px] outline-none transition-[color,background-color,border-color,box-shadow] duration-100 ease-out',
// The 16px box is the right *visual* size in a dense table, but on its
// own it is a 16px target — under the 24px WCAG 2.2 asks for, on the
// control every bulk action starts from. A pseudo-element extends the
@@ -34,12 +34,12 @@ function Checkbox({
// bridge, which would otherwise swallow presses in the padded margin
// and navigate instead of selecting.
"before:absolute before:inset-[-9px] before:z-1 before:content-['']",
- 'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50',
- 'disabled:cursor-not-allowed disabled:opacity-50',
+ 'focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]',
+ 'disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground',
'aria-invalid:border-destructive aria-invalid:ring-destructive/20',
'data-[checked]:border-blue-500 data-[checked]:bg-blue-500 data-[checked]:text-white',
'data-[indeterminate]:border-blue-500 data-[indeterminate]:bg-blue-500 data-[indeterminate]:text-white',
- 'dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[checked]:bg-blue-500',
+ 'dark:aria-invalid:ring-destructive/40 dark:data-[checked]:bg-blue-500',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/combobox.tsx b/packages/dashboard-ui/src/ui/combobox.tsx
index 69efd8249a..c7c6f20c75 100644
--- a/packages/dashboard-ui/src/ui/combobox.tsx
+++ b/packages/dashboard-ui/src/ui/combobox.tsx
@@ -43,18 +43,27 @@ function ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Tr
* Deliberately matches `<SelectTrigger>` so a picker sitting beside a plain
* select is indistinguishable from it until opened.
*/
-function ComboboxButtonTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props) {
+function ComboboxButtonTrigger({
+ className,
+ children,
+ size = 'default',
+ ...props
+}: ComboboxPrimitive.Trigger.Props & {
+ /** `sm` is the toolbar size — see `SelectTrigger`, which it matches exactly. */
+ size?: 'sm' | 'default'
+}) {
return (
<ComboboxPrimitive.Trigger
data-slot="combobox-button-trigger"
+ data-size={size}
className={cn(
- "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border-field bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "group/combobox-trigger flex w-full min-h-8 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-border bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground aria-invalid:border-destructive data-[size=sm]:shadow-xs data-[size=sm]:h-8 data-[size=sm]:min-h-8 data-[size=sm]:gap-2 data-[size=sm]:px-2 data-[size=sm]:py-1 data-[size=sm]:text-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className,
)}
{...props}
>
<span className="flex min-w-0 items-center gap-2 truncate">{children}</span>
- <ChevronDownIcon className="pointer-events-none size-4 shrink-0 text-muted-foreground" />
+ <ChevronDownIcon className="pointer-events-none size-4 shrink-0 text-muted-foreground group-data-[size=sm]/combobox-trigger:size-3.5" />
</ComboboxPrimitive.Trigger>
)
}
@@ -87,7 +96,7 @@ function ComboboxSearch({ className, ...props }: ComboboxPrimitive.Input.Props)
<ComboboxInput
data-slot="combobox-search"
className={cn(
- 'min-h-8.5 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:border-transparent has-[[data-slot=input-group-control]:focus-visible]:shadow-none',
+ 'min-h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:border-transparent has-[[data-slot=input-group-control]:focus-visible]:shadow-none',
className,
)}
autoComplete="off"
@@ -286,7 +295,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.5 rounded-lg border border-border-field bg-card text-foreground 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]:p-1.5',
+ 'flex flex-wrap items-center gap-1.5 rounded-md border border-border bg-card text-foreground 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]:p-1.5',
className,
)}
{...props}
@@ -314,7 +323,7 @@ function ComboboxChip({
// chip and a selected option are the same thing at two moments, so they
// read as the same thing. `bg-muted` sat within 1.03:1 of the field it
// sits on, which left the chips barely visible.
- 'flex min-h-8 w-fit max-w-full items-center justify-center gap-1 rounded-md bg-accent py-1 pl-2.5 pr-2 text-sm font-medium text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-1',
+ 'flex min-h-7 w-fit max-w-full items-center justify-center gap-1 rounded-sm bg-accent py-1 pl-2.5 pr-2 text-sm font-base text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-1',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/command.tsx b/packages/dashboard-ui/src/ui/command.tsx
index d2de5dd89b..f2954a21ba 100644
--- a/packages/dashboard-ui/src/ui/command.tsx
+++ b/packages/dashboard-ui/src/ui/command.tsx
@@ -179,7 +179,7 @@ function CommandItem({
<CommandPrimitive.Item
data-slot="command-item"
className={cn(
- "group/command-item relative flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent-strong data-selected:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-selected:*:[svg]:text-foreground",
+ "group/command-item relative flex cursor-pointer items-center gap-3 rounded-md px-3 py-2.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent-strong data-selected:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-selected:*:[svg]:text-foreground",
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/context-menu.tsx b/packages/dashboard-ui/src/ui/context-menu.tsx
index 8772390e43..2a985d2021 100644
--- a/packages/dashboard-ui/src/ui/context-menu.tsx
+++ b/packages/dashboard-ui/src/ui/context-menu.tsx
@@ -41,7 +41,7 @@ function ContextMenuContent({
className={cn(
// `origin-(--transform-origin)` so the menu grows out of the
// pointer rather than its own centre.
- 'z-50 max-h-[var(--available-height)] min-w-40 max-w-80 overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-popover p-1 text-popover-foreground shadow-lg origin-(--transform-origin) duration-100 ease-out data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:scale-95 transition-[opacity,transform,translate,scale]',
+ 'z-50 max-h-[var(--available-height)] min-w-40 max-w-80 overflow-x-hidden overflow-y-auto rounded-xl border border-border bg-popover p-1 text-popover-foreground shadow-lg origin-(--transform-origin) duration-100 ease-out data-[starting-style]:opacity-0 data-[starting-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:scale-95 transition-[opacity,transform,translate,scale]',
className,
)}
{...props}
@@ -68,7 +68,7 @@ function ContextMenuItem({
data-inset={inset}
data-variant={variant}
className={cn(
- "group/context-menu-item relative flex cursor-pointer 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",
+ "group/context-menu-item relative flex cursor-pointer items-center gap-3 rounded-lg 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}
diff --git a/packages/dashboard-ui/src/ui/data-table.tsx b/packages/dashboard-ui/src/ui/data-table.tsx
index c365c4dbc8..845fea4e41 100644
--- a/packages/dashboard-ui/src/ui/data-table.tsx
+++ b/packages/dashboard-ui/src/ui/data-table.tsx
@@ -7,6 +7,7 @@ import {
useEffect,
useLayoutEffect,
useRef,
+ useState,
} from 'react'
import { cn } from '../lib/utils'
@@ -38,6 +39,10 @@ interface TableProps extends React.ComponentProps<'table'> {
* header's own square corners otherwise sit on top of the card's radius and
* clip it — the mirror of the `roundedBottom` case, and unset by default
* because a table usually has a card header or some content above it.
+ *
+ * Applied from `sm` up, matching where a full-bleed table gains its frame:
+ * below that the table spans the page gutter with square edges, and curved
+ * header cells there would round nothing.
*/
roundedTop?: boolean
/**
@@ -84,6 +89,47 @@ function Table({
const scrollRef = useRef<HTMLDivElement | null>(null)
const bodyTableRef = useRef<HTMLTableElement | null>(null)
const pinnedTableRef = useRef<HTMLTableElement | null>(null)
+ const wrapperRef = useRef<HTMLDivElement | null>(null)
+ const [headerPinned, setHeaderPinned] = useState(false)
+ // Horizontal overflow, and whether the last column is already in view. The
+ // first decides whether the sticky scrollbar is worth showing at all; the
+ // second fades the right edge only while something is still hidden there.
+ const [overflowsX, setOverflowsX] = useState(false)
+ const [atRightEdge, setAtRightEdge] = useState(false)
+ // The proxy bar's inner width, so its thumb is the same size as the real
+ // scroller's would be.
+ const [tableWidth, setTableWidth] = useState(0)
+ const stickyBarRef = useRef<HTMLDivElement | null>(null)
+
+ // The header row is pinned once the wrapper's top has passed the band the row
+ // sticks to. Measured from the element's own rect on scroll rather than with
+ // an IntersectionObserver: the wrapper sits inside a clipped, internally
+ // scrolled sheet, where a zero-height sentinel never registers.
+ useEffect(() => {
+ if (!roundedTop) return
+ const wrapper = wrapperRef.current
+ if (!wrapper) return
+
+ // Whatever chrome sits above the scroll area publishes the band the row
+ // pins below — a page header, or nothing at all.
+ const stickyOffset = () =>
+ Number.parseFloat(
+ getComputedStyle(document.documentElement).getPropertyValue('--spacing-header-height'),
+ ) || 0
+
+ const update = () => setHeaderPinned(wrapper.getBoundingClientRect().top < stickyOffset())
+ update()
+
+ // Capture phase on the document: the scroll happens on some ancestor and
+ // scroll events do not bubble, so a listener on the element itself would
+ // never fire.
+ document.addEventListener('scroll', update, { capture: true, passive: true })
+ window.addEventListener('resize', update)
+ return () => {
+ document.removeEventListener('scroll', update, { capture: true })
+ window.removeEventListener('resize', update)
+ }
+ }, [roundedTop])
// Applied on the table so it reaches the last row's edge cells without
// every TableCell paying for the selector.
@@ -98,8 +144,11 @@ function Table({
// Both variants are written out in full rather than composed at runtime:
// Tailwind scans this file as text, so a class it never sees spelled out is
// a class it never generates.
+ // `sm:`, matching `roundedTop` and where a full-bleed table gains its frame:
+ // below that the table spans the page gutter with square edges, and rounded
+ // cells there would round nothing.
const alwaysRounded =
- '[&_tbody_tr:last-child_td:first-child]:rounded-bl-xl [&_tbody_tr:last-child_td:last-child]:rounded-br-xl [&_tbody_tr:last-child_td:only-child]:rounded-b-xl'
+ 'sm:[&_tbody_tr:last-child_td:first-child]:rounded-bl-xl sm:[&_tbody_tr:last-child_td:last-child]:rounded-br-xl sm:[&_tbody_tr:last-child_td:only-child]:rounded-b-xl'
// Applied to the outermost wrapper, not the table: `in-[:last-child]` is
// satisfied by *any* last-child ancestor, and the sticky variant nests two
// more divs that are both last inside it. Gating on the wrapper the
@@ -111,9 +160,17 @@ function Table({
// own position among its siblings.
// `thead` cells carry the header's background, so the radius belongs on the
// cells rather than the row — a rounded row still shows square cell corners.
- const topRounded = roundedTop
- ? '[&_thead_tr:first-child_th:first-child]:rounded-tl-xl [&_thead_tr:first-child_th:last-child]:rounded-tr-xl [&_thead_tr:first-child_th:only-child]:rounded-t-xl'
- : undefined
+ // The header row wears the frame's radius only while it is actually sitting
+ // in that corner. `data-header-pinned` on the wrapper (driven by the
+ // sentinel below) squares it off the moment the row pins, where a curve
+ // would read as a notch cut out of the rows.
+ // Dropped outright while pinned rather than overridden by a `rounded-none`
+ // class: the two utilities have identical specificity, so which one won came
+ // down to their order in the stylesheet — and the rounding did.
+ const topRounded =
+ roundedTop && !headerPinned
+ ? 'sm:[&_thead_tr:first-child_th:first-child]:rounded-tl-xl sm:[&_thead_tr:first-child_th:last-child]:rounded-tr-xl sm:[&_thead_tr:first-child_th:only-child]:rounded-t-xl'
+ : undefined
const tableRoundedClasses = cn(roundedBottom === true ? alwaysRounded : undefined, topRounded)
const wrapperRoundedClasses = roundedBottom === undefined ? roundedWhenLast : undefined
@@ -145,6 +202,43 @@ function Table({
return () => observer.disconnect()
}, [pinned])
+ // Track horizontal overflow so the edge fade and the sticky scrollbar only
+ // appear when the table actually has columns out of view — a table that fits
+ // gets neither, and pays nothing for them.
+ useEffect(() => {
+ if (!pinned) return
+ const scroller = scrollRef.current
+ const table = bodyTableRef.current
+ if (!scroller || !table) return
+ const measure = () => {
+ const max = scroller.scrollWidth - scroller.clientWidth
+ setOverflowsX(max > 1)
+ setAtRightEdge(scroller.scrollLeft >= max - 1)
+ setTableWidth(scroller.scrollWidth)
+ // Keep the proxy in step when the table is scrolled by any other means —
+ // a wheel, a keyboard, focusing a cell off-screen.
+ const bar = stickyBarRef.current
+ if (bar && bar.scrollLeft !== scroller.scrollLeft) bar.scrollLeft = scroller.scrollLeft
+ }
+ // Not measured inline: this effect runs in the frame `pinned` flips, when
+ // the scroller has only just been mounted and its `scrollWidth` still
+ // reads as its `clientWidth`. Measuring then records no overflow, and on a
+ // table whose columns never change size afterwards nothing would correct
+ // it. A frame later the layout is real.
+ const firstMeasure = requestAnimationFrame(measure)
+ scroller.addEventListener('scroll', measure, { passive: true })
+ // Both boxes: the columns can grow and the scroller can shrink, and either
+ // crosses the threshold on its own.
+ const observer = new ResizeObserver(measure)
+ observer.observe(scroller)
+ observer.observe(table)
+ return () => {
+ cancelAnimationFrame(firstMeasure)
+ scroller.removeEventListener('scroll', measure)
+ 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(() => {
@@ -196,7 +290,7 @@ function Table({
)
return (
- <div className={cn('relative min-w-0', wrapperRoundedClasses)}>
+ <div ref={wrapperRef} className={cn('relative min-w-0', wrapperRoundedClasses)}>
{/* 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. */}
@@ -207,7 +301,12 @@ function Table({
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">
+ <table
+ ref={pinnedTableRef}
+ data-pinned-header
+ className={tableClasses}
+ role="presentation"
+ >
{headerElement}
</table>
</div>
@@ -220,7 +319,14 @@ function Table({
ref={scrollRef}
// `@container/table-scroll`: the empty-state row sizes itself to this
// element's width rather than the viewport's.
- className="@container/table-scroll themed-scrollbar min-w-0 overflow-x-auto"
+ //
+ // `overflow-x: auto`, always. It computes `overflow-y` to `auto` as
+ // well, which makes this a scroll container that cannot scroll
+ // vertically — so Page Up/Down land here and do nothing while the
+ // pointer is over the table. `overflow-y: hidden` below takes that back
+ // without costing the horizontal scrollbar: reaching the last column is
+ // not negotiable, and `clip` loses it or squeezes the columns to fit.
+ className="@container/table-scroll themed-scrollbar min-w-0 overflow-x-auto overflow-y-hidden"
>
<table ref={bodyTableRef} className={tableClasses} {...props}>
{cloneElement(headerElement, {
@@ -246,6 +352,45 @@ function Table({
{kids.filter((kid) => kid !== headerElement)}
</table>
</div>
+
+ {/* Two halves of one answer to "there is more table to the right".
+ The fade says SO, without adding chrome: it sits over the right edge,
+ is purely decorative, and disappears the moment the last column is
+ reached. The bar below is how you GET there — a table's own scrollbar
+ sits at its bottom, which on a long list is far below the fold exactly
+ when a reader needs to know the table scrolls at all. */}
+ {overflowsX && (
+ <div
+ aria-hidden
+ className={cn(
+ 'pointer-events-none absolute top-0 bottom-0 right-0 w-12 transition-opacity duration-200 ease-out',
+ // Ends where the proxy bar begins, so the gradient does not wash
+ // over the bar's track and leave it half-visible at the right.
+ 'mb-3 bg-gradient-to-l from-card to-transparent',
+ atRightEdge ? 'opacity-0' : 'opacity-100',
+ )}
+ />
+ )}
+
+ {/* Mirrors the real scroller rather than replacing it: dragging this
+ writes `scrollLeft` on the table, and the table's own scroll writes
+ back. `sticky bottom-0` keeps it on screen for as long as any part of
+ the table is, so it is reachable from the first row rather than only
+ from the last. */}
+ {overflowsX && (
+ <div
+ ref={stickyBarRef}
+ onScroll={(event) => {
+ const scroller = scrollRef.current
+ if (scroller) scroller.scrollLeft = event.currentTarget.scrollLeft
+ }}
+ // `translate-y-px` tucks it against the frame's bottom edge rather
+ // than floating a hairline above it.
+ className="themed-scrollbar sticky bottom-0 z-10 -mt-3 translate-y-px overflow-x-auto overflow-y-hidden"
+ >
+ <div style={{ width: tableWidth, height: 1 }} />
+ </div>
+ )}
</div>
)
}
diff --git a/packages/dashboard-ui/src/ui/date-picker.tsx b/packages/dashboard-ui/src/ui/date-picker.tsx
index 0cba0005ce..37eb4c7cc9 100644
--- a/packages/dashboard-ui/src/ui/date-picker.tsx
+++ b/packages/dashboard-ui/src/ui/date-picker.tsx
@@ -218,7 +218,7 @@ function DatePicker({
aria-haspopup="dialog"
aria-expanded={open}
onClick={() => setOpen((v) => !v)}
- className="w-full justify-start"
+ className="w-full justify-start shadow-none"
>
{triggerChildren}
</Button>
diff --git a/packages/dashboard-ui/src/ui/input-group.tsx b/packages/dashboard-ui/src/ui/input-group.tsx
index 0a0c12c53a..e42567c8d1 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-field bg-card text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:shadow-none has-disabled:bg-muted has-disabled:cursor-not-allowed has-disabled:text-muted-foreground has-disabled:shadow-none has-[[data-slot=input-group-control]:focus-visible]:border-blue-500 has-[[data-slot=input-group-control]:focus-visible]:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-[[data-slot][aria-invalid=true]]:border-destructive has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
+ 'group/input-group relative flex w-full min-w-0 items-center rounded-md border border-border bg-card text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:shadow-none has-disabled:bg-muted has-disabled:cursor-not-allowed has-disabled:text-muted-foreground 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 fbb75361f4..6a9e3c6790 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-field bg-card py-1.5 px-2.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',
+ 'block w-full min-w-0 min-h-8 rounded-md border border-border bg-card py-1.5 px-2.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground 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 4c730ad031..83db4b66d5 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-subtle pr-3 pl-4 py-2">
+ <div className="flex items-center justify-between ps-2 py-2">
<div className="whitespace-nowrap text-sm text-muted-foreground">
{t('admin.components.pagination.range', {
from: meta.from,
diff --git a/packages/dashboard-ui/src/ui/radio-group.tsx b/packages/dashboard-ui/src/ui/radio-group.tsx
index ce200c9d0f..75503d58a7 100644
--- a/packages/dashboard-ui/src/ui/radio-group.tsx
+++ b/packages/dashboard-ui/src/ui/radio-group.tsx
@@ -18,12 +18,12 @@ function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof Rad
<RadioPrimitive.Root
data-slot="radio-group-item"
className={cn(
- 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-full border border-border-control align-[-3px] shadow-xs outline-none transition-shadow',
- 'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50',
- 'disabled:cursor-not-allowed disabled:opacity-50',
+ 'peer relative inline-block size-4 shrink-0 cursor-pointer rounded-full border border-border bg-card align-[-3px] outline-none transition-[color,background-color,border-color,box-shadow] duration-100 ease-out',
+ 'focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]',
+ 'disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground',
'aria-invalid:border-destructive aria-invalid:ring-destructive/20',
'data-[checked]:border-blue-500 data-[checked]:bg-blue-500 data-[checked]:text-white',
- 'dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[checked]:bg-blue-500',
+ 'dark:aria-invalid:ring-destructive/40 dark:data-[checked]:bg-blue-500',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/rich-text-editor.tsx b/packages/dashboard-ui/src/ui/rich-text-editor.tsx
index d43a35c9de..4fee3ea46e 100644
--- a/packages/dashboard-ui/src/ui/rich-text-editor.tsx
+++ b/packages/dashboard-ui/src/ui/rich-text-editor.tsx
@@ -177,8 +177,13 @@ export function RichTextEditor({
ref={wrapperRef}
data-slot="rich-text-editor"
className={cn(
- 'rounded-lg border border-border-field bg-card text-foreground 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',
+ // The same shell as `<Input>` and `<Textarea>` — border, fill, resting
+ // shadow, transition and focus treatment — so a description field sits
+ // in a form beside them without reading as a different kind of control.
+ // `focus-within` rather than `focus`: the element that takes the caret
+ // is Tiptap's inner contenteditable, not this wrapper.
+ 'rounded-md border border-border bg-card text-foreground 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 text-muted-foreground shadow-none',
className,
)}
>
diff --git a/packages/dashboard-ui/src/ui/select.tsx b/packages/dashboard-ui/src/ui/select.tsx
index d89339ec0c..9cfc911ed6 100644
--- a/packages/dashboard-ui/src/ui/select.tsx
+++ b/packages/dashboard-ui/src/ui/select.tsx
@@ -54,19 +54,26 @@ function SelectTrigger({
data-slot="select-trigger"
data-size={size}
className={cn(
- // `min-h-9.5` (default) and `data-[size=sm]:min-h-[1.9375rem]` lock
- // the trigger to the same natural height as `<Input>` so the field
- // doesn't collapse to chevron-height when the SelectValue render-prop
- // returns an empty string (e.g., when value is unset and the
- // placeholder isn't surfaced through the render-prop).
- "flex w-full min-h-8.5 cursor-pointer items-center justify-between gap-1.5 rounded-lg border border-border-field bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-all duration-100 ease-in-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive data-[placeholder]:text-muted-foreground data-[size=sm]:py-1 data-[size=sm]:px-2 data-[size=sm]:text-sm data-[size=sm]:min-h-[1.9375rem] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ // `min-h-8` matches `<Input>`'s own minimum, so a select and a text
+ // field on the same row are the same height. It also stops the trigger
+ // collapsing to chevron-height when the SelectValue render-prop returns
+ // an empty string (value unset and the placeholder not surfaced through
+ // the render-prop); `data-[size=sm]` keeps its own floor for the same
+ // reason.
+ //
+ // `sm` is the toolbar size, matching `Button size="sm" variant="outline"`
+ // exactly — height, gap, padding, text, icon size and the resting lift.
+ // A row mixing a select with a popover trigger (the dashboard's channel
+ // picker beside its date range) then reads as one set of controls
+ // rather than two. The default size is a form field and stays flat.
+ "group/select-trigger flex w-full min-h-8 cursor-pointer items-center justify-between gap-1.5 rounded-md border border-border bg-card py-1.5 pr-2 pl-2.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none select-none focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground aria-invalid:border-destructive data-[placeholder]:text-muted-foreground data-[size=sm]:shadow-xs data-[size=sm]:h-8 data-[size=sm]:min-h-8 data-[size=sm]:gap-2 data-[size=sm]:px-2 data-[size=sm]:py-1 data-[size=sm]:text-sm data-[size=sm]:[&_svg:not([class*='size-'])]:size-3.5 *: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}
>
{children}
<SelectPrimitive.Icon>
- <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
+ <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground group-data-[size=sm]/select-trigger:size-3.5" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
)
diff --git a/packages/dashboard-ui/src/ui/sheet.tsx b/packages/dashboard-ui/src/ui/sheet.tsx
index c5c512ef71..a86661b202 100644
--- a/packages/dashboard-ui/src/ui/sheet.tsx
+++ b/packages/dashboard-ui/src/ui/sheet.tsx
@@ -3,6 +3,7 @@
import { Dialog as SheetPrimitive } from '@base-ui/react/dialog'
import i18n from 'i18next'
import * as React from 'react'
+import { useScrolled } from '../hooks/use-scrolled'
import { cn } from '../lib/utils'
import { XIcon } from '../spree/icons'
import { Button } from './button'
@@ -162,6 +163,11 @@ function SheetContent({
)
}
+/**
+ * A sheet's title bar. It keeps its separating rule at all times and gains a
+ * soft lift once the body scrolls under it, on the same trigger and curve as
+ * `PageHeader`.
+ */
function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
// A caller passing `sr-only` wants the title announced but not drawn. Merging
// it with the visible chrome does not achieve that: `cn` keeps `flex` (a
@@ -169,13 +175,26 @@ function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
// a laid-out box — a 33px bar with a border, above the nav. Detect the intent
// and render the bare utility instead.
const srOnly = className?.split(' ').includes('sr-only')
+ // Hooks cannot be called conditionally, so this reads the flag before the
+ // early return even though the bare variant never uses it.
+ const scrolled = useScrolled()
if (srOnly) return <div data-slot="sheet-header" className={className} {...props} />
return (
<div
data-slot="sheet-header"
className={cn(
- 'relative flex flex-col gap-1.5 border-b border-border-subtle p-4 pr-12',
+ // No `z-index` here: the close button is a sibling rendered BEFORE this,
+ // so any stacking context on the header paints over it and swallows the
+ // clicks. The header needs no lift anyway — it is a flex sibling of the
+ // body rather than an overlay, so nothing scrolls under it.
+ 'flex shrink-0 flex-col gap-1.5 border-b border-border-subtle p-4 pr-12',
+ // The rule stays: a sheet header is a fixed band over its own scroller,
+ // so it is divided from the body whether or not anything has moved. The
+ // lift is what scrolling adds, on the same trigger and curve as
+ // `PageHeader`.
+ 'transition-shadow duration-200 ease-out motion-reduce:transition-none',
+ scrolled && 'shadow-xs',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/sidebar.tsx b/packages/dashboard-ui/src/ui/sidebar.tsx
index 78590329a3..88c287ff8f 100644
--- a/packages/dashboard-ui/src/ui/sidebar.tsx
+++ b/packages/dashboard-ui/src/ui/sidebar.tsx
@@ -14,10 +14,10 @@ import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip'
const SIDEBAR_COOKIE_NAME = 'sidebar_state'
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
-const SIDEBAR_WIDTH = '220px'
+const SIDEBAR_WIDTH = '240px'
/**
* Width of any nav drawer on a phone: near-full-width, capped so it doesn't
- * stretch on a tablet. The desktop rail's 220px leaves ~45% of a phone screen
+ * stretch on a tablet. The desktop rail's width leaves ~40% of a phone screen
* unused while still cramping the labels. Exported so a second drawer (the
* settings nav sheet) matches this one instead of re-inlining the number.
*/
@@ -173,7 +173,11 @@ function SidebarProvider({
} as React.CSSProperties
}
className={cn(
- 'group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar',
+ // `h-svh` + `overflow-hidden`, not `min-h-svh`: an inset shell scrolls
+ // inside its own sheet, so the wrapper must be exactly the viewport
+ // and never let the document scroll behind it.
+ 'group/sidebar-wrapper flex w-full has-data-[variant=inset]:h-svh has-data-[variant=inset]:overflow-hidden has-data-[variant=inset]:bg-sidebar',
+ 'not-has-data-[variant=inset]:min-h-svh',
className,
)}
{...props}
@@ -281,7 +285,7 @@ function Sidebar({
<div
data-sidebar="sidebar"
data-slot="sidebar-inner"
- className="flex size-full flex-col bg-sidebar border-e border-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border"
+ className="flex size-full flex-col bg-sidebar group-data-[variant=sidebar]:border-e group-data-[variant=sidebar]:border-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border"
>
{children}
</div>
@@ -299,7 +303,7 @@ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<t
data-slot="sidebar-trigger"
variant="ghost"
size="icon-sm"
- className={cn(className)}
+ className={cn('hover:bg-accent-strong-hover', className)}
onClick={(event) => {
onClick?.(event)
toggleSidebar()
@@ -354,7 +358,10 @@ function SidebarInset({ className, id = 'main-content', ...props }: React.Compon
// 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',
+ // The inset sheet is the raised surface, so it takes the card colour —
+ // pure white in light mode — rather than the page grey, which is now the
+ // ground the rail sits on.
+ 'relative z-0 flex w-full min-w-0 flex-1 flex-col bg-background md:peer-data-[variant=inset]:bg-card 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]:border md:peer-data-[variant=inset]:border-sidebar-border md:peer-data-[variant=inset]:shadow-sm',
className,
)}
{...props}
@@ -381,7 +388,7 @@ function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>) {
className={cn(
// In the drawer the switcher is the only thing above the nav, so it
// needs a rule under it to read as a header rather than a first row.
- 'flex flex-col gap-0 px-2 in-data-[mobile=true]:border-b in-data-[mobile=true]:border-border-subtle in-data-[mobile=true]:pb-2 group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:items-center',
+ 'flex flex-col gap-3 px-2 in-data-[mobile=true]:border-b in-data-[mobile=true]:border-border-subtle in-data-[mobile=true]:pb-2 group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:items-center',
className,
)}
{...props}
@@ -395,7 +402,7 @@ function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {
data-slot="sidebar-footer"
data-sidebar="footer"
className={cn(
- 'flex flex-col gap-0 p-2 mt-auto border-t border-border group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:items-center',
+ 'flex flex-col gap-0 p-2 mt-auto border-t border-border-subtle group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:items-center',
className,
)}
{...props}
@@ -420,7 +427,7 @@ function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
data-slot="sidebar-content"
data-sidebar="content"
className={cn(
- 'no-scrollbar flex min-h-0 flex-1 flex-col gap-0 pt-2 overflow-auto group-data-[collapsible=icon]:overflow-visible',
+ 'no-scrollbar flex min-h-0 flex-1 flex-col gap-0 pt-3 overflow-auto group-data-[collapsible=icon]:overflow-visible',
className,
)}
{...props}
@@ -434,7 +441,7 @@ function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
data-slot="sidebar-group"
data-sidebar="group"
className={cn(
- 'relative flex w-full min-w-0 flex-col px-3 py-0 group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:items-center',
+ 'relative flex w-full min-w-0 flex-col px-2 py-0 group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:items-center',
className,
)}
{...props}
@@ -526,7 +533,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-lg 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 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-hover data-open:hover:text-sidebar-foreground data-active:bg-sidebar-accent-strong data-active:hover:bg-sidebar-accent-strong-hover 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-md p-1 text-left font-medium text-base text-sidebar-foreground/80 outline-hidden transition-[color,background-color,border-color,box-shadow] 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 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-hover data-open:hover:text-sidebar-foreground data-active:bg-accent-strong data-active:text-foreground data-active:font-semibold data-active:hover:bg-accent-strong-hover [&>span:last-child]:truncate',
{
variants: {
variant: {
@@ -627,13 +634,31 @@ function SidebarMenuAction({
)
}
+/**
+ * A count or progress marker on a nav item — "3" beside Orders, "2/6" beside
+ * Getting Started.
+ *
+ * Its own component rather than the page's `Badge`: this one sits on the rail
+ * rather than on a card, so it takes the sidebar's foreground token and follows
+ * the item it belongs to (brightening with the label on hover, going full
+ * strength when the item is active). A page badge on a nav row keeps the card
+ * palette and stays the same colour while everything around it moves.
+ *
+ * Rendered inline, at the end of the item's own row — not absolutely positioned
+ * like shadcn's original, which assumed a badge placed as a sibling of the
+ * button rather than inside its link.
+ */
function SidebarMenuBadge({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="sidebar-menu-badge"
data-sidebar="menu-badge"
className={cn(
- 'pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none 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 peer-data-active/menu-button:text-sidebar-accent-foreground',
+ 'pointer-events-none flex h-5 min-w-5 shrink-0 items-center justify-center rounded-md border border-sidebar-border px-1.5 text-[11px] font-medium text-sidebar-foreground/70 tabular-nums select-none',
+ 'transition-colors duration-100 ease-out group-data-[collapsible=icon]:hidden',
+ // Follows its own row: brighter under the pointer, full strength when
+ // the item is the active one.
+ 'group-hover/menu-button:text-sidebar-foreground group-data-active/menu-button:text-foreground',
className,
)}
{...props}
@@ -719,7 +744,7 @@ function SidebarMenuSubButton({
data-size={size}
data-active={isActive}
className={cn(
- 'relative flex h-7 in-data-[mobile=true]:h-11 in-data-[mobile=true]:px-2 min-w-0 items-center gap-2 overflow-hidden rounded-lg p-1 text-sidebar-foreground/80 outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent-hover 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',
+ 'relative flex h-7 in-data-[mobile=true]:h-11 in-data-[mobile=true]:px-2 min-w-0 items-center gap-2 overflow-hidden rounded-lg p-1 font-medium text-sidebar-foreground/80 outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent-hover 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 7dfc907e82..3b2a22ed8b 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-field bg-card px-2.5 py-1.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground disabled:shadow-none aria-invalid:border-destructive',
+ 'flex field-sizing-content min-h-16 w-full rounded-md border border-border bg-card px-2.5 py-1.5 text-base font-normal leading-normal text-foreground transition-[color,background-color,border-color,box-shadow] duration-100 ease-out outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground aria-invalid:border-destructive',
className,
)}
{...props}
diff --git a/packages/dashboard/e2e/command-palette.spec.ts b/packages/dashboard/e2e/command-palette.spec.ts
index 7d56fb97a7..1870bf6dab 100644
--- a/packages/dashboard/e2e/command-palette.spec.ts
+++ b/packages/dashboard/e2e/command-palette.spec.ts
@@ -5,8 +5,9 @@ import { login } from './helpers'
// store home rather than navigating somewhere specific first.
async function openPalette(page: Page, storeId: string) {
await page.goto(`/${storeId}`)
- await page.getByRole('button', { name: /search products, orders, customers/i }).click()
- // Scoped to the dialog: the top-bar trigger carries the same placeholder text.
+ await page.getByRole('button', { name: /search anything/i }).click()
+ // Scoped to the dialog: the sidebar trigger and the palette's own input both
+ // carry search text, so an unscoped lookup would match two elements.
const input = page.getByRole('dialog').getByRole('combobox')
await expect(input).toBeVisible({ timeout: 15_000 })
return input
@@ -18,9 +19,9 @@ test.describe('command palette', () => {
await page.goto(`/${creds.store_id}`)
// The shortcut is bound after the shell mounts, so wait for the trigger to
// appear — pressing earlier lands before the listener exists.
- await expect(
- page.getByRole('button', { name: /search products, orders, customers/i }),
- ).toBeVisible({ timeout: 15_000 })
+ await expect(page.getByRole('button', { name: /search anything/i })).toBeVisible({
+ timeout: 15_000,
+ })
// The binding is `Mod+K`, which the hotkey library resolves against the
// browser's platform rather than the host's. Try both modifiers so the
diff --git a/packages/dashboard/e2e/products-helpers.ts b/packages/dashboard/e2e/products-helpers.ts
index 8ea346d1ed..754f4232ff 100644
--- a/packages/dashboard/e2e/products-helpers.ts
+++ b/packages/dashboard/e2e/products-helpers.ts
@@ -117,9 +117,9 @@ export const mediaCard = (page: Page) => card(page, /^Media$/)
* Act on the first media thumbnail: clicking a tile opens its edit sheet, and
* every other action lives in the tile's right-click menu.
*
- * Scrolls the Media card below the sticky TopBar + PageHeader stack first —
- * restoring sticky headers (PR #14218) made Playwright's default
- * scroll-into-view land the tile under the header chrome.
+ * Scrolls the Media card clear of the sticky PageHeader first — restoring
+ * sticky headers (PR #14218) made Playwright's default scroll-into-view land
+ * the tile under the header chrome.
*/
export async function clickMediaThumbnailAction(
media: Locator,
@@ -130,17 +130,40 @@ export async function clickMediaThumbnailAction(
const thumb = media.locator('[data-slot="media-thumbnail"]').first()
await thumb.scrollIntoViewIfNeeded()
- // Keep the card below the stacked sticky TopBar + PageHeader. Playwright's
- // default click scrolls the target back into view, so we force-click after
- // positioning — otherwise the header chrome intercepts pointer events.
+ // Keep the card below the sticky PageHeader. Playwright's default click
+ // scrolls the target back into view, so we force-click after positioning —
+ // otherwise the header chrome intercepts pointer events.
+ //
+ // The header publishes its own measured height into this variable, so read
+ // it rather than assuming one: it is the whole of the sticky chrome now that
+ // there is no top bar above it.
+ //
+ // Scroll the sheet, not the window. The inset shell is exactly viewport
+ // height and scrolls inside itself, so the document cannot scroll at all and
+ // `window.scrollBy` moves nothing — the tile would stay under the header.
await media.evaluate((el) => {
const headerHeight =
Number.parseFloat(
getComputedStyle(document.documentElement).getPropertyValue('--spacing-header-height'),
- ) || 58
- const stickyOffset = headerHeight * 2 + 24
+ ) || 0
+ const stickyOffset = headerHeight + 24
const top = el.getBoundingClientRect().top
- if (top < stickyOffset) window.scrollBy(0, top - stickyOffset)
+ if (top >= stickyOffset) return
+
+ const delta = top - stickyOffset
+ // Nearest scrollable ancestor: the shell's sheet in the new layout, and
+ // the document in any context that still scrolls that way.
+ let node: HTMLElement | null = el.parentElement
+ while (node) {
+ const style = getComputedStyle(node)
+ const scrolls = /auto|scroll/.test(style.overflowY)
+ if (scrolls && node.scrollHeight > node.clientHeight) {
+ node.scrollTop += delta
+ return
+ }
+ node = node.parentElement
+ }
+ window.scrollBy(0, delta)
})
if (action === 'edit') {
diff --git a/packages/dashboard/src/components/spree/categories/category-list.tsx b/packages/dashboard/src/components/spree/categories/category-list.tsx
index 1de89a86a0..2936887209 100644
--- a/packages/dashboard/src/components/spree/categories/category-list.tsx
+++ b/packages/dashboard/src/components/spree/categories/category-list.tsx
@@ -37,7 +37,7 @@ export function CategoryList({
const { permissions } = usePermissions()
return (
- <Table>
+ <Table roundedTop roundedBottom>
<TableHeader>
<TableRow>
<TableHead>{t('admin.categories.columns.name')}</TableHead>
diff --git a/packages/dashboard/src/components/spree/categories/category-tree.tsx b/packages/dashboard/src/components/spree/categories/category-tree.tsx
index af347dd5dc..a3d04ff1b6 100644
--- a/packages/dashboard/src/components/spree/categories/category-tree.tsx
+++ b/packages/dashboard/src/components/spree/categories/category-tree.tsx
@@ -132,7 +132,7 @@ export function CategoryTree({
onDragEnd={handleDragEnd}
onDragCancel={reset}
>
- <Table>
+ <Table roundedTop roundedBottom>
<TableHeader>
<TableRow>
<TableHead className="w-8" />
diff --git a/packages/dashboard/src/components/spree/channel-select.tsx b/packages/dashboard/src/components/spree/channel-select.tsx
index e38546845a..e1f2c4a799 100644
--- a/packages/dashboard/src/components/spree/channel-select.tsx
+++ b/packages/dashboard/src/components/spree/channel-select.tsx
@@ -20,6 +20,8 @@ interface ChannelSelectProps {
allOption?: boolean
/** Extra classes for the trigger (e.g. a width constraint in toolbars). */
triggerClassName?: string
+ /** `sm` matches the toolbar controls beside it — see `SelectTrigger`. */
+ triggerSize?: 'sm' | 'default'
disabled?: boolean
}
@@ -39,6 +41,7 @@ export function ChannelSelect({
placeholder,
allOption,
triggerClassName,
+ triggerSize,
disabled,
}: ChannelSelectProps) {
const { t } = useTranslation()
@@ -54,7 +57,7 @@ export function ChannelSelect({
<>
{name && <input type="hidden" name={name} value={value ?? ''} />}
<Select value={value ?? ''} onValueChange={(v) => onChange?.(v)} disabled={disabled}>
- <SelectTrigger id={id} className={triggerClassName}>
+ <SelectTrigger id={id} size={triggerSize} className={triggerClassName}>
{/* Base UI's `<SelectValue>` defaults to rendering the raw `value`
(the prefixed ID). Use the children render-prop to look up the
name from our cached list so the trigger matches the items. */}
diff --git a/packages/dashboard/src/components/spree/collections/collection-rules-card.tsx b/packages/dashboard/src/components/spree/collections/collection-rules-card.tsx
index 0333ea153a..a9e48bbf3e 100644
--- a/packages/dashboard/src/components/spree/collections/collection-rules-card.tsx
+++ b/packages/dashboard/src/components/spree/collections/collection-rules-card.tsx
@@ -128,7 +128,7 @@ export function CollectionRulesCard({ form }: { form: UseFormReturn<CollectionFo
{rules.fields.map((ruleField, index) => (
<div
key={ruleField.id}
- className="flex flex-col gap-3 rounded-lg border border-border p-3 sm:flex-row sm:items-start"
+ className="flex flex-col gap-3 rounded-lg border border-border-subtle p-3 sm:flex-row sm:items-start"
>
<Field className="flex-1">
<FieldLabel className="sr-only">
diff --git a/packages/dashboard/src/components/spree/command-palette/command-palette.tsx b/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
index 747bee80a9..c4415d6eca 100644
--- a/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
+++ b/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
@@ -127,7 +127,7 @@ function CommandPaletteContent({ setOpen }: { setOpen: (open: boolean) => void }
// here rather than duplicated in both branches of the list below.
const gotoGroup =
gotoItems.length > 0 ? (
- <CommandGroup heading={t('admin.components.command_palette.goto')}>
+ <CommandGroup>
{gotoItems.map(({ key, label, icon: Icon, url }) => (
<CommandItem
key={key}
diff --git a/packages/dashboard/src/components/spree/enterprise-upsell.tsx b/packages/dashboard/src/components/spree/enterprise-upsell.tsx
index 6be91308dc..51e6515abb 100644
--- a/packages/dashboard/src/components/spree/enterprise-upsell.tsx
+++ b/packages/dashboard/src/components/spree/enterprise-upsell.tsx
@@ -1,5 +1,5 @@
-import { Alert, AlertDescription, AlertTitle } from '@spree/dashboard-ui'
-import { ExternalLinkIcon, SparklesIcon } from '@spree/dashboard-ui/icons'
+import { Alert, AlertDescription, AlertTitle, ExternalLink } from '@spree/dashboard-ui'
+import { SparklesIcon } from '@spree/dashboard-ui/icons'
import { useTranslation } from 'react-i18next'
export const SPREE_ENTERPRISE_URL = 'https://spreecommerce.org/enterprise/'
@@ -26,15 +26,14 @@ export function EnterpriseUpsell({
<AlertTitle>{title}</AlertTitle>
<AlertDescription className="flex flex-col items-start gap-1.5">
{description}
- <a
+ {/* `text-current`: inside an Alert the link inherits the alert's own
+ tone rather than the link blue, which would fight it. */}
+ <ExternalLink
href={SPREE_ENTERPRISE_URL}
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex items-center gap-1 font-medium text-current underline underline-offset-3"
+ className="font-medium text-current underline underline-offset-3"
>
{t('admin.enterprise.learn_more')}
- <ExternalLinkIcon className="size-3.5" />
- </a>
+ </ExternalLink>
</AlertDescription>
</Alert>
)
diff --git a/packages/dashboard/src/components/spree/getting-started-nav-badge.tsx b/packages/dashboard/src/components/spree/getting-started-nav-badge.tsx
index fce9ee4884..97005249f1 100644
--- a/packages/dashboard/src/components/spree/getting-started-nav-badge.tsx
+++ b/packages/dashboard/src/components/spree/getting-started-nav-badge.tsx
@@ -1,5 +1,5 @@
import { useStore } from '@spree/dashboard-core'
-import { Badge } from '@spree/dashboard-ui'
+import { SidebarMenuBadge } from '@spree/dashboard-ui'
// Progress counter next to the Getting Started nav entry, mirroring the
// legacy admin's "n/m" badge. Hidden once every task is done.
@@ -11,9 +11,9 @@ export function GettingStartedNavBadge() {
if (tasks.length === 0 || done === tasks.length) return null
return (
- <Badge variant="outline" className="rounded-lg mr-1 flex items-center gap-0">
+ <SidebarMenuBadge>
<span>{done}</span>
<span className="opacity-50">/{tasks.length}</span>
- </Badge>
+ </SidebarMenuBadge>
)
}
diff --git a/packages/dashboard/src/components/spree/nav-counter-badge.tsx b/packages/dashboard/src/components/spree/nav-counter-badge.tsx
index 928298c8c9..1dc3c50309 100644
--- a/packages/dashboard/src/components/spree/nav-counter-badge.tsx
+++ b/packages/dashboard/src/components/spree/nav-counter-badge.tsx
@@ -1,4 +1,4 @@
-import { Badge } from '@spree/dashboard-ui'
+import { SidebarMenuBadge } from '@spree/dashboard-ui'
import { useDashboardCounters } from '../../hooks/use-dashboard-counters'
/**
@@ -23,10 +23,6 @@ export function navCounterBadge(...navKeys: string[]) {
if (total === 0) return null
- return (
- <Badge variant="outline" className="rounded-lg mr-1">
- {total}
- </Badge>
- )
+ return <SidebarMenuBadge>{total}</SidebarMenuBadge>
}
}
diff --git a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
index 0bf9315491..e373c71961 100644
--- a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
+++ b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
@@ -366,7 +366,7 @@ function CreateFulfillmentDialog({
{units.map((unit) => (
<div
key={unit.itemId}
- className="flex items-center justify-between gap-4 rounded-lg border p-3"
+ className="flex items-center justify-between gap-4 rounded-lg border border-border-subtle p-3"
>
<span className="text-sm truncate">{unit.label}</span>
<Input
diff --git a/packages/dashboard/src/components/spree/orders/shipping-documents.tsx b/packages/dashboard/src/components/spree/orders/shipping-documents.tsx
index 33c7358f81..c7589277d0 100644
--- a/packages/dashboard/src/components/spree/orders/shipping-documents.tsx
+++ b/packages/dashboard/src/components/spree/orders/shipping-documents.tsx
@@ -29,7 +29,7 @@ export function ShippingDocuments({
key={document.url}
href={document.url}
target="_blank"
- rel="noreferrer"
+ rel="noopener noreferrer"
className="flex items-center gap-2 text-sm text-primary hover:underline"
>
<FileTextIcon className="size-4 shrink-0" />
diff --git a/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx b/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
index 729c3b5277..dddf5641b8 100644
--- a/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
+++ b/packages/dashboard/src/components/spree/post-sale-create-dialogs.tsx
@@ -175,7 +175,10 @@ export function CreateExchangeDialog({
</DialogHeader>
<DialogBody className="flex flex-col gap-4">
{units.map((unit) => (
- <div key={unit.id} className="flex flex-col gap-2 rounded-lg border p-3">
+ <div
+ key={unit.id}
+ className="flex flex-col gap-2 rounded-lg border border-border-subtle p-3"
+ >
<div className="flex items-center justify-between gap-4">
<span className="text-sm truncate">{unit.label}</span>
<Input
diff --git a/packages/dashboard/src/components/spree/products/digital-assets-card.tsx b/packages/dashboard/src/components/spree/products/digital-assets-card.tsx
index ad129e65a0..45c570f823 100644
--- a/packages/dashboard/src/components/spree/products/digital-assets-card.tsx
+++ b/packages/dashboard/src/components/spree/products/digital-assets-card.tsx
@@ -265,7 +265,7 @@ export function DigitalAssetsCard({
<a
href={asset.download_url}
target="_blank"
- rel="noreferrer"
+ rel="noopener noreferrer"
className="hover:underline"
>
{asset.filename ?? t('admin.digital_assets.untitled')}
diff --git a/packages/dashboard/src/components/spree/purchase-order-form.tsx b/packages/dashboard/src/components/spree/purchase-order-form.tsx
index 794ccaf30e..d74d7813fe 100644
--- a/packages/dashboard/src/components/spree/purchase-order-form.tsx
+++ b/packages/dashboard/src/components/spree/purchase-order-form.tsx
@@ -194,6 +194,7 @@ export function PurchaseOrderForm({
value={expectedAt}
onChange={(value) => setExpectedAt(value ?? undefined)}
placeholder={t('admin.purchase_orders.fields.expected_at_placeholder')}
+ className="shadow-none"
/>
</Field>
@@ -205,6 +206,7 @@ export function PurchaseOrderForm({
value={cancelBy}
onChange={(value) => setCancelBy(value ?? undefined)}
placeholder={t('admin.purchase_orders.fields.cancel_by_placeholder')}
+ className="shadow-none"
/>
</Field>
diff --git a/packages/dashboard/src/components/spree/reporting/report-view.tsx b/packages/dashboard/src/components/spree/reporting/report-view.tsx
index d121a8474c..6dee8b868b 100644
--- a/packages/dashboard/src/components/spree/reporting/report-view.tsx
+++ b/packages/dashboard/src/components/spree/reporting/report-view.tsx
@@ -194,17 +194,29 @@ function MetricTile({
const { i18n } = useTranslation()
return (
<>
- <span className="text-xs text-muted-foreground">{metric.label}</span>
- <span className="flex items-center gap-2">
+ {/* One line, always. A label that wraps makes its tile taller than the
+ ones beside it, so a row of tiles stops sharing a baseline — and
+ `title` keeps the full text reachable on the narrow widths where a
+ long label is the one that gets cut. */}
+ <span className="truncate text-xs text-muted-foreground" title={metric.label}>
+ {metric.label}
+ </span>
+ {/* `min-w-0` so the figure can shrink rather than pushing the badge out
+ of the tile and over its neighbour. */}
+ <span className="flex min-w-0 items-center gap-2">
<span
className={cn(
- 'font-bold leading-none tabular-nums',
+ 'truncate font-bold leading-none tabular-nums',
size === 'lg' ? 'text-2xl' : 'text-lg',
)}
>
{formatMetric(total, metric, i18n.language)}
</span>
- {compare && <GrowthBadge growth={total?.growth} />}
+ {compare && (
+ <span className="shrink-0">
+ <GrowthBadge growth={total?.growth} />
+ </span>
+ )}
</span>
</>
)
@@ -329,9 +341,18 @@ export function TimeSeriesChart({
return (
<Card>
+ {/* Five equal columns only once there is room for them. Forced at phone
+ width each tile is about seventy pixels wide, which breaks "Average
+ order value" across three lines and pushes the figure out of the
+ tile — so below `sm` the strip scrolls sideways at a legible width
+ instead. */}
<CardHeader
- className="grid h-auto gap-0 border-b p-0"
- style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}
+ className="grid h-auto auto-cols-[minmax(9rem,1fr)] grid-flow-col gap-0 overflow-x-auto border-b p-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
+ style={{
+ // Applied at every width; below `sm` the auto-column minimum above
+ // wins and the strip overflows into a scroll instead of squeezing.
+ gridTemplateColumns: columns > 0 ? `repeat(${columns}, minmax(9rem, 1fr))` : undefined,
+ }}
>
{metrics.map((metric) => (
<button
@@ -339,7 +360,10 @@ export function TimeSeriesChart({
type="button"
onClick={() => setActiveName(metric.name)}
className={cn(
- 'relative flex flex-col justify-center gap-1 border-l px-6 py-4 text-left first:border-l-0',
+ // `min-w-0`: a grid item defaults to `min-width: auto`, which
+ // refuses to shrink below its content and defeats the truncation
+ // on the label and figure inside.
+ 'relative flex min-w-0 flex-col justify-center gap-1 border-l px-6 py-4 text-left first:border-l-0',
active.name === metric.name ? 'bg-muted/50' : 'hover:bg-muted/25',
)}
>
diff --git a/packages/dashboard/src/components/spree/sellers/seller-onboarding-card.tsx b/packages/dashboard/src/components/spree/sellers/seller-onboarding-card.tsx
index 1fb36fef52..bcaf28f60e 100644
--- a/packages/dashboard/src/components/spree/sellers/seller-onboarding-card.tsx
+++ b/packages/dashboard/src/components/spree/sellers/seller-onboarding-card.tsx
@@ -79,7 +79,7 @@ export function SellerOnboardingCard({ seller, canEdit }: { seller: Seller; canE
</CollapsibleTrigger>
<CollapsibleContent>
- <div className="flex flex-col gap-4 border-t p-4">
+ <div className="flex flex-col gap-4 border-t border-border-subtle p-4">
<Progress value={progressPercentage(progress)} />
{data ? (
diff --git a/packages/dashboard/src/components/spree/storefront-connect-sheet.tsx b/packages/dashboard/src/components/spree/storefront-connect-sheet.tsx
index ba483765c2..53c1a8d677 100644
--- a/packages/dashboard/src/components/spree/storefront-connect-sheet.tsx
+++ b/packages/dashboard/src/components/spree/storefront-connect-sheet.tsx
@@ -2,6 +2,7 @@ import type { Store } from '@spree/admin-sdk'
import {
Button,
CopyToClipboardButton,
+ ExternalLink,
Input,
Label,
Sheet,
@@ -12,8 +13,8 @@ import {
Skeleton,
toastManager,
} from '@spree/dashboard-ui'
-import { ExternalLinkIcon, EyeIcon, EyeOffIcon } from '@spree/dashboard-ui/icons'
-import { type ReactNode, useState } from 'react'
+import { EyeIcon, EyeOffIcon } from '@spree/dashboard-ui/icons'
+import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useStorefrontPublishableKey } from '../../hooks/use-api-keys'
import { useConnectStorefront } from '../../hooks/use-store-settings'
@@ -22,20 +23,6 @@ const STOREFRONT_REPOSITORY_URL = 'https://github.com/spree/storefront'
const STOREFRONT_DEMO_URL = 'https://demo.spreecommerce.org'
const STOREFRONT_DOCS_URL = 'https://spreecommerce.org/docs/developer/storefront/nextjs/quickstart'
-function ExternalLink({ href, children }: { href: string; children: ReactNode }) {
- return (
- <a
- href={href}
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex items-center gap-1 text-primary text-sm hover:underline"
- >
- {children}
- <ExternalLinkIcon className="size-3.5" />
- </a>
- )
-}
-
// Mirrors Spree::Admin::StorefrontHelper#vercel_deploy_url: clone the official
// Next.js storefront with the store's credentials prefilled, and come back to
// the Getting Started page after a successful deploy.
@@ -199,7 +186,7 @@ export function StorefrontConnectSheet({
)}
</div>
- <div className="flex flex-col gap-2 rounded-lg border p-4">
+ <div className="flex flex-col gap-2 rounded-lg border border-border-subtle p-4">
<p className="font-medium text-sm">
{t('admin.pages.getting_started.storefront_sheet.deploy_title')}
</p>
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 71f42c013b..8a285b99be 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -2108,8 +2108,6 @@
"label": "تسجيل سجل الأسعار"
},
"payouts": {
- "title": "مدفوعات البائعين",
- "description": "كيف يدفع هذا السوق للبائعين الذين يتاجرون فيه.",
"provider": {
"label": "الدفع عبر",
"help": "من ينقل الأموال. مع دفاترك الخاصة، ترسل التحويلات بنفسك وتضع علامة على كل منها كمدفوع.",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 417ffdff78..f5f1d0f920 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -2090,8 +2090,6 @@
"label": "Preisverlauf aufzeichnen"
},
"payouts": {
- "title": "Auszahlungen an Verkäufer",
- "description": "Wie dieser Marktplatz die Verkäufer bezahlt, die auf ihm handeln.",
"provider": {
"label": "Bezahlt über",
"help": "Wer das Geld bewegt. Bei eigener Buchführung überweisen Sie selbst und markieren jede Zahlung als erledigt.",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index 6f8f0bae12..fb3fbca8e6 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -2090,8 +2090,6 @@
"label": "Record price history"
},
"payouts": {
- "title": "Seller payouts",
- "description": "How this marketplace pays the sellers who trade on it.",
"provider": {
"label": "Paid through",
"help": "Who moves the money. Keeping your own books means you send the transfers yourself and mark each one paid.",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index a0dc442ee6..f76676dcf3 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -2090,8 +2090,6 @@
"label": "Enregistrer l’historique des prix"
},
"payouts": {
- "title": "Paiements aux vendeurs",
- "description": "Comment cette marketplace paie les vendeurs qui y vendent.",
"provider": {
"label": "Payé via",
"help": "Qui déplace l’argent. Avec vos propres comptes, vous effectuez les virements et marquez chacun comme payé.",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 5736e365f8..084fdfd3d0 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -2108,8 +2108,6 @@
"label": "Zapisuj historię cen"
},
"payouts": {
- "title": "Wypłaty dla sprzedawców",
- "description": "Jak ten marketplace płaci sprzedawcom, którzy na nim handlują.",
"provider": {
"label": "Wypłacane przez",
"help": "Kto przenosi pieniądze. Przy własnej księgowości sam wykonujesz przelewy i oznaczasz każdy jako zapłacony.",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index c8eb204984..7775cb985f 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -2085,8 +2085,6 @@
"label": "记录价格历史"
},
"payouts": {
- "title": "卖家付款",
- "description": "本平台如何向在此交易的卖家付款。",
"provider": {
"label": "付款方式",
"help": "由谁转移资金。自行记账时,由你自己转账并逐笔标记为已付。",
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
index f8dcb10d6e..a375c73756 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
@@ -1,17 +1,10 @@
import {
- AppSidebar,
+ AppShell,
+ AppShellProvider,
adminClient,
CommandPaletteProvider,
- MobileBreadcrumbBar,
- SettingsNavSheet,
- SettingsSidebar,
- SkipLink,
- StickyHeaderProvider,
StoreProvider,
- TopBar,
- useAutoCollapseSidebar,
} from '@spree/dashboard-core'
-import { SidebarInset, SidebarProvider } from '@spree/dashboard-ui'
import { createFileRoute, Outlet, useRouterState } from '@tanstack/react-router'
import { useState } from 'react'
import { CommandPalette } from '../../components/spree/command-palette/command-palette'
@@ -45,62 +38,34 @@ function StoreLayout() {
return (
<StoreProvider storeId={storeId}>
<CommandPaletteProvider>
- <StickyHeaderProvider>
- <SidebarProvider>
- <StoreShell inSettings={inSettings} />
- </SidebarProvider>
- <CommandPalette />
- </StickyHeaderProvider>
+ <AppShellProvider>
+ <StoreShell inSettings={inSettings} />
+ </AppShellProvider>
+ <CommandPalette />
</CommandPaletteProvider>
</StoreProvider>
)
}
-/**
- * Inside `SidebarProvider` so it can drive the primary nav's collapsed state:
- * the settings area brings its own full-width nav, so the primary one folds to
- * icons while the merchant is in there.
- */
function StoreShell({ inSettings }: { inSettings: boolean }) {
- useAutoCollapseSidebar(inSettings)
// Loaded by the shell rather than by whichever badge happens to be on screen:
// the sidebar only mounts the children of the section you are in, so leaving
// the request to a badge means no counts at all on every other page. One
// query key, so the badges and the home screen's card share this one request.
useDashboardCounters()
// The profile is edited in a dialog rather than a page, so the shell owns its
- // open state — the trigger sits in the TopBar's user menu, which is mounted
- // here and stays put across route changes.
+ // open state — the trigger sits in the sidebar's account menu, which is
+ // mounted here and stays put across route changes.
const [profileOpen, setProfileOpen] = useState(false)
- // Below `lg` the settings sidebar is hidden, so its sheet is the only way
- // between two settings pages. The trigger lives in the mobile breadcrumb bar.
- const [settingsNavOpen, setSettingsNavOpen] = useState(false)
return (
- <>
- {/* First in the tab order by construction — it has to precede the
- sidebar's thirty-odd links to be able to skip them. */}
- <SkipLink />
- <AppSidebar />
- {/* `flex-row` so the secondary sidebar can sit flush against the
- primary and span full height. The TopBar moves into the content
- column so the secondary sidebar can extend above it. */}
- <SidebarInset className="flex-row">
- <SettingsSidebar open={inSettings} />
- <div className="flex min-w-0 flex-1 flex-col">
- <TopBar uiLocales={UI_LOCALES} onEditProfile={() => setProfileOpen(true)} />
- <MobileBreadcrumbBar onOpenSettingsNav={() => setSettingsNavOpen(true)} />
- <SettingsNavSheet open={settingsNavOpen} onOpenChange={setSettingsNavOpen} />
- <ProfileDialog open={profileOpen} onOpenChange={setProfileOpen} />
- {inSettings ? (
- <Outlet />
- ) : (
- <div className="container mx-auto flex flex-1 flex-col gap-4 p-4 lg:p-6">
- <Outlet />
- </div>
- )}
- </div>
- </SidebarInset>
- </>
+ <AppShell
+ inSettings={inSettings}
+ uiLocales={UI_LOCALES}
+ onEditProfile={() => setProfileOpen(true)}
+ >
+ <ProfileDialog open={profileOpen} onOpenChange={setProfileOpen} />
+ <Outlet />
+ </AppShell>
)
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
index d1a15a3b5e..bcac913f43 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
@@ -189,8 +189,12 @@ function DashboardPage() {
</div>
<div className="flex items-center gap-2">
{/* Scopes order-derived metrics to one channel; stock counts stay store-wide. */}
+ {/* `sm` is the toolbar size the date picker's trigger also uses, so
+ the three controls on this row match in height, padding, text and
+ chevron rather than being aligned by hand. */}
<ChannelSelect
allOption
+ triggerSize="sm"
triggerClassName="min-w-40"
value={channelId}
onChange={setChannelId}
@@ -200,6 +204,7 @@ function DashboardPage() {
{currencies.length > 1 && (
<CurrencySelect
id="home-currency"
+ triggerSize="sm"
value={currency}
onChange={setPickedCurrency}
searchPlaceholder={t('admin.pages.home.currency.search')}
@@ -549,15 +554,25 @@ function RankingsCard({
return (
<Card className="lg:col-span-3">
- <CardHeader className="flex flex-row items-start justify-between gap-4">
+ {/* Stacked on a phone, side by side once there is width for both. Put
+ beside a four-tab strip on a narrow screen the heading gets a column
+ of its own barely wider than one word, and every line wraps. */}
+ <CardHeader className="flex flex-col items-stretch gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4">
<div className="flex flex-col gap-1.5">
<CardTitle>{t('admin.pages.home.rankings.title')}</CardTitle>
<CardDescription>{t('admin.pages.home.rankings.subtitle')}</CardDescription>
</div>
- <Tabs value={tab} onValueChange={(value) => setTab(value as RankingTab)}>
- <TabsList>
+ {/* The strip scrolls sideways rather than wrapping: a wrapped tab list
+ reads as two rows of unrelated buttons, and the labels are names
+ that must not be broken mid-word. */}
+ <Tabs
+ value={tab}
+ onValueChange={(value) => setTab(value as RankingTab)}
+ className="min-w-0 max-w-full overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
+ >
+ <TabsList className="w-max">
{tabs.map((value) => (
- <TabsTrigger key={value} value={value}>
+ <TabsTrigger key={value} value={value} className="whitespace-nowrap">
{t(`admin.pages.home.rankings.tabs.${value}`)}
</TabsTrigger>
))}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/index.tsx
index ac5c6d99d9..60d66f284c 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/index.tsx
@@ -1,5 +1,5 @@
import type { Category } from '@spree/admin-sdk'
-import { Can, SectionHeading, Subject } from '@spree/dashboard-core'
+import { Can, PageHeader, Subject } from '@spree/dashboard-core'
import {
Button,
Card,
@@ -71,28 +71,17 @@ function CategoriesPage() {
return (
<>
- <Card className="overflow-hidden rounded-xl">
- <div className="flex flex-col items-start justify-between gap-2 border-b border-border-subtle p-3 lg:flex-row lg:items-start">
- <SectionHeading
- title={t('admin.categories.title')}
- description={t('admin.table_descriptions.categories')}
- docsPath="manage-products/product-taxonomies"
- />
- <div className="flex items-center gap-2">
- <InputGroup className="lg:w-[300px]">
- <InputGroupAddon>
- <SearchIcon className="size-4 text-muted-foreground" />
- </InputGroupAddon>
- <InputGroupInput
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- placeholder={t('admin.categories.search_placeholder')}
- />
- </InputGroup>
+ {/* The same shell `ResourceTable` builds: the page's own header on the
+ sheet, the search under it, and the card holding only the tree. */}
+ <div className="flex flex-col gap-3">
+ <PageHeader
+ sticky={false}
+ title={t('admin.categories.title')}
+ description={t('admin.table_descriptions.categories')}
+ docsPath="manage-products/product-taxonomies"
+ actions={
<Can I="create" a={Subject.Category}>
<Button
- size="sm"
- className="h-[2.125rem]"
onClick={() =>
navigate({ to: '/$storeId/products/categories/new', params: { storeId } })
}
@@ -101,30 +90,44 @@ function CategoriesPage() {
{t('admin.categories.add_cta')}
</Button>
</Can>
- </div>
- </div>
- <CardContent className="p-0">
- {activeError ? (
- <p className="p-6 text-destructive" role="alert">
- {t('admin.categories.load_failed')}
- </p>
- ) : searching ? (
- searchLoading ? (
+ }
+ />
+
+ <InputGroup className="lg:w-[300px]">
+ <InputGroupAddon>
+ <SearchIcon className="size-4 text-muted-foreground" />
+ </InputGroupAddon>
+ <InputGroupInput
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder={t('admin.categories.search_placeholder')}
+ />
+ </InputGroup>
+
+ <Card className="-mx-4 gap-0 overflow-x-clip rounded-none border-0 bg-transparent py-0 shadow-none sm:mx-0 sm:rounded-xl sm:border">
+ <CardContent className="p-0">
+ {activeError ? (
+ <p className="p-6 text-destructive" role="alert">
+ {t('admin.categories.load_failed')}
+ </p>
+ ) : searching ? (
+ searchLoading ? (
+ <p className="p-6 text-muted-foreground">{t('admin.common.loading')}</p>
+ ) : (
+ <CategoryList categories={searchData?.data ?? []} {...rowHandlers} />
+ )
+ ) : isLoading ? (
<p className="p-6 text-muted-foreground">{t('admin.common.loading')}</p>
) : (
- <CategoryList categories={searchData?.data ?? []} {...rowHandlers} />
- )
- ) : isLoading ? (
- <p className="p-6 text-muted-foreground">{t('admin.common.loading')}</p>
- ) : (
- <CategoryTree
- categories={data?.data ?? []}
- {...rowHandlers}
- onReorder={handleReorder}
- />
- )}
- </CardContent>
- </Card>
+ <CategoryTree
+ categories={data?.data ?? []}
+ {...rowHandlers}
+ onReorder={handleReorder}
+ />
+ )}
+ </CardContent>
+ </Card>
+ </div>
{translateId && (
<ResourceTranslationsDialog
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
index e87e100012..2954873fc0 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
@@ -3,7 +3,7 @@ import {
adminClient,
Can,
ImageUploadField,
- SectionHeading,
+ PageHeader,
Subject,
useDirectUpload,
usePermissions,
@@ -11,8 +11,6 @@ import {
import {
Badge,
Button,
- Card,
- CardContent,
ContextMenu,
ContextMenuContent,
ContextMenuItem,
@@ -214,15 +212,14 @@ function MediaLibraryPage() {
return (
<>
- {/* Same shell as every other list page: the title, its description and
- the filters all live inside one card rather than floating above it. */}
- <Card className="-mx-4 rounded-none border-0 bg-transparent sm:mx-0 sm:rounded-xl sm:border sm:bg-card">
- <div className="flex flex-row items-start gap-2 border-b border-border-subtle p-3 pl-4 lg:justify-between">
- <SectionHeading
- title={t('admin.media_library.title')}
- description={t('admin.media_library.description')}
- />
- <div className="ml-auto flex shrink-0 items-center gap-2">
+ {/* The same shell `ResourceTable` builds: the page's own header on the
+ sheet, the controls under it, and the card holding only the content. */}
+ <div className="flex flex-col gap-3">
+ <PageHeader
+ sticky={false}
+ title={t('admin.media_library.title')}
+ description={t('admin.media_library.description')}
+ actions={
<Can I="update" a={Subject.Media}>
<input
ref={fileInputRef}
@@ -245,10 +242,10 @@ function MediaLibraryPage() {
{t('admin.media_library.upload')}
</Button>
</Can>
- </div>
- </div>
+ }
+ />
- <div className="flex flex-col gap-3 border-b border-border-subtle px-3 py-2 sm:flex-row sm:items-center">
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-center">
<SearchInput
value={searchInput}
onValueChange={(value) => {
@@ -301,7 +298,10 @@ function MediaLibraryPage() {
</Select>
</div>
- <CardContent className="p-4">
+ {/* No card around the grid: each tile already carries its own frame, so
+ boxing them drew a second border around a set of borders. The sheet
+ is the surface they sit on. */}
+ <div>
{query.isLoading ? (
<div className="flex items-center justify-center py-16 text-muted-foreground">
<Loader2Icon className="size-5 animate-spin" />
@@ -371,7 +371,7 @@ function MediaLibraryPage() {
))}
</ul>
)}
- </CardContent>
+ </div>
{meta && files.length > 0 && (
<Pagination
@@ -381,7 +381,7 @@ function MediaLibraryPage() {
onPageSizeChange={(size) => patchSearch({ limit: size })}
/>
)}
- </Card>
+ </div>
<MediaDetailSheet
media={selected}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings.tsx
index 4179e0e8f4..c328aa6c9f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings.tsx
@@ -5,9 +5,9 @@ export const Route = createFileRoute('/_authenticated/$storeId/settings')({
})
/**
- * Settings content padding. The secondary sidebar lives one level up, in
- * `_authenticated/$storeId.tsx`, so it can extend full-height beside the
- * TopBar. This layout owns only the right-side content padding.
+ * Settings content padding. The secondary sidebar lives one level up, in the
+ * shared app shell, so it can extend the full height of the content sheet.
+ * This layout owns only the right-side content padding.
*
* Every settings page inherits the container from here — a page must NOT add
* its own `p-4`/`container`/`mx-auto`, or it double-pads and drifts from the
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/payouts.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/payouts.tsx
index 9f1382266a..58c925bee9 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/payouts.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/payouts.tsx
@@ -2,11 +2,6 @@ import { zodResolver } from '@hookform/resolvers/zod'
import { SpreeError, type Store } from '@spree/admin-sdk'
import { mapSpreeErrorsToForm, PageHeader } from '@spree/dashboard-core'
import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
ErrorState,
Field,
FieldDescription,
@@ -148,105 +143,101 @@ function PayoutSettingsPage({ store }: { store: Store }) {
</p>
)}
- <Card>
- <CardHeader>
- <CardTitle>{t('admin.fields.store.payouts.title')}</CardTitle>
- <CardDescription>{t('admin.fields.store.payouts.description')}</CardDescription>
- </CardHeader>
- <CardContent>
- <FieldGroup>
- <Controller
- control={form.control}
- name="preferred_payout_provider"
- render={({ field }) => (
- <Field>
- <FieldLabel htmlFor="payout-provider">
- {t('admin.fields.store.payouts.provider.label')}
- </FieldLabel>
- <Select
- items={providerOptions}
- value={field.value}
- onValueChange={(value) => field.onChange(value as string)}
- >
- <SelectTrigger id="payout-provider">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {providerOptions.map((option) => (
- <SelectItem
- key={option.value}
- value={option.value}
- disabled={option.disabled}
- >
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FieldDescription>
- {selected?.requires_payout_account
- ? t('admin.fields.store.payouts.provider.requires_account')
- : t('admin.fields.store.payouts.provider.help')}
- </FieldDescription>
- <FieldError errors={[errors.preferred_payout_provider]} />
- </Field>
- )}
- />
-
- <Controller
- control={form.control}
- name="preferred_default_payouts_schedule_interval"
- render={({ field }) => (
- <Field>
- <FieldLabel htmlFor="payout-schedule">
- {t('admin.fields.store.payouts.schedule.label')}
- </FieldLabel>
- <Select
- items={scheduleOptions}
- value={field.value}
- onValueChange={(value) => field.onChange(value as string)}
- >
- <SelectTrigger id="payout-schedule">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {scheduleOptions.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FieldDescription>
- {t('admin.fields.store.payouts.schedule.help')}
- </FieldDescription>
- <FieldError
- errors={[errors.preferred_default_payouts_schedule_interval]}
- />
- </Field>
- )}
- />
+ {/* No Card and no CardHeader: this page has one group of fields,
+ and the PageHeader above already names it. A card here would
+ draw a frame around the whole page content, and its header
+ restated the page title and subtitle a few pixels below
+ themselves. The other single-group settings pages read the
+ same way. */}
+ <FieldGroup>
+ <Controller
+ control={form.control}
+ name="preferred_payout_provider"
+ render={({ field }) => (
+ <Field>
+ <FieldLabel htmlFor="payout-provider">
+ {t('admin.fields.store.payouts.provider.label')}
+ </FieldLabel>
+ <Select
+ items={providerOptions}
+ value={field.value}
+ onValueChange={(value) => field.onChange(value as string)}
+ >
+ <SelectTrigger id="payout-provider">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {providerOptions.map((option) => (
+ <SelectItem
+ key={option.value}
+ value={option.value}
+ disabled={option.disabled}
+ >
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FieldDescription>
+ {selected?.requires_payout_account
+ ? t('admin.fields.store.payouts.provider.requires_account')
+ : t('admin.fields.store.payouts.provider.help')}
+ </FieldDescription>
+ <FieldError errors={[errors.preferred_payout_provider]} />
+ </Field>
+ )}
+ />
+ <Controller
+ control={form.control}
+ name="preferred_default_payouts_schedule_interval"
+ render={({ field }) => (
<Field>
- <FieldLabel htmlFor="payout-minimum">
- {t('admin.fields.store.payouts.minimum.label')}
+ <FieldLabel htmlFor="payout-schedule">
+ {t('admin.fields.store.payouts.schedule.label')}
</FieldLabel>
- <Input
- id="payout-minimum"
- type="number"
- min={0}
- step="0.01"
- aria-invalid={!!errors.preferred_default_minimum_payout_amount || undefined}
- {...form.register('preferred_default_minimum_payout_amount')}
- />
+ <Select
+ items={scheduleOptions}
+ value={field.value}
+ onValueChange={(value) => field.onChange(value as string)}
+ >
+ <SelectTrigger id="payout-schedule">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {scheduleOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
<FieldDescription>
- {t('admin.fields.store.payouts.minimum.help')}
+ {t('admin.fields.store.payouts.schedule.help')}
</FieldDescription>
- <FieldError errors={[errors.preferred_default_minimum_payout_amount]} />
+ <FieldError errors={[errors.preferred_default_payouts_schedule_interval]} />
</Field>
- </FieldGroup>
- </CardContent>
- </Card>
+ )}
+ />
+
+ <Field>
+ <FieldLabel htmlFor="payout-minimum">
+ {t('admin.fields.store.payouts.minimum.label')}
+ </FieldLabel>
+ <Input
+ id="payout-minimum"
+ type="number"
+ min={0}
+ step="0.01"
+ aria-invalid={!!errors.preferred_default_minimum_payout_amount || undefined}
+ {...form.register('preferred_default_minimum_payout_amount')}
+ />
+ <FieldDescription>
+ {t('admin.fields.store.payouts.minimum.help')}
+ </FieldDescription>
+ <FieldError errors={[errors.preferred_default_minimum_payout_amount]} />
+ </Field>
+ </FieldGroup>
</>
}
/>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
index cdf5b7cf6c..2feac7b015 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
@@ -222,7 +222,7 @@ function StaffRow({ member }: { member: AdminUser }) {
) : (
<div className="flex flex-wrap gap-1">
{member.roles.map((role) => (
- <Badge key={role.id} className="capitalize">
+ <Badge key={role.id} className="capitalize" variant="info">
{role.name}
</Badge>
))}
@@ -353,7 +353,9 @@ function InvitationRow({ invitation }: { invitation: Invitation }) {
</TableCell>
<TableCell>
{invitation.role_name ? (
- <Badge className="capitalize">{invitation.role_name}</Badge>
+ <Badge className="capitalize" variant="info">
+ {invitation.role_name}
+ </Badge>
) : (
<span className="text-sm text-muted-foreground">—</span>
)}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
index 29d9d5ee96..0c6f19b361 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
@@ -18,6 +18,7 @@ import {
CardHeader,
CardTitle,
ErrorState,
+ ExternalLink,
Field,
FieldDescription,
FieldError,
@@ -40,9 +41,8 @@ import {
toastManager,
useFormSubmitShortcut,
} from '@spree/dashboard-ui'
-import { ExternalLinkIcon } from '@spree/dashboard-ui/icons'
import { createFileRoute } from '@tanstack/react-router'
-import { type ReactNode, useCallback, useEffect, useMemo } from 'react'
+import { useCallback, useEffect, useMemo } from 'react'
import {
type Control,
Controller,
@@ -78,20 +78,6 @@ export const Route = createFileRoute('/_authenticated/$storeId/settings/store')(
const PRICING_PROVIDER_DOCS_URL = 'https://spreecommerce.org/docs/developer/providers/pim'
const INVENTORY_PROVIDER_DOCS_URL = 'https://spreecommerce.org/docs/developer/providers/erp'
-function DocsLink({ href, children }: { href: string; children: ReactNode }) {
- return (
- <a
- href={href}
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex items-center gap-1 text-primary text-sm hover:underline"
- >
- {children}
- <ExternalLinkIcon className="size-3.5" />
- </a>
- )
-}
-
const TIMEZONES: string[] = (() => {
try {
return Intl.supportedValuesOf('timeZone')
@@ -712,9 +698,9 @@ function StoreSettingsForm({ store }: { store: Store }) {
)}
</FieldGroup>
<div className="mt-6 border-t pt-4">
- <DocsLink href={PRICING_PROVIDER_DOCS_URL}>
+ <ExternalLink href={PRICING_PROVIDER_DOCS_URL}>
{t('admin.fields.store.data_sources.pricing_provider.docs_link')}
- </DocsLink>
+ </ExternalLink>
</div>
</CardContent>
</Card>
@@ -747,9 +733,9 @@ function StoreSettingsForm({ store }: { store: Store }) {
)}
</FieldGroup>
<div className="mt-6 border-t pt-4">
- <DocsLink href={INVENTORY_PROVIDER_DOCS_URL}>
+ <ExternalLink href={INVENTORY_PROVIDER_DOCS_URL}>
{t('admin.fields.store.data_sources.inventory_provider.docs_link')}
- </DocsLink>
+ </ExternalLink>
</div>
</CardContent>
</Card>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId.tsx
index 6a6803709d..74fe6b08a8 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId.tsx
@@ -417,6 +417,7 @@ function DeliveriesCard({
return (
<ResourceTable<WebhookDelivery>
+ hideHeader
tableKey="webhook-deliveries"
// Mutation hooks invalidate +['webhook-deliveries', endpointId]+ —
// ResourceTable auto-injects storeId between the two slots, so the
diff --git a/packages/seller-dashboard/src/components/orders/returns-card.tsx b/packages/seller-dashboard/src/components/orders/returns-card.tsx
index ec7ab18554..b88e9bff9c 100644
--- a/packages/seller-dashboard/src/components/orders/returns-card.tsx
+++ b/packages/seller-dashboard/src/components/orders/returns-card.tsx
@@ -63,7 +63,7 @@ export function ReturnsCard({ order }: { order: Order }) {
return (
<Card variant="container">
- <CardHeader>
+ <CardHeader className="items-center">
<CardTitle>
<RotateCcwIcon className="size-4" />
{t('orders.post_sale.returns.title')}
diff --git a/packages/seller-dashboard/src/components/seller-switcher.tsx b/packages/seller-dashboard/src/components/seller-switcher.tsx
index 19b6ccb0d8..08a2fde426 100644
--- a/packages/seller-dashboard/src/components/seller-switcher.tsx
+++ b/packages/seller-dashboard/src/components/seller-switcher.tsx
@@ -1,3 +1,4 @@
+import { getInitials } from '@spree/dashboard-core'
import {
Avatar,
AvatarFallback,
@@ -50,15 +51,14 @@ export function SellerSwitcher() {
enabled: Boolean(sellerId),
})
- if (isLoading) return <Skeleton className="h-header-height w-full rounded-xl" />
+ if (isLoading) return <Skeleton className="h-rail-header-height w-full rounded-xl" />
const sellers = me?.sellers ?? []
const current = sellers.find((seller) => seller.id === sellerId) ?? sellers[0]
- const initials = current?.name
- .split(' ')
- .map((word) => word[0])
- .join('')
+ // Capped at two characters — see the store switcher: one letter per word
+ // overflows the avatar as soon as a name runs past two words.
+ const initials = getInitials(current?.name, '?')
const header = (
<>
@@ -79,7 +79,7 @@ export function SellerSwitcher() {
if (sellers.length < 2) {
return (
<SidebarMenu>
- <SidebarMenuItem className="flex h-header-height items-center">
+ <SidebarMenuItem className="flex h-rail-header-height items-center">
<div className="flex w-full items-center gap-2 p-1.5">{header}</div>
</SidebarMenuItem>
</SidebarMenu>
@@ -88,7 +88,7 @@ export function SellerSwitcher() {
return (
<SidebarMenu>
- <SidebarMenuItem className="flex h-header-height items-center">
+ <SidebarMenuItem className="flex h-rail-header-height items-center">
<DropdownMenu>
<DropdownMenuTrigger asChild className="flex w-full items-center">
<button
diff --git a/packages/seller-dashboard/src/pages/delivery-methods.tsx b/packages/seller-dashboard/src/pages/delivery-methods.tsx
index 889a325b5f..5c559025b2 100644
--- a/packages/seller-dashboard/src/pages/delivery-methods.tsx
+++ b/packages/seller-dashboard/src/pages/delivery-methods.tsx
@@ -110,9 +110,11 @@ export function DeliveryMethodsPage({ search }: { search: ResourceSearch }) {
<PageHeader
title={t('delivery_methods.title')}
subtitle={t('delivery_methods.description')}
+ sticky={false}
/>
<ResourceTable<DeliveryMethod>
+ hideHeader
tableKey="seller-delivery-methods"
queryKey="seller-delivery-methods"
queryFn={(params) => sellerClient().deliveryMethods.list(params)}
diff --git a/packages/seller-dashboard/src/pages/earnings.tsx b/packages/seller-dashboard/src/pages/earnings.tsx
index b0ddabd547..ac1eff3c1d 100644
--- a/packages/seller-dashboard/src/pages/earnings.tsx
+++ b/packages/seller-dashboard/src/pages/earnings.tsx
@@ -20,7 +20,7 @@ export function EarningsPage({ search }: { search: ResourceSearch }) {
return (
<div className="flex flex-col gap-4">
- <PageHeader title={t('earnings.title')} subtitle={t('earnings.subtitle')} />
+ <PageHeader title={t('earnings.title')} subtitle={t('earnings.subtitle')} sticky={false} />
{/* A failed balance request must not fall through to the empty state:
"you have earned nothing yet" is the opposite of "we could not ask". */}
@@ -33,6 +33,7 @@ export function EarningsPage({ search }: { search: ResourceSearch }) {
)}
<ResourceTable<Transfer>
+ hideHeader
tableKey="seller-transfers"
queryKey="seller-transfers-list"
queryFn={(params) => sellerClient().transfers.list(params)}
diff --git a/packages/seller-dashboard/src/pages/onboarding.tsx b/packages/seller-dashboard/src/pages/onboarding.tsx
index d4d752187a..c5d35a0eef 100644
--- a/packages/seller-dashboard/src/pages/onboarding.tsx
+++ b/packages/seller-dashboard/src/pages/onboarding.tsx
@@ -313,7 +313,7 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })
Accepting something a seller cannot read is not consent. */}
{requirement.action_url && (
<Button variant="outline" asChild>
- <a href={requirement.action_url} target="_blank" rel="noreferrer">
+ <a href={requirement.action_url} target="_blank" rel="noopener noreferrer">
{t('onboarding.read_terms')}
<ExternalLinkIcon className="size-4" />
</a>
@@ -459,7 +459,7 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })
requirement.kind !== 'payout_account' && (
<div className="flex justify-start">
<Button variant="outline" asChild>
- <a href={requirement.action_url} target="_blank" rel="noreferrer">
+ <a href={requirement.action_url} target="_blank" rel="noopener noreferrer">
{t('onboarding.go')}
<ExternalLinkIcon className="size-4" />
</a>
diff --git a/packages/seller-dashboard/src/pages/orders.tsx b/packages/seller-dashboard/src/pages/orders.tsx
index 61bcddd03e..c57c768623 100644
--- a/packages/seller-dashboard/src/pages/orders.tsx
+++ b/packages/seller-dashboard/src/pages/orders.tsx
@@ -18,9 +18,10 @@ export function OrdersPage({ search }: { search: ResourceSearch }) {
return (
<div className="flex flex-col gap-4">
- <PageHeader title={t('orders.title')} />
+ <PageHeader title={t('orders.title')} sticky={false} />
<ResourceTable<Order>
+ hideHeader
tableKey="seller-orders"
queryKey="seller-orders"
queryFn={(params) => sellerClient().orders.list(params)}
diff --git a/packages/seller-dashboard/src/pages/payouts.tsx b/packages/seller-dashboard/src/pages/payouts.tsx
index 7293c916f7..c01e47946b 100644
--- a/packages/seller-dashboard/src/pages/payouts.tsx
+++ b/packages/seller-dashboard/src/pages/payouts.tsx
@@ -21,6 +21,7 @@ export function PayoutsPage({ search }: { search: ResourceSearch }) {
<PageHeader title={t('payouts.title')} subtitle={t('payouts.subtitle')} />
<ResourceTable<Payout>
+ hideHeader
tableKey="seller-payouts"
queryKey="seller-payouts-list"
queryFn={(params) => sellerClient().payouts.list(params)}
diff --git a/packages/seller-dashboard/src/pages/policies.tsx b/packages/seller-dashboard/src/pages/policies.tsx
index a778fd6b78..5af79d944c 100644
--- a/packages/seller-dashboard/src/pages/policies.tsx
+++ b/packages/seller-dashboard/src/pages/policies.tsx
@@ -119,7 +119,7 @@ export function PoliciesPage({ search }: { search: ResourceSearch }) {
return (
<div className="flex flex-col gap-6">
- <PageHeader title={t('policies.title')} subtitle={t('policies.description')} />
+ <PageHeader title={t('policies.title')} subtitle={t('policies.description')} sticky={false} />
{outstanding.length > 0 && (
<Card>
@@ -146,6 +146,7 @@ export function PoliciesPage({ search }: { search: ResourceSearch }) {
)}
<ResourceTable<Policy>
+ hideHeader
tableKey="seller-policies"
queryKey="seller-policies"
queryFn={(params) => sellerClient().policies.list(params)}
diff --git a/packages/seller-dashboard/src/pages/products.tsx b/packages/seller-dashboard/src/pages/products.tsx
index 64eabd1b2e..d3c9a58988 100644
--- a/packages/seller-dashboard/src/pages/products.tsx
+++ b/packages/seller-dashboard/src/pages/products.tsx
@@ -148,9 +148,10 @@ export function ProductsPage({ search }: { search: ResourceSearch & { import?: s
return (
<div className="flex flex-col gap-4">
- <PageHeader title={t('products.title')} />
+ <PageHeader title={t('products.title')} sticky={false} />
<ResourceTable<Product>
+ hideHeader
tableKey="seller-products"
queryKey="seller-products"
queryFn={(params) => sellerClient().products.list(params)}
diff --git a/packages/seller-dashboard/src/panel-chrome.tsx b/packages/seller-dashboard/src/panel-chrome.tsx
index 7cc5858351..b30ad86a1e 100644
--- a/packages/seller-dashboard/src/panel-chrome.tsx
+++ b/packages/seller-dashboard/src/panel-chrome.tsx
@@ -1,29 +1,19 @@
-import {
- AppSidebar,
- MobileBreadcrumbBar,
- SettingsNavSheet,
- SettingsSidebar,
- StickyHeaderProvider,
- TenantProvider,
- TopBarUser,
- useAutoCollapseSidebar,
-} from '@spree/dashboard-core'
-import { SidebarInset, SidebarProvider, SidebarTrigger } from '@spree/dashboard-ui'
+import { AppShell, AppShellProvider, TenantProvider } from '@spree/dashboard-core'
import { useParams, useRouterState } from '@tanstack/react-router'
-import { type ReactNode, useState } from 'react'
+import type { ReactNode } from 'react'
import { SellerSwitcher } from './components/seller-switcher'
/**
- * The panel's frame: the sidebar and a content column under a top bar.
+ * The panel's frame: the nav rail, and the page as a sheet beside it.
*
- * The pieces are the operator dashboard's, not copies of them — `AppSidebar`
- * takes the tenant and its header as props precisely so a second panel can
- * reuse it, and the settings rail reads the same registry. A seller who has
- * used one recognises the other, and a fix to any of it reaches both.
+ * The frame is the operator dashboard's, not a copy of it — `AppShell` takes
+ * the tenant and its sidebar header as props precisely so a second panel can
+ * mount it. A seller who has used one recognises the other, and a fix to any
+ * of it reaches both.
*
- * What the operator's chrome has that this does not is the command palette:
- * it needs a search surface this panel does not have yet, and mounting the
- * provider for an empty palette would be chrome that does nothing.
+ * What the operator's chrome has that this does not is the command palette: it
+ * needs a search surface this panel does not have yet, so no provider is
+ * mounted and the rail's search affordance hides itself accordingly.
*/
export function PanelChrome({ children }: { children: ReactNode }) {
const { sellerId } = useParams({ from: '/_authenticated/$sellerId' })
@@ -36,77 +26,11 @@ export function PanelChrome({ children }: { children: ReactNode }) {
// does for the operator's dashboard — without it a cached list could
// survive a switch and be shown under the next seller.
<TenantProvider id={sellerId}>
- <StickyHeaderProvider>
- <SidebarProvider>
- <PanelShell sellerId={sellerId} inSettings={inSettings}>
- {children}
- </PanelShell>
- </SidebarProvider>
- </StickyHeaderProvider>
+ <AppShellProvider>
+ <AppShell tenantId={sellerId} sidebarHeader={<SellerSwitcher />} inSettings={inSettings}>
+ {children}
+ </AppShell>
+ </AppShellProvider>
</TenantProvider>
)
}
-
-/**
- * Inside `SidebarProvider` so it can drive the primary nav's collapsed state:
- * settings brings its own full-width rail, and two stacked columns leave the
- * content squeezed, so the primary one folds to icons for the duration.
- */
-function PanelShell({
- sellerId,
- inSettings,
- children,
-}: {
- sellerId: string
- inSettings: boolean
- children: ReactNode
-}) {
- useAutoCollapseSidebar(inSettings)
-
- // Below `lg` the settings rail is hidden, so its sheet is the only way
- // between two settings pages. The trigger lives in the breadcrumb bar.
- const [settingsNavOpen, setSettingsNavOpen] = useState(false)
-
- return (
- <>
- <AppSidebar tenantId={sellerId} header={<SellerSwitcher />} />
-
- {/* `flex-row` so the settings rail sits flush against the primary
- sidebar and spans full height, as it does in the dashboard. */}
- <SidebarInset className="flex-row">
- <SettingsSidebar open={inSettings} tenantId={sellerId} />
- <div className="flex min-w-0 flex-1 flex-col">
- {/* The account menu carries sign-out, so the sidebar footer no
- longer does. */}
- {/* Matches the shared TopBar's contract: `sticky top-0` and exactly
- `header-height` tall. The table's pinned header offsets itself by
- that same variable, so a header of another height — or one that
- scrolls away — leaves the column titles floating mid-table. */}
- <header className="sticky top-0 z-40 flex h-header-height shrink-0 items-center gap-2 border-border-subtle border-b bg-background/90 px-4 backdrop-blur supports-[backdrop-filter]:bg-background/75">
- <SidebarTrigger />
- <div className="ml-auto flex items-center gap-2">
- <TopBarUser />
- </div>
- </header>
-
- <MobileBreadcrumbBar
- tenantId={sellerId}
- onOpenSettingsNav={() => setSettingsNavOpen(true)}
- />
- <SettingsNavSheet
- open={settingsNavOpen}
- onOpenChange={setSettingsNavOpen}
- tenantId={sellerId}
- />
-
- {/* Settings pages bring their own padding, matching the dashboard. */}
- {inSettings ? (
- children
- ) : (
- <div className="flex flex-1 flex-col gap-4 p-4 lg:p-6">{children}</div>
- )}
- </div>
- </SidebarInset>
- </>
- )
-}