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.

Rework navigation, app shell and make the dashboard usable on a phone (#14485)

Damian Legawiec4ea389372305
diff --git a/packages/dashboard-core/package.json b/packages/dashboard-core/package.json
index cf04abee67..b58a973fde 100644
--- a/packages/dashboard-core/package.json
+++ b/packages/dashboard-core/package.json
@@ -66,8 +66,7 @@
"react": "^19.2.6",
"react-dom": "^19.2.6",
"react-hook-form": "^7.75.0",
- "react-i18next": "^17.0.8",
- "sonner": "^2.0.7"
+ "react-i18next": "^17.0.8"
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
diff --git a/packages/dashboard-core/src/components/app-sidebar.tsx b/packages/dashboard-core/src/components/app-sidebar.tsx
index e55906006f..76172917c9 100644
--- a/packages/dashboard-core/src/components/app-sidebar.tsx
+++ b/packages/dashboard-core/src/components/app-sidebar.tsx
@@ -4,23 +4,27 @@ import { PackageIcon } from 'lucide-react'
import type { ComponentProps } from 'react'
import { useAuth } from '../hooks/use-auth'
import { primarySidebarSide, useTranslation } from '../lib/i18n'
-import { type NavEntry, useNavEntries } from '../lib/nav-registry'
+import { type NavEntry, resolveNavLabel, useNavEntries } from '../lib/nav-registry'
import { type Permissions, usePermissions } from '../providers/permission-provider'
import { useStore } from '../providers/store-provider'
import { type NavItem, NavMain } from './nav-main'
import { StoreSwitcher } from './store-switcher'
-function entryToNavItem(entry: NavEntry, storeId: string): NavItem {
+/**
+ * `labelKey` is resolved here rather than at registration so labels follow a
+ * language change — a literal `label` is frozen at import time.
+ */
+function entryToNavItem(entry: NavEntry, storeId: string, t: (key: string) => string): NavItem {
const pathFor = (path: string) => (path === '/' ? `/${storeId}` : `/${storeId}${path}`)
return {
- title: entry.label,
+ title: resolveNavLabel(entry, t),
url: pathFor(entry.path),
icon: entry.icon ?? PackageIcon,
subject: entry.subject,
action: entry.action,
badge: entry.badge,
items: entry.children?.map((child) => ({
- title: child.label,
+ title: resolveNavLabel(child, t),
url: pathFor(child.path),
subject: child.subject,
action: child.action,
@@ -42,7 +46,7 @@ function filterByPermissions(items: NavItem[], permissions: Permissions): NavIte
}
export function AppSidebar(props: ComponentProps<typeof Sidebar>) {
- const { i18n } = useTranslation()
+ const { t, i18n } = useTranslation()
const { storeId } = useParams({ strict: false }) as { storeId?: string }
const { permissions } = usePermissions()
const { store } = useStore()
@@ -54,11 +58,11 @@ export function AppSidebar(props: ComponentProps<typeof Sidebar>) {
const visible = (entry: NavEntry) => !entry.if || entry.if(visibilityContext)
const navItems = filterByPermissions(
- main.filter(visible).map((e) => entryToNavItem(e, id)),
+ main.filter(visible).map((e) => entryToNavItem(e, id, t)),
permissions,
)
const bottomItems = filterByPermissions(
- bottom.filter(visible).map((e) => entryToNavItem(e, id)),
+ bottom.filter(visible).map((e) => entryToNavItem(e, id, t)),
permissions,
)
diff --git a/packages/dashboard-core/src/components/bulk-action-bar.tsx b/packages/dashboard-core/src/components/bulk-action-bar.tsx
index fe132b4465..1bd871fb28 100644
--- a/packages/dashboard-core/src/components/bulk-action-bar.tsx
+++ b/packages/dashboard-core/src/components/bulk-action-bar.tsx
@@ -4,15 +4,15 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
+ toastManager,
useConfirm,
} from '@spree/dashboard-ui'
import type { QueryKey } from '@tanstack/react-query'
import { useQueryClient } from '@tanstack/react-query'
-import { MoreHorizontalIcon } from 'lucide-react'
+import { EllipsisVerticalIcon } from 'lucide-react'
import type { ReactNode } from 'react'
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { usePermissions } from '../providers/permission-provider'
/**
@@ -136,17 +136,18 @@ export function BulkActionBar({ selectedIds, actions, onDone }: BulkActionBarPro
for (const key of action.invalidate ?? []) {
queryClient.invalidateQueries({ queryKey: key })
}
- toast.success(
- interpolate(
+ toastManager.add({
+ type: 'success',
+ title: interpolate(
action.successMessage ?? t('admin.components.bulk_action_bar.default_success'),
count,
),
- )
+ })
onDone()
} catch (err) {
const message =
err instanceof Error ? err.message : t('admin.components.bulk_action_bar.default_error')
- toast.error(action.errorMessage ?? message)
+ toastManager.add({ type: 'error', title: action.errorMessage ?? message })
} finally {
setRunning(false)
}
@@ -319,7 +320,7 @@ function BulkActionBarLayout({
size="icon-sm"
aria-label={t('admin.actions.more_actions')}
>
- <MoreHorizontalIcon className="size-4" />
+ <EllipsisVerticalIcon className="size-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
diff --git a/packages/dashboard-core/src/components/export-button.tsx b/packages/dashboard-core/src/components/export-button.tsx
index 5bca93db14..3d53a05c55 100644
--- a/packages/dashboard-core/src/components/export-button.tsx
+++ b/packages/dashboard-core/src/components/export-button.tsx
@@ -65,10 +65,13 @@ export function ExportButton({
return (
<>
+ {/* Desktop only: picking a dataset, waiting on the job and opening
+ the file is desk work, and the button is one of the things that
+ pushed the toolbar onto a third row on a phone. */}
<Button
size="sm"
variant="outline"
- className="h-[2.125rem]"
+ className="hidden h-[2.125rem] lg:inline-flex"
onClick={() => setOpen(true)}
disabled={exportMutation.isPending}
>
diff --git a/packages/dashboard-core/src/components/file-upload-field.tsx b/packages/dashboard-core/src/components/file-upload-field.tsx
index 91da7691cf..ff313973aa 100644
--- a/packages/dashboard-core/src/components/file-upload-field.tsx
+++ b/packages/dashboard-core/src/components/file-upload-field.tsx
@@ -10,11 +10,11 @@ import {
Field,
FieldDescription,
FieldLabel,
+ toastManager,
} from '@spree/dashboard-ui'
import { FileIcon, UploadCloudIcon, XIcon } from 'lucide-react'
import { type ReactNode, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { useDirectUpload } from '../hooks/use-direct-upload'
/**
@@ -126,7 +126,10 @@ export function FileUploadField({
async function handlePicked(picked: File) {
if (disabled || pending) return
if (!matchesAccept(picked)) {
- toast.error(t('admin.components.file_upload.invalid_type', { accept }))
+ toastManager.add({
+ type: 'error',
+ title: t('admin.components.file_upload.invalid_type', { accept }),
+ })
return
}
@@ -146,11 +149,12 @@ export function FileUploadField({
byteSize: file.size,
})
} catch (err) {
- toast.error(
- t('admin.components.file_upload.upload_failed', {
+ toastManager.add({
+ type: 'error',
+ title: t('admin.components.file_upload.upload_failed', {
message: err instanceof Error ? err.message : String(err),
}),
- )
+ })
} finally {
setPending(null)
}
diff --git a/packages/dashboard-core/src/components/import-button.tsx b/packages/dashboard-core/src/components/import-button.tsx
index 544897597f..90f874bc51 100644
--- a/packages/dashboard-core/src/components/import-button.tsx
+++ b/packages/dashboard-core/src/components/import-button.tsx
@@ -14,11 +14,11 @@ import {
SheetFooter,
SheetHeader,
SheetTitle,
+ toastManager,
} from '@spree/dashboard-ui'
import { DownloadIcon, FileSpreadsheetIcon, UploadIcon } from 'lucide-react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import {
useCreateImport,
useDownloadImportExample,
@@ -105,11 +105,12 @@ export function ImportButton({
onCreated(imp)
},
onError: (err) => {
- toast.error(
- t('admin.components.import_button.failed', {
+ toastManager.add({
+ type: 'error',
+ title: t('admin.components.import_button.failed', {
message: err instanceof Error ? err.message : String(err),
}),
- )
+ })
},
},
)
@@ -118,11 +119,12 @@ export function ImportButton({
function handleTemplateDownload() {
downloadTemplate.mutate(type, {
onError: (err) => {
- toast.error(
- t('admin.components.import_button.template_failed', {
+ toastManager.add({
+ type: 'error',
+ title: t('admin.components.import_button.template_failed', {
message: err instanceof Error ? err.message : String(err),
}),
- )
+ })
},
})
}
@@ -130,21 +132,24 @@ export function ImportButton({
function handleExampleDownload() {
downloadExample.mutate(type, {
onError: (err) => {
- toast.error(
- t('admin.components.import_button.example_failed', {
+ toastManager.add({
+ type: 'error',
+ title: t('admin.components.import_button.example_failed', {
message: err instanceof Error ? err.message : String(err),
}),
- )
+ })
},
})
}
return (
<Can I="create" a={subject}>
+ {/* Desktop only: the wizard needs a file from disk and column
+ mapping across a wide grid, neither of which works on a phone. */}
<Button
size={size ?? 'sm'}
variant={variant ?? 'outline'}
- className="h-[2.125rem]"
+ className="hidden h-[2.125rem] lg:inline-flex"
onClick={() => setOpen(true)}
disabled={createImport.isPending}
>
@@ -223,17 +228,11 @@ export function ImportButton({
</div>
<SheetFooter>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() => handleOpenChange(false)}
- >
+ <Button type="button" variant="outline" onClick={() => handleOpenChange(false)}>
{t('admin.actions.cancel')}
</Button>
<Button
type="button"
- size="sm"
onClick={handleSubmit}
disabled={!file.signedId || createImport.isPending}
>
diff --git a/packages/dashboard-core/src/components/nav-main.tsx b/packages/dashboard-core/src/components/nav-main.tsx
index edeb071dd2..1769c8c62d 100644
--- a/packages/dashboard-core/src/components/nav-main.tsx
+++ b/packages/dashboard-core/src/components/nav-main.tsx
@@ -1,4 +1,5 @@
import {
+ cn,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
@@ -16,6 +17,7 @@ import {
import { Link, useRouterState } from '@tanstack/react-router'
import type { LucideIcon } from 'lucide-react'
import { type ComponentType, useCallback, useEffect, useRef, useState } from 'react'
+import { isPathWithin } from '../lib/nav-registry'
import type { ActionName, SubjectName } from '../lib/permissions'
export type NavItem = {
@@ -194,21 +196,24 @@ function NavItemContent({
item,
currentPath,
isCollapsed,
+ isMobile,
hoverMenu,
}: {
item: NavItem
currentPath: string
isCollapsed: boolean
+ isMobile: boolean
hoverMenu: HoverMenuController
}) {
const isExactActive = currentPath === item.url || currentPath === `${item.url}/`
// Only prefix-match for items with a sub-path after the storeId segment (e.g. /store_abc/orders)
const hasSubPath = item.url.split('/').filter(Boolean).length > 1
- const isActive = isExactActive || (hasSubPath && currentPath.startsWith(item.url))
- const hasActiveChild = item.items?.some(
- (sub) => currentPath === sub.url || currentPath.startsWith(sub.url),
- )
- const showSubmenu = isActive || hasActiveChild
+ const isActive = isExactActive || (hasSubPath && isPathWithin(currentPath, item.url))
+ const hasActiveChild = item.items?.some((sub) => isPathWithin(currentPath, sub.url))
+ // Desktop reveals children on hover or when the section is active. Touch has
+ // no hover, and the drawer closes on navigation, so a collapsed child would
+ // take three taps to reach — show every child up front instead.
+ const showSubmenu = isMobile || isActive || hasActiveChild
const itemIsActive = isActive || !!hasActiveChild
const button = (
@@ -252,7 +257,7 @@ function NavItemContent({
{item.items && showSubmenu && (
<SidebarMenuSub>
{item.items.map((subItem) => {
- const subActive = currentPath === subItem.url || currentPath.startsWith(subItem.url)
+ const subActive = isPathWithin(currentPath, subItem.url)
return (
<SidebarMenuSubItem key={subItem.title}>
<SidebarMenuSubButton asChild isActive={subActive}>
@@ -277,8 +282,17 @@ function NavItemContent({
export function NavMain({ items, bottomItems }: { items: NavItem[]; bottomItems?: NavItem[] }) {
const routerState = useRouterState()
const currentPath = routerState.location.pathname
- const { state } = useSidebar()
+ const { state, isMobile, setOpenMobile } = useSidebar()
const isCollapsed = state === 'collapsed'
+ // Close the drawer as the link is tapped. Done here rather than in an effect
+ // watching the path: this tree renders *inside* the Sheet, so it remounts on
+ // every open and an effect could not tell "just opened" from "just navigated".
+ const handleLinkTap = useCallback(
+ (event: React.MouseEvent) => {
+ if (isMobile && (event.target as HTMLElement).closest('a')) setOpenMobile(false)
+ },
+ [isMobile, setOpenMobile],
+ )
// One controller for the whole rail so only a single hover menu is ever open.
const hoverMenu = useHoverMenuController()
@@ -290,7 +304,13 @@ export function NavMain({ items, bottomItems }: { items: NavItem[]; bottomItems?
}, [isCollapsed, closeNow])
return (
- <>
+ // The close handler sits on the list rather than each `<Link>`: those links
+ // are rendered through nested `asChild` Slots (Tooltip → SidebarMenuButton),
+ // which clone their own `onClick` over anything the child declares. A
+ // bubble-phase listener here sees the tap regardless.
+ // biome-ignore lint/a11y/noStaticElementInteractions: delegated link taps only
+ // biome-ignore lint/a11y/useKeyWithClickEvents: links keep their own keyboard behaviour
+ <div onClick={handleLinkTap} className="contents">
<SidebarGroup>
<SidebarMenu>
{items.map((item) => (
@@ -299,6 +319,7 @@ export function NavMain({ items, bottomItems }: { items: NavItem[]; bottomItems?
item={item}
currentPath={currentPath}
isCollapsed={isCollapsed}
+ isMobile={isMobile}
hoverMenu={hoverMenu}
/>
))}
@@ -306,11 +327,15 @@ export function NavMain({ items, bottomItems }: { items: NavItem[]; bottomItems?
</SidebarGroup>
{bottomItems && bottomItems.length > 0 && (
- <SidebarGroup className="mt-auto mb-2">
+ // `mt-auto` pins Settings to the foot of the desktop rail. In a
+ // full-height drawer that strands it alone below a screen of empty
+ // space, so on mobile it simply follows the list.
+ <SidebarGroup className={cn('mb-2', !isMobile && 'mt-auto')}>
<SidebarMenu>
{bottomItems.map((item) => {
const isActive =
- currentPath === item.url || (item.url !== '/' && currentPath.startsWith(item.url))
+ currentPath === item.url ||
+ (item.url !== '/' && isPathWithin(currentPath, item.url))
return (
<SidebarMenuItem key={item.title}>
@@ -329,6 +354,6 @@ export function NavMain({ items, bottomItems }: { items: NavItem[]; bottomItems?
</SidebarMenu>
</SidebarGroup>
)}
- </>
+ </div>
)
}
diff --git a/packages/dashboard-core/src/components/page-header.tsx b/packages/dashboard-core/src/components/page-header.tsx
index fa8ef1e964..d367061c90 100644
--- a/packages/dashboard-core/src/components/page-header.tsx
+++ b/packages/dashboard-core/src/components/page-header.tsx
@@ -150,7 +150,11 @@ export function PageHeader({
// the same hairline used elsewhere in the app.
<header
className={cn(
- 'sticky top-header-height z-20 -mx-4 -mt-4 flex items-start gap-3 bg-background/90 backdrop-blur supports-[backdrop-filter]:bg-background/75 px-4 pt-4 pb-3 lg:-mx-6 lg:-mt-6 lg:px-6 lg:pt-6',
+ // One row at every width. The title truncates rather than wrapping,
+ // so it yields space to the actions instead of pushing them onto a
+ // second row — a page with only a Save button was spending two rows
+ // of a short viewport on chrome.
+ 'sticky top-header-height z-20 -mx-4 -mt-4 flex flex-row items-start gap-2 bg-background/90 backdrop-blur supports-[backdrop-filter]:bg-background/75 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
@@ -165,21 +169,38 @@ export function PageHeader({
scrolled && 'after:opacity-100 shadow-xs',
)}
>
- {backTo && <BackButton fallback={backTo} />}
+ {/* Row one: back button beside the title, so the arrow keeps its
+ relationship to the heading rather than floating above it. */}
+ <div className="flex min-w-0 flex-1 items-start gap-3">
+ {backTo && <BackButton fallback={backTo} />}
- {/* Title + badges share the first row; subtitle drops to its own line
- underneath so descriptive prose doesn't get crammed alongside the
- heading. Short metadata subtitles (customer location, order status
- hint) read fine on the second line too. */}
- <div className="flex min-w-0 flex-1 flex-col gap-1">
- <div className="flex flex-wrap items-center gap-x-3 gap-y-1">
- <h1 className="text-2xl font-medium leading-tight">{title}</h1>
- {badges}
+ {/* Title + badges share a line; subtitle drops underneath so
+ descriptive prose doesn't get crammed alongside the heading. Short
+ metadata subtitles (customer location, order status hint) read fine
+ on the second line too. */}
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1">
+ {/* 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">
+ {title}
+ </h1>
+ {badges}
+ </div>
+ {/* Clamped on a phone: a two line description beside the actions
+ makes the sticky band tall enough to eat the content below it. */}
+ {subtitle && (
+ <span className="line-clamp-2 text-sm text-muted-foreground sm:line-clamp-none">
+ {subtitle}
+ </span>
+ )}
</div>
- {subtitle && <span className="text-sm text-muted-foreground">{subtitle}</span>}
</div>
- <div className="ml-auto flex items-center gap-2">
+ {/* Pinned to the end of the row. `shrink-0` so the actions keep their
+ full width and the title absorbs the shortfall. */}
+ <div className="flex shrink-0 items-center justify-end gap-2 sm:ml-auto">
<Slot name="page.actions" context={slotCtx} />
{actions}
{showDropdown && (
@@ -230,7 +251,7 @@ function PageActionsDropdown({
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button size="icon-sm" variant="outline" aria-label={t('admin.actions.more_actions')}>
+ <Button size="icon" variant="outline" aria-label={t('admin.actions.more_actions')}>
<EllipsisVerticalIcon className="size-4" />
</Button>
</DropdownMenuTrigger>
diff --git a/packages/dashboard-core/src/components/resource-picker-sheet.tsx b/packages/dashboard-core/src/components/resource-picker-sheet.tsx
index 0e9db6dfd9..f0f90de519 100644
--- a/packages/dashboard-core/src/components/resource-picker-sheet.tsx
+++ b/packages/dashboard-core/src/components/resource-picker-sheet.tsx
@@ -1,9 +1,7 @@
import {
Button,
Checkbox,
- InputGroup,
- InputGroupAddon,
- InputGroupInput,
+ SearchInput,
Sheet,
SheetContent,
SheetDescription,
@@ -13,7 +11,7 @@ import {
Thumbnail,
} from '@spree/dashboard-ui'
import { useQuery } from '@tanstack/react-query'
-import { Loader2Icon, SearchIcon, XIcon } from 'lucide-react'
+import { Loader2Icon } from 'lucide-react'
import { useDeferredValue, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -137,19 +135,14 @@ export function ResourcePickerSheet<T extends PickerOption>({
</SheetHeader>
<div className="border-b border-border p-4">
- <InputGroup>
- <InputGroupAddon>
- <SearchIcon className="size-4 text-muted-foreground" />
- </InputGroupAddon>
- <InputGroupInput
- type="search"
- value={input}
- onChange={(e) => setInput(e.target.value)}
- // Enter has no action here; swallow it so it can't submit a host form.
- onKeyDown={(e) => e.key === 'Enter' && e.preventDefault()}
- placeholder={searchPlaceholder ?? t('admin.resource_picker.search_placeholder')}
- />
- </InputGroup>
+ <SearchInput
+ value={input}
+ onValueChange={setInput}
+ // Enter has no action here; swallow it so it can't submit a host form.
+ onKeyDown={(e) => e.key === 'Enter' && e.preventDefault()}
+ placeholder={searchPlaceholder ?? t('admin.resource_picker.search_placeholder')}
+ clearLabel={t('admin.common.clear')}
+ />
{staged.size > 0 && (
<p className="mt-2 text-muted-foreground text-xs">
{t('admin.resource_picker.selected_count', { count: staged.size })}
@@ -209,8 +202,7 @@ export function ResourcePickerSheet<T extends PickerOption>({
</div>
<SheetFooter className="flex-row items-center justify-between border-t border-border">
- <Button type="button" variant="ghost" onClick={() => handleOpenChange(false)}>
- <XIcon className="size-4" />
+ <Button type="button" variant="outline" onClick={() => handleOpenChange(false)}>
{t('admin.actions.cancel')}
</Button>
<Button type="button" onClick={confirm} disabled={staged.size === 0 || submitting}>
diff --git a/packages/dashboard-core/src/components/resource-table.tsx b/packages/dashboard-core/src/components/resource-table.tsx
index 5f569c1c03..6b11da92ff 100644
--- a/packages/dashboard-core/src/components/resource-table.tsx
+++ b/packages/dashboard-core/src/components/resource-table.tsx
@@ -37,6 +37,7 @@ import {
TableHeader,
TableHeaderRow,
TableRow,
+ useIsMobile,
} from '@spree/dashboard-ui'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import { useNavigate } from '@tanstack/react-router'
@@ -49,9 +50,11 @@ import {
useMemo,
useState,
} from 'react'
+import { createPortal } from 'react-dom'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
import { useAuth } from '../hooks/use-auth'
+import { useVisualViewportOffset } from '../hooks/use-visual-viewport-offset'
import { filtersToRansack } from '../lib/filters-to-ransack'
import { withStoreScope } from '../lib/query-keys'
import {
@@ -221,6 +224,10 @@ export function ResourceTable<T extends Record<string, any>>({
const [selectedIds, setSelectedIds] = useState<Set<string>>(() => new Set())
// Whether the bulk bar is covering the column labels.
const bulkActive = selectionEnabled && selectedIds.size > 0
+ // Only one bulk bar is mounted at a time. Rendering both and hiding one
+ // with `md:` leaves its text in the accessibility tree, so "2 selected"
+ // and every action label match twice.
+ const isMobile = useIsMobile()
const {
page,
@@ -266,6 +273,10 @@ export function ResourceTable<T extends Record<string, any>>({
[displayableColumns, visibleColumnKeys],
)
+ // Built from every displayable column, not the visible subset: the column
+ // picker is a desktop control (it is hidden on a phone), so the card should
+ // not inherit a selection the merchant cannot see or change there.
+
// Expands requested by currently-visible columns (e.g. custom field
// columns need `expand=custom_fields` to render their values). Sorted so
// the query key stays stable regardless of column order.
@@ -285,6 +296,15 @@ export function ResourceTable<T extends Record<string, any>>({
const userPrefix = Array.isArray(queryKey) ? queryKey : [queryKey]
const queryKeyPrefix = withStoreScope(userPrefix, storeId)
+ // Both bulk bars (desktop overlay, mobile bottom bar) reset through here so
+ // they cannot drift apart.
+ const visualViewportOffset = useVisualViewportOffset(bulkActive)
+
+ const clearSelection = useCallback(() => {
+ setSelectedIds(new Set())
+ queryClient.invalidateQueries({ queryKey: queryKeyPrefix })
+ }, [queryClient, queryKeyPrefix])
+
const { data, isLoading } = useQuery({
queryKey: [
...queryKeyPrefix,
@@ -457,7 +477,13 @@ export function ResourceTable<T extends Record<string, any>>({
: actions
return (
- <Card className="rounded-xl">
+ // 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 shadow-none sm:mx-0 sm:rounded-xl sm:border sm:shadow-sm">
<TableToolbar
columns={displayableColumns}
visibleColumns={visibleColumnKeys}
@@ -501,7 +527,7 @@ export function ResourceTable<T extends Record<string, any>>({
)}
</TableHeaderRow>
</TableHeader>
- <TableBody>
+ <TableBody className="bg-card">
{isLoading ? (
<TableSkeletonRows
colSpan={visibleColumns.length + 1 + (rowActionsEnabled ? 1 : 0)}
@@ -548,7 +574,7 @@ export function ResourceTable<T extends Record<string, any>>({
the same sticky offset as the pinned header keeps the two
travelling together; the start padding clears the select-all
checkbox, which stays visible and interactive underneath. */}
- {bulkActive && (
+ {bulkActive && !isMobile && (
// `pointer-events-none` on the overlay, re-enabled only on the
// bar itself: the start-padding gutter is part of this div and
// would otherwise swallow every click aimed at the select-all
@@ -560,15 +586,51 @@ export function ResourceTable<T extends Record<string, any>>({
<BulkActionBar
selectedIds={Array.from(selectedIds)}
actions={bulkActions!}
- onDone={() => {
- setSelectedIds(new Set())
- queryClient.invalidateQueries({ queryKey: queryKeyPrefix })
- }}
+ onDone={clearSelection}
/>
</div>
</div>
</div>
)}
+
+ {/* On a phone the header-row overlay is the wrong home for this: it
+ scrolls sideways with a wide table and sits at the top, far from
+ the thumb. A fixed bottom bar stays put and in reach while the
+ merchant scrolls the list picking rows. */}
+ {bulkActive &&
+ isMobile &&
+ // Portalled to `document.body`: `SidebarInset` is `relative z-0`,
+ // which opens a stacking context, and a `fixed` child of it can
+ // only stack against its siblings there — page content painted
+ // later covered the bar until the merchant scrolled past it.
+ createPortal(
+ <section
+ className="fixed inset-x-0 z-50 border-t border-border bg-card px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-lg"
+ // `bottom` anchors to the *layout* viewport. Pinch-zoom (and
+ // a mobile URL bar) makes the visual viewport a smaller
+ // window onto it, leaving the bar off-screen until the
+ // merchant pans down — the offset lifts it back into view.
+ style={{ bottom: visualViewportOffset }}
+ aria-label={t('admin.a11y.bulk_actions')}
+ >
+ <div className="flex items-center gap-3">
+ <Checkbox
+ checked={allPageSelected}
+ indeterminate={somePageSelected}
+ onCheckedChange={togglePage}
+ aria-label={t('admin.a11y.select_all_rows')}
+ />
+ <div className="min-w-0 flex-1">
+ <BulkActionBar
+ selectedIds={Array.from(selectedIds)}
+ actions={bulkActions!}
+ onDone={clearSelection}
+ />
+ </div>
+ </div>
+ </section>,
+ document.body,
+ )}
<Table stickyHeader>
<TableHeader>
{/* Column headers stay mounted with rows selected, and the bulk
@@ -596,8 +658,10 @@ export function ResourceTable<T extends Record<string, any>>({
// Hide the text, not the cell: `opacity-0` would erase
// the cell's muted background and bottom rule too,
// leaving rows visible through the band behind the
- // bulk actions overlay.
- bulkActive && 'text-transparent select-none',
+ // bulk actions overlay. Only where that overlay is
+ // drawn — on a phone the bar is at the foot of the
+ // screen and the column labels stay readable.
+ bulkActive && !isMobile && 'text-transparent select-none',
)}
>
{col.label}
@@ -610,7 +674,7 @@ export function ResourceTable<T extends Record<string, any>>({
)}
</TableHeaderRow>
</TableHeader>
- <TableBody>
+ <TableBody className="bg-card">
{isLoading ? (
<TableSkeletonRows
colSpan={
@@ -680,6 +744,16 @@ 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}
diff --git a/packages/dashboard-core/src/components/settings-sidebar.tsx b/packages/dashboard-core/src/components/settings-sidebar.tsx
index 34faec62d7..f7f8ed92d2 100644
--- a/packages/dashboard-core/src/components/settings-sidebar.tsx
+++ b/packages/dashboard-core/src/components/settings-sidebar.tsx
@@ -1,6 +1,13 @@
import {
Badge,
cn,
+ mobileDrawerClassName,
+ SearchInput,
+ Sheet,
+ SheetContent,
+ SheetHeader,
+ SheetTitle,
+ SIDEBAR_WIDTH_MOBILE,
SidebarGroup,
SidebarGroupLabel,
SidebarMenu,
@@ -8,14 +15,17 @@ import {
SidebarMenuItem,
} from '@spree/dashboard-ui'
import { Link, useParams, useRouterState } from '@tanstack/react-router'
-import { PackageIcon } from 'lucide-react'
+import { ArrowLeftIcon, PackageIcon } from 'lucide-react'
+import { useEffect, useMemo, useState, useSyncExternalStore } from 'react'
import { useTranslation } from 'react-i18next'
+import { isPathWithin, resolveNavLabel } from '../lib/nav-registry'
import {
+ filterSettingsByPermissions,
+ filterSettingsByQuery,
type SettingsNavEntry,
- type SettingsNavSnapshot,
useSettingsNav,
} from '../lib/settings-nav-registry'
-import { type Permissions, usePermissions } from '../providers/permission-provider'
+import { usePermissions } from '../providers/permission-provider'
import { NavIcon } from './nav-main'
/**
@@ -35,10 +45,6 @@ import { NavIcon } from './nav-main'
export function SettingsSidebar({ open }: { open: boolean }) {
const { t } = useTranslation()
const { storeId } = useParams({ strict: false }) as { storeId?: string }
- const id = storeId ?? 'default'
- const snapshot = useSettingsNav()
- const { permissions } = usePermissions()
- const visible = filterByPermissions(snapshot, permissions)
// `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
@@ -59,34 +65,184 @@ export function SettingsSidebar({ open }: { open: boolean }) {
scrollbar cuts a heavy grey stripe down the middle of the chrome. */}
<div
className={cn(
- 'quiet-scrollbar flex h-full w-(--spacing-sidebar-width) flex-col gap-2 overflow-y-auto py-2 transition-opacity duration-200',
+ 'quiet-scrollbar h-full w-(--spacing-sidebar-width) overflow-y-auto transition-opacity duration-200',
open ? 'opacity-100 delay-100' : 'pointer-events-none opacity-0',
)}
>
- {visible.groups.map(({ group, entries }) => (
- <SidebarGroup key={group.key}>
- <SidebarGroupLabel>
- {group.labelKey ? t(group.labelKey) : group.label}
- </SidebarGroupLabel>
- <SidebarMenu>
- {entries.map((entry) => (
- <SettingsItem
- key={entry.key}
- entry={entry}
- storeId={id}
- // While closed, keep the items out of the tab order — the
- // `aria-hidden` above does not, by itself, prevent focus.
- tabIndex={open ? 0 : -1}
- />
- ))}
- </SidebarMenu>
- </SidebarGroup>
- ))}
+ {/* 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
+ store switcher opposite, so the two line up. */}
+ <div className="flex h-header-height items-center gap-1 px-2">
+ <Link
+ to={`/${storeId}` as never}
+ tabIndex={open ? 0 : -1}
+ aria-label={t('admin.settings_page.back_to_dashboard')}
+ className="inline-flex size-8 shrink-0 items-center justify-center rounded-lg text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent hover:text-sidebar-foreground"
+ >
+ <ArrowLeftIcon className="size-4" />
+ </Link>
+ <span className="truncate font-medium text-sm">{t('admin.settings_page.title')}</span>
+ </div>
+
+ <SettingsNavBody tabIndex={open ? 0 : -1} />
</div>
</aside>
)
}
+/**
+ * The settings nav on a narrow screen, where `SettingsSidebar` is hidden.
+ * Without it the only way between two settings pages is a round trip through
+ * the landing page.
+ *
+ * Rendered as a sheet rather than an inline panel because the settings content
+ * needs the full width on a phone; `data-mobile` opts its rows into the same
+ * touch sizing the primary drawer uses.
+ */
+/**
+ * Tracks the `lg` breakpoint the settings sheet is bounded by. `useIsMobile`
+ * cannot stand in: it is fixed at 768px, and closing the sheet there would
+ * strand it open across the 768-1024px band where it is still the only way to
+ * navigate settings.
+ */
+const SETTINGS_SHEET_BREAKPOINT = 1024
+
+function useIsSettingsSheetHidden() {
+ return useSyncExternalStore(
+ (onChange) => {
+ const query = window.matchMedia(`(min-width: ${SETTINGS_SHEET_BREAKPOINT}px)`)
+ query.addEventListener('change', onChange)
+ return () => query.removeEventListener('change', onChange)
+ },
+ () => window.matchMedia(`(min-width: ${SETTINGS_SHEET_BREAKPOINT}px)`).matches,
+ // Server render: assume the narrow layout so the sheet stays mountable.
+ () => false,
+ )
+}
+
+export function SettingsNavSheet({
+ open,
+ onOpenChange,
+}: {
+ open: boolean
+ onOpenChange: (open: boolean) => void
+}) {
+ const { t } = useTranslation()
+ // Unmounted above `lg` rather than hidden with a utility class: `lg:hidden`
+ // would hide the panel but leave the portal's overlay painted and the modal
+ // focus trap armed, with nothing on screen to close it. Widening past the
+ // breakpoint while the sheet is open also reports the close, so the caller's
+ // state does not stay stuck open behind a desktop layout.
+ const isDesktop = useIsSettingsSheetHidden()
+
+ useEffect(() => {
+ if (isDesktop && open) onOpenChange(false)
+ }, [isDesktop, open, onOpenChange])
+
+ if (isDesktop) return null
+
+ return (
+ <Sheet open={open} onOpenChange={onOpenChange}>
+ <SheetContent
+ side="left"
+ data-mobile="true"
+ className={cn(mobileDrawerClassName, 'gap-0')}
+ style={{ width: SIDEBAR_WIDTH_MOBILE }}
+ >
+ {/* `h-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">
+ {/* 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. */}
+ <SheetTitle className="text-base">{t('admin.settings_page.title')}</SheetTitle>
+ </SheetHeader>
+ <div className="quiet-scrollbar flex-1 overflow-y-auto">
+ {/* Close as the link is tapped rather than from an effect watching the
+ path: this body renders inside the Sheet, so it remounts on every
+ open and an effect could not tell "just opened" from "navigated". */}
+ <SettingsNavBody tabIndex={0} onNavigate={() => onOpenChange(false)} />
+ </div>
+ </SheetContent>
+ </Sheet>
+ )
+}
+
+/** Search box plus grouped entries — shared by the desktop aside and the sheet. */
+function SettingsNavBody({
+ tabIndex,
+ onNavigate,
+}: {
+ tabIndex: number
+ /** Called when an entry is tapped — closes the mobile sheet. */
+ onNavigate?: () => void
+}) {
+ const { t } = useTranslation()
+ const { storeId } = useParams({ strict: false }) as { storeId?: string }
+ const id = storeId ?? 'default'
+ const snapshot = useSettingsNav()
+ const { permissions } = usePermissions()
+ const [query, setQuery] = useState('')
+ // Permission filtering depends only on the snapshot, so it survives typing.
+ const allowed = useMemo(
+ () => filterSettingsByPermissions(snapshot, permissions),
+ [snapshot, permissions],
+ )
+ const visible = useMemo(() => filterSettingsByQuery(allowed, query, t), [allowed, query, t])
+
+ return (
+ // Delegated rather than per-link: entries render through `asChild` Slots
+ // that clone their own `onClick` over the child's.
+ // biome-ignore lint/a11y/noStaticElementInteractions: delegated link taps only
+ // biome-ignore lint/a11y/useKeyWithClickEvents: links keep their own keyboard behaviour
+ <div
+ className="flex flex-col gap-2 py-2"
+ onClick={(event) => {
+ if ((event.target as HTMLElement).closest('a')) onNavigate?.()
+ }}
+ >
+ <div className="px-2">
+ <SearchInput
+ value={query}
+ onValueChange={setQuery}
+ placeholder={t('admin.settings_page.search_placeholder')}
+ 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"
+ />
+ </div>
+
+ {visible.groups.length === 0 && (
+ <p className="px-4 py-2 text-sm text-sidebar-foreground/70">
+ {t('admin.settings_page.no_results', { query: query.trim() })}
+ </p>
+ )}
+
+ {visible.groups.map(({ group, entries }) => (
+ <SidebarGroup key={group.key}>
+ <SidebarGroupLabel>{resolveNavLabel(group, t)}</SidebarGroupLabel>
+ <SidebarMenu>
+ {entries.map((entry) => (
+ <SettingsItem
+ key={entry.key}
+ entry={entry}
+ storeId={id}
+ // While the desktop panel is closed, keep items out of the tab
+ // order — `aria-hidden` does not, by itself, prevent focus.
+ tabIndex={tabIndex}
+ />
+ ))}
+ </SidebarMenu>
+ </SidebarGroup>
+ ))}
+ </div>
+ )
+}
+
function SettingsItem({
entry,
storeId,
@@ -100,9 +256,9 @@ function SettingsItem({
const routerState = useRouterState()
const currentPath = routerState.location.pathname
const url = `/${storeId}/settings${entry.path}`
- const isActive = currentPath === url || currentPath.startsWith(`${url}/`)
+ const isActive = isPathWithin(currentPath, url)
const Icon = entry.icon ?? PackageIcon
- const label = entry.labelKey ? t(entry.labelKey) : entry.label
+ const label = resolveNavLabel(entry, t)
return (
<SidebarMenuItem>
@@ -122,19 +278,3 @@ function SettingsItem({
</SidebarMenuItem>
)
}
-
-function filterByPermissions(
- snapshot: SettingsNavSnapshot,
- permissions: Permissions,
-): SettingsNavSnapshot {
- const groups = snapshot.groups
- .map(({ group, entries }) => ({
- group,
- entries: entries.filter((e) => !e.subject || permissions.can(e.action ?? 'read', e.subject)),
- }))
- .filter((g) => g.entries.length > 0)
- return {
- groups,
- all: groups.flatMap((g) => g.entries),
- }
-}
diff --git a/packages/dashboard-core/src/components/store-switcher.tsx b/packages/dashboard-core/src/components/store-switcher.tsx
index 90065348b1..c22b7621d5 100644
--- a/packages/dashboard-core/src/components/store-switcher.tsx
+++ b/packages/dashboard-core/src/components/store-switcher.tsx
@@ -26,7 +26,10 @@ import { useStore } from '../providers/store-provider'
export function StoreSwitcher() {
const { t } = useTranslation()
const { isMobile, state } = useSidebar()
- const isCollapsed = state === 'collapsed'
+ // `collapsed` is the desktop rail's icon mode. The mobile drawer is full
+ // width whatever that state says — and the rail auto-collapses inside the
+ // settings area — so honouring it there hides the store name for no reason.
+ const isCollapsed = state === 'collapsed' && !isMobile
const { store, isLoading } = useStore()
const { user } = useAuth()
diff --git a/packages/dashboard-core/src/components/table-toolbar.tsx b/packages/dashboard-core/src/components/table-toolbar.tsx
index fb2e0143a9..f62830e55d 100644
--- a/packages/dashboard-core/src/components/table-toolbar.tsx
+++ b/packages/dashboard-core/src/components/table-toolbar.tsx
@@ -14,6 +14,7 @@ import {
Popover,
PopoverContent,
PopoverTrigger,
+ SearchInput,
Select,
SelectContent,
SelectItem,
@@ -29,11 +30,10 @@ import {
Columns3Icon,
FilterIcon,
PlusIcon,
- SearchIcon,
Trash2Icon,
XIcon,
} from 'lucide-react'
-import { useCallback, useMemo, useRef, useState } from 'react'
+import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
type ColumnDef,
@@ -167,7 +167,6 @@ export function TableToolbar({
}: TableToolbarProps) {
const { t } = useTranslation()
const [filterOpen, setFilterOpen] = useState(false)
- const searchRef = useRef<HTMLInputElement>(null)
const allCols = allColumns ?? columns
// Memoize so `FilterPanel`'s `useMemo` deps stay stable across parent
@@ -179,37 +178,31 @@ export function TableToolbar({
return (
<>
- <div className="flex flex-col lg:flex-row gap-2 items-start lg:items-center justify-between p-3 pl-4 border-b border-border-subtle">
- {title && <CardTitle>{title}</CardTitle>}
- <div className="flex gap-2 items-center flex-wrap ml-auto">
- {/* Search */}
- <div className="flex items-center gap-2 border border-border bg-card rounded-lg shadow-xs px-2.5 h-[2.125rem] lg:w-[300px] focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] transition-all duration-100 ease-in-out">
- <SearchIcon className="size-4 text-muted-foreground shrink-0" />
- <input
- ref={searchRef}
- placeholder={
- searchPlaceholder ?? t('admin.components.table_toolbar.search_placeholder')
- }
- value={search}
- onChange={(e) => onSearchChange(e.target.value)}
- className="h-full w-full border-0 bg-transparent p-0 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-0"
- />
- {search && (
- <button
- type="button"
- className="p-0.5 text-muted-foreground hover:text-foreground shrink-0"
- onClick={() => {
- onSearchChange('')
- searchRef.current?.focus()
- }}
- >
- <XIcon className="size-3.5" />
- </button>
- )}
- </div>
+ {/* A phone shows the title and the controls only — search lives in the
+ TopBar there. From `lg` the search field joins them on one row. */}
+ <div className="flex flex-row items-center gap-2 border-b border-border-subtle p-3 pl-4 lg:justify-between">
+ {title && <CardTitle className="min-w-0 truncate text-lg">{title}</CardTitle>}
+ {/* Hidden on a phone: the TopBar already carries a search field there,
+ and two search boxes stacked in one column is the more confusing
+ cost. Any term already set stays visible as a removable chip below,
+ so a search made on desktop is never silently filtering a list the
+ merchant cannot see it on. */}
+ <div className="hidden items-center gap-2 lg:ml-auto lg:flex">
+ <SearchInput
+ value={search}
+ onValueChange={onSearchChange}
+ placeholder={
+ searchPlaceholder ?? t('admin.components.table_toolbar.search_placeholder')
+ }
+ clearLabel={t('admin.common.clear')}
+ className="h-11 w-full bg-card text-sm lg:h-[2.125rem] lg:w-[300px]"
+ />
</div>
- <div className="flex gap-2 items-center">
+ {/* One row at every width, controls pinned to the end. Import and
+ Export drop their labels on a phone so the row still fits; the
+ title truncates ahead of them rather than pushing them off. */}
+ <div className="ml-auto flex shrink-0 items-center gap-2">
{/* Filter button */}
{filterableColumns.length > 0 && (
<Popover open={filterOpen} onOpenChange={setFilterOpen}>
@@ -219,7 +212,7 @@ export function TableToolbar({
<Button
variant="ghost"
size="sm"
- className="h-[2.125rem]"
+ className="h-11 lg:h-[2.125rem]"
aria-label={t('admin.components.table_toolbar.filters_button')}
>
<FilterIcon className="size-4" />
@@ -235,7 +228,10 @@ export function TableToolbar({
{t('admin.components.table_toolbar.filters_button')}
</TooltipContent>
</Tooltip>
- <PopoverContent align="end" className="w-[480px] p-0">
+ {/* `min(480px, …)` rather than a flat 480px: the panel is wider
+ than a phone, so a fixed width runs its right edge and the
+ Apply button off the screen. */}
+ <PopoverContent align="end" className="w-[min(480px,calc(100vw-1rem))] p-0">
<FilterPanel
columns={filterableColumns}
filters={filters}
@@ -254,20 +250,42 @@ export function TableToolbar({
<SortDropdown columns={sortableColumns} sort={sort} onSortChange={onSortChange} />
)}
- {/* Column selector */}
- <ColumnSelector
- columns={columns.filter((c) => c.default !== undefined)}
- visibleColumns={visibleColumns}
- onVisibleColumnsChange={onVisibleColumnsChange}
- />
+ {/* Column selector — hidden on a phone, where too few columns are
+ visible at once for choosing between them to mean anything. */}
+ <div className="hidden lg:contents">
+ <ColumnSelector
+ columns={columns.filter((c) => c.default !== undefined)}
+ visibleColumns={visibleColumns}
+ onVisibleColumnsChange={onVisibleColumnsChange}
+ />
+ </div>
{actions}
</div>
</div>
{/* Active filter badges */}
- {filters.length > 0 && (
+ {(filters.length > 0 || search) && (
<div className="flex flex-wrap items-center gap-2 border-b border-border-subtle px-3 py-2">
+ {/* The search term as a chip, mobile only — the field it came from is
+ hidden there, so this is the only way to see or clear it. */}
+ {search && (
+ <Badge variant="outline" className="h-7 gap-1.5 pr-1 pl-2.5 text-sm lg:hidden">
+ <span className="font-medium">
+ {t('admin.components.table_toolbar.search_placeholder')}
+ </span>
+ <span className="truncate">{search}</span>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t('admin.common.clear')}
+ onClick={() => onSearchChange('')}
+ >
+ <XIcon className="size-3.5" />
+ </Button>
+ </Badge>
+ )}
{filters.map((filter) => (
<FilterChip
key={filter.id}
@@ -276,15 +294,17 @@ export function TableToolbar({
onRemove={() => onFiltersChange(filters.filter((f) => f.id !== filter.id))}
/>
))}
- <Button
- type="button"
- variant="ghost"
- size="sm"
- className="text-muted-foreground hover:text-foreground"
- onClick={() => onFiltersChange([])}
- >
- {t('admin.components.table_toolbar.clear_all')}
- </Button>
+ {filters.length > 0 && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground hover:text-foreground"
+ onClick={() => onFiltersChange([])}
+ >
+ {t('admin.components.table_toolbar.clear_all')}
+ </Button>
+ )}
</div>
)}
</>
@@ -483,7 +503,7 @@ function SortDropdown({
<Button
variant="ghost"
size="sm"
- className="h-[2.125rem]"
+ className="h-11 lg:h-[2.125rem]"
aria-label={t('admin.components.table_toolbar.sort_tooltip')}
>
<ArrowUpDownIcon className="size-4" />
@@ -682,7 +702,10 @@ function FilterPanel({
}))
return (
- <div key={filter.id} className="flex min-w-0 items-center gap-1.5">
+ // `flex-wrap` with a `basis` floor on each control: field,
+ // operator and value cannot share one line on a phone, so they
+ // stack instead of squeezing every control below legibility.
+ <div key={filter.id} className="flex min-w-0 flex-wrap items-center gap-1.5">
<Select
items={fieldItems}
value={filter.field}
@@ -696,7 +719,7 @@ function FilterPanel({
})
}}
>
- <SelectTrigger size="sm" className="flex-1">
+ <SelectTrigger size="sm" className="min-w-[8rem] flex-1">
<SelectValue />
</SelectTrigger>
<SelectContent>
@@ -713,7 +736,7 @@ function FilterPanel({
value={filter.operator}
onValueChange={(val) => updateFilter(filter.id, { operator: val })}
>
- <SelectTrigger size="sm" className="w-[120px] shrink-0">
+ <SelectTrigger size="sm" className="w-[120px] shrink-0 max-sm:flex-1">
<SelectValue />
</SelectTrigger>
<SelectContent>
@@ -755,7 +778,7 @@ function FilterPanel({
value={filter.value || undefined}
onValueChange={(val) => updateFilter(filter.id, { value: val })}
>
- <SelectTrigger size="sm" className="flex-1">
+ <SelectTrigger size="sm" className="min-w-[8rem] flex-1">
<SelectValue
placeholder={t('admin.components.table_toolbar.filter_select_placeholder')}
/>
@@ -780,7 +803,7 @@ function FilterPanel({
value={filter.value || undefined}
onValueChange={(val) => updateFilter(filter.id, { value: val })}
>
- <SelectTrigger size="sm" className="flex-1">
+ <SelectTrigger size="sm" className="min-w-[8rem] flex-1">
<SelectValue
placeholder={t('admin.components.table_toolbar.filter_select_placeholder')}
/>
diff --git a/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx b/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx
new file mode 100644
index 0000000000..c95a1cce1e
--- /dev/null
+++ b/packages/dashboard-core/src/components/top-bar-breadcrumbs.tsx
@@ -0,0 +1,223 @@
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbLink,
+ BreadcrumbList,
+ BreadcrumbPage,
+ BreadcrumbSeparator,
+} from '@spree/dashboard-ui'
+import { Link, useParams, useRouterState } from '@tanstack/react-router'
+import { MenuIcon } from 'lucide-react'
+import { Fragment, type ReactNode, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { isPathWithin, type NavEntry, resolveNavLabel, useNavEntries } from '../lib/nav-registry'
+import { type SettingsNavEntry, useSettingsNav } from '../lib/settings-nav-registry'
+
+interface Crumb {
+ label: string
+ /** Omitted on the final crumb, which renders as plain text. */
+ to?: string
+}
+
+/**
+ * Location trail for the TopBar, derived from the current path by matching it
+ * against the nav registries. Fills the empty space beside the search box and
+ * gives deep pages the orientation the collapsed sidebars stop providing.
+ *
+ * Only segments the registries know are named. A record-detail path
+ * (`/settings/delivery-profiles/dp_123`) resolves as far as its section and
+ * stops there — inventing a crumb for an id the shell can't name would be
+ * worse than a shorter trail, and the page's own `PageHeader` carries the
+ * record's title anyway.
+ */
+export function TopBarBreadcrumbs() {
+ const trail = useCrumbs()
+ if (!trail) return null
+
+ return <CrumbTrail crumbs={trail.crumbs} pathname={trail.pathname} className="min-w-0" />
+}
+
+/**
+ * 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.
+ *
+ * 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.
+ *
+ * Inside settings the leading crumb is a button rather than a link — it opens
+ * the settings nav sheet, which is the fastest way between two settings pages
+ * on a screen with no settings sidebar.
+ */
+export function MobileBreadcrumbBar({ onOpenSettingsNav }: { onOpenSettingsNav?: () => void }) {
+ const trail = useCrumbs()
+ if (!trail) return null
+
+ const { crumbs, pathname, inSettings } = trail
+
+ return (
+ <div className="flex h-11 shrink-0 items-center border-b border-border/75 bg-background px-4 md:hidden">
+ <CrumbTrail
+ crumbs={crumbs}
+ pathname={pathname}
+ className="min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
+ // In settings the leading crumb opens the nav sheet instead of
+ // navigating — it is the only way between settings pages on a phone.
+ renderFirst={
+ inSettings && onOpenSettingsNav
+ ? (crumb) => (
+ <button
+ type="button"
+ onClick={onOpenSettingsNav}
+ // 44px tall via the row; the negative inline margin keeps the
+ // text on the page gutter while the tap area overhangs it.
+ className="-ms-2 inline-flex h-11 items-center gap-1 rounded-lg px-2 text-sm text-muted-foreground transition-colors hover:text-foreground"
+ >
+ <MenuIcon className="size-4" />
+ {crumb.label}
+ </button>
+ )
+ : undefined
+ }
+ />
+ </div>
+ )
+}
+
+function CrumbTrail({
+ crumbs,
+ pathname,
+ className,
+ renderFirst,
+}: {
+ crumbs: Crumb[]
+ pathname: string
+ className?: string
+ /** Replaces the leading crumb's content — used for the settings nav trigger. */
+ renderFirst?: (crumb: Crumb) => ReactNode
+}) {
+ return (
+ <Breadcrumb className={className}>
+ <BreadcrumbList className="flex-nowrap">
+ {crumbs.map((crumb, index) => {
+ // The trail ends in a link, not plain text, when the last crumb names
+ // a section the current page sits *inside* (a record page, whose own
+ // name the registries can't supply) — there it is the way back up.
+ const isCurrentPage = crumb.to === pathname
+ const custom = index === 0 ? renderFirst?.(crumb) : undefined
+ return (
+ // Crumbs are a fixed trail for one path — no stable id beyond
+ // position. The separator is a sibling `<li>`, never a child of
+ // BreadcrumbItem — nesting one list item inside another is invalid.
+ // biome-ignore lint/suspicious/noArrayIndexKey: positional by nature
+ <Fragment key={index}>
+ <BreadcrumbItem className="min-w-0">
+ {custom ??
+ (isCurrentPage || !crumb.to ? (
+ <BreadcrumbPage className="truncate">{crumb.label}</BreadcrumbPage>
+ ) : (
+ <BreadcrumbLink asChild>
+ <Link to={crumb.to} className="truncate">
+ {crumb.label}
+ </Link>
+ </BreadcrumbLink>
+ ))}
+ </BreadcrumbItem>
+ {index < crumbs.length - 1 && <BreadcrumbSeparator />}
+ </Fragment>
+ )
+ })}
+ </BreadcrumbList>
+ </Breadcrumb>
+ )
+}
+
+/** Resolves the trail for the current path, or null when there is nothing worth showing. */
+function useCrumbs(): { crumbs: Crumb[]; pathname: string; inSettings: boolean } | null {
+ const { t } = useTranslation()
+ const { storeId } = useParams({ strict: false }) as { storeId?: string }
+ const pathname = useRouterState({ select: (s) => s.location.pathname })
+ const { main, bottom } = useNavEntries()
+ const settings = useSettingsNav()
+
+ // Memoized because both breadcrumb surfaces are mounted at once (the
+ // responsive split is CSS, not conditional mounting), so an unmemoized pass
+ // would run twice on every render of the app-wide TopBar.
+ return useMemo(() => {
+ if (!storeId) return null
+
+ const crumbs = buildCrumbs({ pathname, storeId, main, bottom, settings: settings.all, t })
+ // A lone crumb naming the page you are already on says nothing the
+ // PageHeader doesn't. A lone crumb naming the *section* of a record page
+ // does — it is the way back up — so that one stays.
+ if (crumbs.length === 0) return null
+ if (crumbs.length === 1 && crumbs[0].to === pathname) return null
+
+ return { crumbs, pathname, inSettings: isPathWithin(pathname, `/${storeId}/settings`) }
+ }, [pathname, storeId, main, bottom, settings.all, t])
+}
+
+function buildCrumbs({
+ pathname,
+ storeId,
+ main,
+ bottom,
+ settings,
+ t,
+}: {
+ pathname: string
+ storeId: string
+ main: NavEntry[]
+ bottom: NavEntry[]
+ settings: SettingsNavEntry[]
+ t: (key: string) => string
+}): Crumb[] {
+ const settingsRoot = `/${storeId}/settings`
+
+ if (isPathWithin(pathname, settingsRoot)) {
+ const crumbs: Crumb[] = [{ label: t('admin.settings_page.title'), to: settingsRoot }]
+ const entry = bestMatch(settings, (e) => `${settingsRoot}${e.path}`, pathname)
+ if (entry) {
+ crumbs.push({ label: resolveNavLabel(entry, t), to: `${settingsRoot}${entry.path}` })
+ }
+ return crumbs
+ }
+
+ // One pass handles both a page under its parent's path and a child that sits
+ // outside it (Returns lives at `/returns` but nests under Orders), so a
+ // matching child alone is enough to claim the trail.
+ for (const parent of [...main, ...bottom]) {
+ const parentUrl = `/${storeId}${parent.path}`
+ const child = bestMatch(parent.children ?? [], (c) => `/${storeId}${c.path}`, pathname)
+ const parentMatches = parent.path !== '/' && isPathWithin(pathname, parentUrl)
+ if (!child && !parentMatches) continue
+
+ const crumbs: Crumb[] = [{ label: resolveNavLabel(parent, t), to: parentUrl }]
+ if (child) crumbs.push({ label: resolveNavLabel(child, t), to: `/${storeId}${child.path}` })
+ return crumbs
+ }
+
+ return []
+}
+
+/**
+ * The matching entry whose URL is longest, so `/webhooks/wh_1` prefers
+ * `/webhooks` over a shorter entry that also prefixes it. Written as a scan
+ * rather than sort-then-find: this runs for every entry on every navigation,
+ * and the ordering is needed only to break ties.
+ */
+function bestMatch<T>(
+ entries: readonly T[],
+ urlOf: (entry: T) => string,
+ pathname: string,
+): T | undefined {
+ let best: T | undefined
+ let bestLength = -1
+ for (const entry of entries) {
+ const url = urlOf(entry)
+ if (!isPathWithin(pathname, url) || url.length <= bestLength) continue
+ best = entry
+ bestLength = url.length
+ }
+ return best
+}
diff --git a/packages/dashboard-core/src/components/top-bar.tsx b/packages/dashboard-core/src/components/top-bar.tsx
index 93e93edbc8..4d6b2ecb02 100644
--- a/packages/dashboard-core/src/components/top-bar.tsx
+++ b/packages/dashboard-core/src/components/top-bar.tsx
@@ -34,6 +34,7 @@ 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 ?? '')
@@ -90,7 +91,15 @@ export function TopBar({
and overriding the box would shrink the target to 20px. */}
<SidebarTrigger className="-ml-1 opacity-50 hover:bg-accent hover:opacity-100 [&_svg]:size-5" />
- <div className="flex flex-1 justify-center">
+ {/* 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>
@@ -117,7 +126,7 @@ function SearchTrigger() {
// Focus matches the form inputs — the soft blue glow from `--ring`,
// rather than a hard offset ring. It looks like a search field, so it
// should focus like one.
- className="flex w-full max-w-md cursor-pointer items-center gap-1 rounded-xl border border-border px-2 py-1.5 text-sm text-muted-foreground outline-none transition-[color,background-color,border-color,box-shadow] duration-100 ease-out hover:bg-accent focus-visible:border-ring focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]"
+ className="flex w-full max-w-md shrink cursor-pointer items-center gap-1 rounded-xl border border-border p-2 md:py-1.5 text-sm text-muted-foreground outline-none transition-[color,background-color,border-color,box-shadow] duration-100 ease-out hover:bg-accent focus-visible:border-ring focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)]"
>
<SearchIcon className="size-4" />
<span className="flex-1 text-left">{t('admin.components.command_palette.placeholder')}</span>
diff --git a/packages/dashboard-core/src/hooks/use-export.ts b/packages/dashboard-core/src/hooks/use-export.ts
index ae0c3a4cd8..bfe09674bd 100644
--- a/packages/dashboard-core/src/hooks/use-export.ts
+++ b/packages/dashboard-core/src/hooks/use-export.ts
@@ -1,6 +1,6 @@
import type { Export, ExportCreateParams } from '@spree/admin-sdk'
+import { toastManager } from '@spree/dashboard-ui'
import { useMutation } from '@tanstack/react-query'
-import { toast } from 'sonner'
import { adminClient } from '../client'
import { downloadFromApi } from '../lib/download'
import { i18n } from '../lib/i18n'
@@ -47,26 +47,37 @@ export function useExport() {
// Per-invocation id so concurrent exports don't collide on a single
// sticky toast.
const toastId = `export-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
- toast.loading(i18n.t('admin.components.export_button.preparing'), { id: toastId })
+ toastManager.add({
+ type: 'loading',
+ title: i18n.t('admin.components.export_button.preparing'),
+ id: toastId,
+ })
try {
const created = await adminClient.exports.create(params)
const finished = await pollUntilDone(created.id)
await downloadExportFile(finished, token)
- toast.success(i18n.t('admin.components.export_button.downloaded'), { id: toastId })
+ toastManager.add({
+ type: 'success',
+ title: i18n.t('admin.components.export_button.downloaded'),
+ id: toastId,
+ })
return finished
} catch (err) {
if (err instanceof ExportTimeoutError) {
- toast.info(i18n.t('admin.components.export_button.email_fallback'), {
+ toastManager.add({
+ type: 'info',
+ title: i18n.t('admin.components.export_button.email_fallback'),
id: toastId,
})
} else {
- toast.error(
- i18n.t('admin.components.export_button.failed', {
+ toastManager.add({
+ type: 'error',
+ title: i18n.t('admin.components.export_button.failed', {
message: err instanceof Error ? err.message : String(err),
}),
- { id: toastId },
- )
+ id: toastId,
+ })
}
throw err
}
diff --git a/packages/dashboard-core/src/hooks/use-resource-mutation.ts b/packages/dashboard-core/src/hooks/use-resource-mutation.ts
index 5d69cb9873..1aa6fc7d33 100644
--- a/packages/dashboard-core/src/hooks/use-resource-mutation.ts
+++ b/packages/dashboard-core/src/hooks/use-resource-mutation.ts
@@ -1,11 +1,11 @@
import { SpreeError } from '@spree/admin-sdk'
+import { toastManager } from '@spree/dashboard-ui'
import {
type QueryKey,
type UseMutationOptions,
useMutation,
useQueryClient,
} from '@tanstack/react-query'
-import { toast } from 'sonner'
import { i18n } from '../lib/i18n'
import { withStoreScope } from '../lib/query-keys'
import { useStore } from '../providers/store-provider'
@@ -78,13 +78,13 @@ export function useResourceMutation<TData = unknown, TError = Error, TVariables
}
}
if (successMessage !== false) {
- toast.success(successMessage)
+ toastManager.add({ type: 'success', title: successMessage })
}
return onSuccess?.(data, variables, onMutateResult, ctx)
},
onError: (error, variables, onMutateResult, ctx) => {
if (errorMessage !== false && !isValidationError(error)) {
- toast.error(errorMessage)
+ toastManager.add({ type: 'error', title: errorMessage })
}
return onError?.(error, variables, onMutateResult, ctx)
},
diff --git a/packages/dashboard-core/src/hooks/use-switch-admin-locale.ts b/packages/dashboard-core/src/hooks/use-switch-admin-locale.ts
index ad6e4b84eb..c8619eaeab 100644
--- a/packages/dashboard-core/src/hooks/use-switch-admin-locale.ts
+++ b/packages/dashboard-core/src/hooks/use-switch-admin-locale.ts
@@ -1,5 +1,5 @@
+import { toastManager } from '@spree/dashboard-ui'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { adminClient } from '../client'
import { i18n, markGenuineLocaleChoice, switchLocale } from '../lib/i18n'
import { useAuth } from './use-auth'
@@ -49,7 +49,7 @@ export function useSwitchAdminLocale() {
markGenuineLocaleChoice(code)
}
} catch {
- toast.error(t('admin.account.language.update_failed'))
+ toastManager.add({ type: 'error', title: t('admin.account.language.update_failed') })
}
}
}
diff --git a/packages/dashboard-core/src/hooks/use-visual-viewport-offset.ts b/packages/dashboard-core/src/hooks/use-visual-viewport-offset.ts
new file mode 100644
index 0000000000..dbd345d410
--- /dev/null
+++ b/packages/dashboard-core/src/hooks/use-visual-viewport-offset.ts
@@ -0,0 +1,61 @@
+import { useEffect, useState } from 'react'
+
+/**
+ * Distance from the bottom of the layout viewport to the bottom of the visual
+ * one, in CSS pixels.
+ *
+ * A `position: fixed; bottom: 0` element anchors to the *layout* viewport. When
+ * the page is pinch-zoomed — or a mobile browser's URL bar is expanded — the
+ * visual viewport is a smaller window onto that layout, so the element sits
+ * below what the merchant can actually see and only appears once they pan or
+ * scroll down to it. Adding this offset to `bottom` keeps a fixed bar on screen
+ * in both cases.
+ *
+ * Returns `0` when the two viewports agree, which is the ordinary desktop case
+ * and costs nothing.
+ *
+ * @param active Pass the consumer's own visibility so the measurement happens
+ * when it appears — a value read at mount is taken before the element exists
+ * and never refreshed.
+ */
+export function useVisualViewportOffset(active = true): number {
+ const [offset, setOffset] = useState(0)
+
+ useEffect(() => {
+ if (!active) return
+ const vv = window.visualViewport
+ if (!vv) return
+
+ const update = () => {
+ // `window.innerHeight`, not `documentElement.clientHeight`: `fixed`
+ // positioning resolves against the former, and the two disagree in
+ // exactly the situation this hook exists for — a zoomed or URL-bar-inset
+ // page reports the *visual* height as `clientHeight`, which would make
+ // the offset compute to zero and move nothing.
+ const below = window.innerHeight - (vv.offsetTop + vv.height)
+ setOffset(Math.max(0, Math.round(below)))
+ }
+
+ update()
+ // The two viewports can still disagree on the first frame — a zoom level
+ // restored with the page, or a URL bar that has not settled, both report
+ // stale numbers until layout completes. Re-read once after paint so the
+ // bar is placed correctly without waiting for the user to resize.
+ const raf = requestAnimationFrame(update)
+
+ vv.addEventListener('resize', update)
+ vv.addEventListener('scroll', update)
+ window.addEventListener('resize', update)
+ return () => {
+ cancelAnimationFrame(raf)
+ vv.removeEventListener('resize', update)
+ vv.removeEventListener('scroll', update)
+ window.removeEventListener('resize', update)
+ }
+ // `active` is in the deps so the offset is measured when the consumer
+ // actually appears. Reading it once at mount is too early: the element is
+ // usually not rendered yet, and nothing re-measures when it later shows.
+ }, [active])
+
+ return offset
+}
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.ts
index 4017bdc989..db9ac92a75 100644
--- a/packages/dashboard-core/src/index.ts
+++ b/packages/dashboard-core/src/index.ts
@@ -43,6 +43,7 @@ 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
// ---------------------------------------------------------------------------
@@ -59,6 +60,7 @@ export * from './hooks/use-host-form'
export * from './hooks/use-import'
export * from './hooks/use-resource-mutation'
export * from './hooks/use-switch-admin-locale'
+export * from './hooks/use-visual-viewport-offset'
export * from './lib/create-action-registry'
// ---------------------------------------------------------------------------
// Registries — pluggable extension points (nav, route, slot, table,
diff --git a/packages/dashboard-core/src/lib/nav-registry.ts b/packages/dashboard-core/src/lib/nav-registry.ts
index c887944283..27ac9e66e7 100644
--- a/packages/dashboard-core/src/lib/nav-registry.ts
+++ b/packages/dashboard-core/src/lib/nav-registry.ts
@@ -18,8 +18,15 @@ export interface NavVisibilityContext {
export interface NavEntry {
/** Stable identifier — used for register/remove/update and as the React key. */
key: string
- /** Visible label. */
- label: string
+ /**
+ * Visible label. Built-in entries should prefer `labelKey` so the sidebar
+ * re-renders on language change; a literal `label` is resolved once at
+ * registration and then frozen. Plugins without translation bundles of their
+ * own can still pass a literal.
+ */
+ label?: string
+ /** i18n key passed to `t(...)` at render time. Takes precedence over `label`. */
+ labelKey?: string
/**
* Path template, prefixed with `/$storeId` at render time. Pass paths like
* `'/orders'`, NOT `/store_abc/orders`. The leading slash is required.
@@ -99,6 +106,52 @@ function ensureUniqueKey(key: string) {
}
}
+/**
+ * The label shape both nav registries share: a translation key, or a literal
+ * for plugins that ship no translation bundle of their own.
+ */
+export interface LabelledEntry {
+ key: string
+ label?: string
+ labelKey?: string
+}
+
+/** Throws unless the entry can produce a visible label. */
+export function ensureLabelled(entry: LabelledEntry, kind = 'Nav entry') {
+ if (!entry.label && !entry.labelKey) {
+ throw new Error(`${kind} "${entry.key}" must define either "label" or "labelKey".`)
+ }
+}
+
+/**
+ * Resolve an entry's visible label. Prefer this over inlining the ternary —
+ * the fallbacks used to disagree between call sites, so an entry registered
+ * with neither field rendered blank on one surface and its key on another.
+ *
+ * @param entry Entry from either nav registry.
+ * @param t Translation function used to resolve `labelKey`.
+ * @returns The translated label, the literal, or the key as a last resort.
+ */
+export function resolveNavLabel(entry: LabelledEntry, t: (key: string) => string): string {
+ return entry.labelKey ? t(entry.labelKey) : (entry.label ?? entry.key)
+}
+
+/** Same contract as `resolveNavLabel` for the optional description pair. */
+export function resolveNavDescription(
+ entry: { description?: string; descriptionKey?: string },
+ t: (key: string) => string,
+): string | undefined {
+ return entry.descriptionKey ? t(entry.descriptionKey) : entry.description
+}
+
+/**
+ * Whether `pathname` is `url` or sits beneath it. The `/` boundary matters:
+ * a bare `startsWith` makes `/orders` match `/orders-archive`.
+ */
+export function isPathWithin(pathname: string, url: string): boolean {
+ return pathname === url || pathname.startsWith(`${url}/`)
+}
+
// ============================================================================
// Public API
// ============================================================================
@@ -106,6 +159,7 @@ function ensureUniqueKey(key: string) {
export const nav: NavMutator = {
add(entry) {
ensureUniqueKey(entry.key)
+ ensureLabelled(entry)
entries.push(entry)
notify()
},
@@ -118,6 +172,9 @@ export const nav: NavMutator = {
update(key, patch) {
const e = entries.find((x) => x.key === key)
if (!e) throw new Error(`Nav entry "${key}" not found.`)
+ // Validate a copy before touching the stored entry: a patch that removes
+ // both label fields must leave the registry as it was, not half-applied.
+ ensureLabelled({ ...e, ...patch })
Object.assign(e, patch)
notify()
},
@@ -125,6 +182,7 @@ export const nav: NavMutator = {
const i = findIndex(targetKey)
if (i === -1) throw new Error(`Nav entry "${targetKey}" not found.`)
ensureUniqueKey(entry.key)
+ ensureLabelled(entry)
// Inherit target's position so the relative order survives `getNavEntries`'s sort.
const target = entries[i]
const adjusted: NavEntry = {
@@ -138,6 +196,7 @@ export const nav: NavMutator = {
const i = findIndex(targetKey)
if (i === -1) throw new Error(`Nav entry "${targetKey}" not found.`)
ensureUniqueKey(entry.key)
+ ensureLabelled(entry)
const target = entries[i]
const adjusted: NavEntry = {
...entry,
@@ -148,6 +207,7 @@ export const nav: NavMutator = {
},
addChild(parentKey, child) {
const parent = requireEntry(parentKey)
+ ensureLabelled(child)
if (parent.children?.some((c) => c.key === child.key)) {
throw new Error(
`Nav child "${child.key}" already exists under "${parentKey}". Use nav.updateChild().`,
@@ -175,6 +235,7 @@ export const nav: NavMutator = {
// reference-equality memoization on the item component.
const next = [...parent.children]
next[idx] = { ...next[idx], ...patch }
+ ensureLabelled(next[idx])
parent.children = next
notify()
},
diff --git a/packages/dashboard-core/src/lib/settings-nav-registry.ts b/packages/dashboard-core/src/lib/settings-nav-registry.ts
index db07d3ba41..67889e119c 100644
--- a/packages/dashboard-core/src/lib/settings-nav-registry.ts
+++ b/packages/dashboard-core/src/lib/settings-nav-registry.ts
@@ -1,5 +1,6 @@
import type { LucideIcon } from 'lucide-react'
import { useSyncExternalStore } from 'react'
+import { ensureLabelled, resolveNavDescription, resolveNavLabel } from './nav-registry'
import type { ActionName, SubjectName } from './permissions'
/**
@@ -22,6 +23,19 @@ export interface SettingsNavEntry {
label?: string
/** i18n key passed to `t(...)` at render time. Takes precedence over `label`. */
labelKey?: string
+ /**
+ * One-line summary of what the page is for. Shown on the settings landing
+ * page under the entry's label; the sidebar ignores it.
+ */
+ description?: string
+ /** i18n key for `description`, resolved at render. Takes precedence over it. */
+ descriptionKey?: string
+ /**
+ * Extra terms that match this entry in settings search, beyond its label.
+ * Merchants search for the word they know ("VAT", "SKU", "CORS") rather than
+ * the page's name, so list those synonyms here.
+ */
+ keywords?: string[]
/**
* Path template, prefixed with `/$storeId/settings` at render time. Pass paths
* like `'/general'` or `'/staff'`, NOT `/store_abc/settings/general`. The
@@ -88,9 +102,7 @@ function notify() {
export const settingsNav: SettingsNavMutator = {
add(entry) {
- if (!entry.label && !entry.labelKey) {
- throw new Error(`Settings nav entry "${entry.key}" must define either "label" or "labelKey".`)
- }
+ ensureLabelled(entry, 'Settings nav entry')
if (entries.some((e) => e.key === entry.key)) {
throw new Error(`Settings nav entry "${entry.key}" already registered.`)
}
@@ -106,17 +118,14 @@ export const settingsNav: SettingsNavMutator = {
update(key, patch) {
const e = entries.find((x) => x.key === key)
if (!e) throw new Error(`Settings nav entry "${key}" not found.`)
+ // Validate a copy before touching the stored entry: a patch that removes
+ // both label fields must leave the registry as it was, not half-applied.
+ ensureLabelled({ ...e, ...patch }, 'Settings nav entry')
Object.assign(e, patch)
- // Re-validate the merged entry — the patch could remove both label fields.
- if (!e.label && !e.labelKey) {
- throw new Error(`Settings nav entry "${e.key}" must define either "label" or "labelKey".`)
- }
notify()
},
addGroup(group) {
- if (!group.label && !group.labelKey) {
- throw new Error(`Settings nav group "${group.key}" must define either "label" or "labelKey".`)
- }
+ ensureLabelled(group, 'Settings nav group')
if (groups.some((g) => g.key === group.key)) {
throw new Error(`Settings nav group "${group.key}" already registered.`)
}
@@ -157,6 +166,68 @@ export function useSettingsNav() {
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot)
}
+/**
+ * Whether a settings entry matches a search term. Label, description and the
+ * entry's own `keywords` all count, so the word a merchant knows ("VAT",
+ * "CORS") reaches the page named something else. Shared by the settings
+ * sidebar and the settings landing page so both filter identically.
+ *
+ * @param entry Entry to test.
+ * @param term Search text; matching is case-insensitive and ignores surrounding space.
+ * @param t Translation function used to resolve `labelKey`/`descriptionKey`.
+ * @returns True when the entry matches, or when the term is blank.
+ */
+export function settingsEntryMatches(
+ entry: SettingsNavEntry,
+ term: string,
+ t: (key: string) => string,
+): boolean {
+ const needle = term.trim().toLowerCase()
+ if (!needle) return true
+
+ const haystack = [
+ resolveNavLabel(entry, t),
+ resolveNavDescription(entry, t),
+ ...(entry.keywords ?? []),
+ ]
+ return haystack.some((value) => value?.toLowerCase().includes(needle))
+}
+
+/**
+ * Drop entries the current staff member cannot reach. Exported because the
+ * sidebar and the settings landing page must agree on what a role can see —
+ * a private copy on either surface is how one starts showing a card the other
+ * hides.
+ */
+export function filterSettingsByPermissions(
+ snapshot: SettingsNavSnapshot,
+ permissions: { can: (action: string, subject: string) => boolean },
+): SettingsNavSnapshot {
+ return regroup(snapshot, (entry) =>
+ !entry.subject ? true : permissions.can(entry.action ?? 'read', entry.subject),
+ )
+}
+
+/** Narrow the nav to entries matching the merchant's search. */
+export function filterSettingsByQuery(
+ snapshot: SettingsNavSnapshot,
+ query: string,
+ t: (key: string) => string,
+): SettingsNavSnapshot {
+ return regroup(snapshot, (entry) => settingsEntryMatches(entry, query, t))
+}
+
+/** Rebuild a snapshot from the entries passing `keep`, dropping emptied groups. */
+function regroup(
+ snapshot: SettingsNavSnapshot,
+ keep: (entry: SettingsNavEntry) => boolean,
+): SettingsNavSnapshot {
+ const groups = snapshot.groups
+ .map(({ group, entries }) => ({ group, entries: entries.filter(keep) }))
+ .filter((g) => g.entries.length > 0)
+ return { groups, all: groups.flatMap((g) => g.entries) }
+}
+
/**
* Whether any settings entry is reachable for these permissions. The Settings
* launcher in the primary sidebar uses this so a role with no settings
diff --git a/packages/dashboard-core/src/locales/ar.json b/packages/dashboard-core/src/locales/ar.json
index f35895d370..0c1a9f95bf 100644
--- a/packages/dashboard-core/src/locales/ar.json
+++ b/packages/dashboard-core/src/locales/ar.json
@@ -80,7 +80,8 @@
"breadcrumb_more": "المزيد",
"sidebar": "الشريط الجانبي",
"sidebar_description": "يعرض الشريط الجانبي للجوال.",
- "store_switcher": "تبديل المتجر"
+ "store_switcher": "تبديل المتجر",
+ "bulk_actions": "إجراءات جماعية"
},
"common": {
"loading": "جارٍ التحميل…",
@@ -111,7 +112,8 @@
"default": "افتراضي",
"cancel": "إلغاء",
"empty_value": "—",
- "retry": "أعد المحاولة"
+ "retry": "أعد المحاولة",
+ "clear": "مسح"
},
"color_picker": {
"no_color": "بدون لون"
diff --git a/packages/dashboard-core/src/locales/de.json b/packages/dashboard-core/src/locales/de.json
index e24aa1a432..0e5a286946 100644
--- a/packages/dashboard-core/src/locales/de.json
+++ b/packages/dashboard-core/src/locales/de.json
@@ -80,7 +80,8 @@
"breadcrumb_more": "Mehr",
"sidebar": "Seitenleiste",
"sidebar_description": "Zeigt die mobile Seitenleiste an.",
- "store_switcher": "Store wechseln"
+ "store_switcher": "Store wechseln",
+ "bulk_actions": "Massenaktionen"
},
"common": {
"loading": "Wird geladen…",
@@ -111,7 +112,8 @@
"default": "Standard",
"cancel": "Abbrechen",
"empty_value": "—",
- "retry": "Erneut versuchen"
+ "retry": "Erneut versuchen",
+ "clear": "Löschen"
},
"color_picker": {
"no_color": "Keine Farbe"
diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.json
index 72de749efe..fbefaa2800 100644
--- a/packages/dashboard-core/src/locales/en.json
+++ b/packages/dashboard-core/src/locales/en.json
@@ -80,7 +80,8 @@
"breadcrumb_more": "More",
"sidebar": "Sidebar",
"sidebar_description": "Displays the mobile sidebar.",
- "store_switcher": "Switch store"
+ "store_switcher": "Switch store",
+ "bulk_actions": "Bulk actions"
},
"common": {
"loading": "Loading…",
@@ -111,7 +112,8 @@
"default": "Default",
"cancel": "Cancel",
"empty_value": "—",
- "retry": "Try again"
+ "retry": "Try again",
+ "clear": "Clear"
},
"color_picker": {
"no_color": "No color"
diff --git a/packages/dashboard-core/src/locales/fr.json b/packages/dashboard-core/src/locales/fr.json
index b9cf1a5120..ff78b89e22 100644
--- a/packages/dashboard-core/src/locales/fr.json
+++ b/packages/dashboard-core/src/locales/fr.json
@@ -80,7 +80,8 @@
"breadcrumb_more": "Plus",
"sidebar": "Barre latérale",
"sidebar_description": "Affiche la barre latérale mobile.",
- "store_switcher": "Changer de boutique"
+ "store_switcher": "Changer de boutique",
+ "bulk_actions": "Actions groupées"
},
"common": {
"loading": "Chargement…",
@@ -111,7 +112,8 @@
"default": "Par défaut",
"cancel": "Annuler",
"empty_value": "—",
- "retry": "Réessayer"
+ "retry": "Réessayer",
+ "clear": "Effacer"
},
"color_picker": {
"no_color": "Aucune couleur"
diff --git a/packages/dashboard-core/src/locales/pl.json b/packages/dashboard-core/src/locales/pl.json
index af0fee95e1..a807ce2ed6 100644
--- a/packages/dashboard-core/src/locales/pl.json
+++ b/packages/dashboard-core/src/locales/pl.json
@@ -80,7 +80,8 @@
"breadcrumb_more": "Więcej",
"sidebar": "Panel boczny",
"sidebar_description": "Wyświetla mobilny panel boczny.",
- "store_switcher": "Przełącz sklep"
+ "store_switcher": "Przełącz sklep",
+ "bulk_actions": "Akcje zbiorcze"
},
"common": {
"loading": "Ładowanie…",
@@ -111,7 +112,8 @@
"default": "Domyślny",
"cancel": "Anuluj",
"empty_value": "—",
- "retry": "Spróbuj ponownie"
+ "retry": "Spróbuj ponownie",
+ "clear": "Wyczyść"
},
"color_picker": {
"no_color": "Brak koloru"
diff --git a/packages/dashboard-core/src/locales/zh-CN.json b/packages/dashboard-core/src/locales/zh-CN.json
index a8bae8894b..5a038aeb80 100644
--- a/packages/dashboard-core/src/locales/zh-CN.json
+++ b/packages/dashboard-core/src/locales/zh-CN.json
@@ -80,7 +80,8 @@
"breadcrumb_more": "更多",
"sidebar": "侧边栏",
"sidebar_description": "显示移动端侧边栏。",
- "store_switcher": "切换店铺"
+ "store_switcher": "切换店铺",
+ "bulk_actions": "批量操作"
},
"common": {
"loading": "加载中…",
@@ -111,7 +112,8 @@
"default": "默认",
"cancel": "取消",
"empty_value": "—",
- "retry": "重试"
+ "retry": "重试",
+ "clear": "清除"
},
"color_picker": {
"no_color": "无颜色"
diff --git a/packages/dashboard-core/tests/nav-labels.test.ts b/packages/dashboard-core/tests/nav-labels.test.ts
new file mode 100644
index 0000000000..a0d4b50336
--- /dev/null
+++ b/packages/dashboard-core/tests/nav-labels.test.ts
@@ -0,0 +1,56 @@
+import { afterEach, describe, expect, it } from 'vitest'
+import { __getNavEntries, __resetNavRegistry, nav } from '../src/lib/nav-registry'
+
+afterEach(() => {
+ __resetNavRegistry()
+})
+
+describe('nav registry labels', () => {
+ it('accepts an entry defined with labelKey and no literal label', () => {
+ nav.add({ key: 'orders', labelKey: 'admin.nav.orders', path: '/orders' })
+
+ expect(__getNavEntries()[0]).toMatchObject({
+ key: 'orders',
+ labelKey: 'admin.nav.orders',
+ })
+ })
+
+ it('still accepts a literal label, for plugins without translation bundles', () => {
+ nav.add({ key: 'reviews', label: 'Reviews', path: '/reviews' })
+
+ expect(__getNavEntries()[0].label).toBe('Reviews')
+ })
+
+ it('rejects an entry carrying neither label nor labelKey', () => {
+ expect(() => nav.add({ key: 'nameless', path: '/nameless' })).toThrow(
+ /must define either "label" or "labelKey"/,
+ )
+ })
+
+ it('rejects a patch that strips both label fields off an existing entry', () => {
+ nav.add({ key: 'orders', labelKey: 'admin.nav.orders', path: '/orders' })
+
+ expect(() => nav.update('orders', { labelKey: undefined })).toThrow(
+ /must define either "label" or "labelKey"/,
+ )
+ })
+
+ it('rejects an unlabelled child', () => {
+ nav.add({ key: 'orders', labelKey: 'admin.nav.orders', path: '/orders' })
+
+ expect(() => nav.addChild('orders', { key: 'orders.drafts', path: '/orders/drafts' })).toThrow(
+ /must define either "label" or "labelKey"/,
+ )
+ })
+
+ it('rejects unlabelled entries inserted relative to another', () => {
+ nav.add({ key: 'orders', labelKey: 'admin.nav.orders', path: '/orders' })
+
+ expect(() => nav.insertBefore('orders', { key: 'a', path: '/a' })).toThrow(
+ /must define either "label" or "labelKey"/,
+ )
+ expect(() => nav.insertAfter('orders', { key: 'b', path: '/b' })).toThrow(
+ /must define either "label" or "labelKey"/,
+ )
+ })
+})
diff --git a/packages/dashboard-core/tests/plugin-nav.test.ts b/packages/dashboard-core/tests/plugin-nav.test.ts
index 4703ad8e7e..f8fd1909d9 100644
--- a/packages/dashboard-core/tests/plugin-nav.test.ts
+++ b/packages/dashboard-core/tests/plugin-nav.test.ts
@@ -133,6 +133,16 @@ describe('nav child mutators', () => {
expect(() => nav.updateChild('products', 'nope', { label: 'X' })).toThrow(/not found/)
})
+ it('leaves the entry untouched when an update would strip its label', () => {
+ const before = __getNavEntries().find((e) => e.key === 'products')?.label
+
+ expect(() => nav.update('products', { label: undefined, labelKey: undefined })).toThrow()
+
+ // A rejected patch must not be half-applied: an entry left with no label
+ // renders as its raw key on every surface that reads the registry.
+ expect(__getNavEntries().find((e) => e.key === 'products')?.label).toBe(before)
+ })
+
it('addChild rejects a duplicate child key', () => {
expect(() =>
nav.addChild('products', {
diff --git a/packages/dashboard-core/tests/settings-nav-search.test.ts b/packages/dashboard-core/tests/settings-nav-search.test.ts
new file mode 100644
index 0000000000..4cc7a61658
--- /dev/null
+++ b/packages/dashboard-core/tests/settings-nav-search.test.ts
@@ -0,0 +1,54 @@
+import { describe, expect, it } from 'vitest'
+import { type SettingsNavEntry, settingsEntryMatches } from '../src/lib/settings-nav-registry'
+
+/** Stands in for i18next — returns the last segment of the key. */
+const t = (key: string) => key.split('.').pop() ?? key
+
+const taxRates: SettingsNavEntry = {
+ key: 'settings.tax-rates',
+ labelKey: 'admin.settings_nav.items.tax_rates',
+ descriptionKey: 'admin.settings_nav.descriptions.rates_per_region',
+ keywords: ['vat', 'gst', 'sales tax'],
+ path: '/tax-rates',
+ group: 'selling',
+}
+
+describe('settingsEntryMatches', () => {
+ it('matches on a keyword the label does not contain', () => {
+ expect(settingsEntryMatches(taxRates, 'vat', t)).toBe(true)
+ expect(settingsEntryMatches(taxRates, 'gst', t)).toBe(true)
+ })
+
+ it('matches on the resolved label', () => {
+ expect(settingsEntryMatches(taxRates, 'tax_rates', t)).toBe(true)
+ })
+
+ it('matches on the resolved description', () => {
+ expect(settingsEntryMatches(taxRates, 'region', t)).toBe(true)
+ })
+
+ it('ignores case and surrounding space', () => {
+ expect(settingsEntryMatches(taxRates, ' VAT ', t)).toBe(true)
+ })
+
+ it('rejects a term appearing nowhere', () => {
+ expect(settingsEntryMatches(taxRates, 'webhooks', t)).toBe(false)
+ })
+
+ it('treats a blank term as matching everything, so an empty box hides nothing', () => {
+ expect(settingsEntryMatches(taxRates, '', t)).toBe(true)
+ expect(settingsEntryMatches(taxRates, ' ', t)).toBe(true)
+ })
+
+ it('handles an entry with a literal label and no keywords', () => {
+ const plugin: SettingsNavEntry = {
+ key: 'p',
+ label: 'Reviews',
+ path: '/reviews',
+ group: 'store',
+ }
+
+ expect(settingsEntryMatches(plugin, 'review', t)).toBe(true)
+ expect(settingsEntryMatches(plugin, 'vat', t)).toBe(false)
+ })
+})
diff --git a/packages/dashboard-starter/vite.config.ts b/packages/dashboard-starter/vite.config.ts
index 5ccf6e2c01..857d367c19 100644
--- a/packages/dashboard-starter/vite.config.ts
+++ b/packages/dashboard-starter/vite.config.ts
@@ -27,9 +27,18 @@ export default defineConfig(({ mode }) => {
// target, not VITE_SPREE_API_URL — that switches the SDK to absolute
// cross-origin URLs and bypasses this proxy (see .env.example).
server: {
+ // Reachable from a phone on the same network (`vite --host`) or through
+ // a tunnel: Vite otherwise rejects any request whose Host header it does
+ // not recognise. Dev server only — this file is not used for builds.
+ allowedHosts: ['.localhost', '.trycloudflare.com', '.ngrok-free.app'],
proxy: {
- '/api': { target: proxyTarget, changeOrigin: true },
- '/rails': { target: proxyTarget, changeOrigin: true },
+ // `secure: false`: the worktree's Rails URL is served by portless
+ // behind a self-signed certificate, which Node refuses by default —
+ // the proxy fails with "self-signed certificate in certificate
+ // chain". Scoped to these two dev-only proxy routes rather than
+ // disabling TLS verification for the whole process.
+ '/api': { target: proxyTarget, changeOrigin: true, secure: false },
+ '/rails': { target: proxyTarget, changeOrigin: true, secure: false },
},
},
}
diff --git a/packages/dashboard-ui/package.json b/packages/dashboard-ui/package.json
index 03dde09a8a..557b521935 100644
--- a/packages/dashboard-ui/package.json
+++ b/packages/dashboard-ui/package.json
@@ -73,7 +73,6 @@
"react-colorful": "^5.7.0",
"react-day-picker": "^9.14.0",
"recharts": "^3.8.1",
- "sonner": "^2.0.7",
"tailwind-merge": "^3.5.0",
"tw-animate-css": "^1.4.0"
},
diff --git a/packages/dashboard-ui/src/index.ts b/packages/dashboard-ui/src/index.ts
index ee42de3528..61e31fcce2 100644
--- a/packages/dashboard-ui/src/index.ts
+++ b/packages/dashboard-ui/src/index.ts
@@ -54,6 +54,7 @@ export * from './spree/resource-name-cell'
export * from './spree/route-error-boundary'
export * from './spree/row-actions'
export * from './spree/row-click-bridge'
+export * from './spree/search-input'
export * from './spree/secret-input'
export * from './spree/storefront-visible-switch'
export * from './spree/tag-list'
@@ -96,8 +97,8 @@ export * from './ui/sheet'
export * from './ui/sidebar'
export * from './ui/skeleton'
export * from './ui/slot'
-export * from './ui/sonner'
export * from './ui/switch'
export * from './ui/textarea'
export * from './ui/thumbnail'
+export * from './ui/toast'
export * from './ui/tooltip'
diff --git a/packages/dashboard-ui/src/spree/bulk-dialog.tsx b/packages/dashboard-ui/src/spree/bulk-dialog.tsx
index 84f941c009..e6a149f49b 100644
--- a/packages/dashboard-ui/src/spree/bulk-dialog.tsx
+++ b/packages/dashboard-ui/src/spree/bulk-dialog.tsx
@@ -57,10 +57,10 @@ export function BulkDialog({
<FieldGroup>{children}</FieldGroup>
</DialogBody>
<DialogFooter>
- <Button type="button" variant="outline" size="sm" onClick={onCancel}>
+ <Button type="button" variant="outline" onClick={onCancel}>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={submitDisabled}>
+ <Button type="submit" disabled={submitDisabled}>
{submitLabel}
</Button>
</DialogFooter>
diff --git a/packages/dashboard-ui/src/spree/bulk-price-table.tsx b/packages/dashboard-ui/src/spree/bulk-price-table.tsx
index ce7d73c8e3..89ab01d31b 100644
--- a/packages/dashboard-ui/src/spree/bulk-price-table.tsx
+++ b/packages/dashboard-ui/src/spree/bulk-price-table.tsx
@@ -1,8 +1,8 @@
import type { ColumnDef } from '@tanstack/react-table'
import { useMemo } from 'react'
import { Button } from '../ui/button'
-import { Input } from '../ui/input'
import { DataGrid, editableRowIndex, MoneyCell, ReadOnlyCell } from './data-grid'
+import { SearchInput } from './search-input'
export interface BulkPriceRow {
// Unique row id. For header rows use a synthetic key (e.g. `header:<groupId>`);
@@ -33,6 +33,8 @@ export interface BulkPriceTableLabels {
variantDefault: string
/** Placeholder text for the search input. Omit to hide the search input. */
searchPlaceholder?: string
+ /** Accessible name for the search field's clear button. */
+ clearSearch?: string
/** A short message shown above the grid summarising the matching row count. */
countSummary?: string
/** Shown when the loading flag is set. */
@@ -187,11 +189,11 @@ export function BulkPriceTable({
<p className="text-xs text-muted-foreground">{labels.countSummary}</p>
)}
{onSearchChange !== undefined && labels.searchPlaceholder !== undefined && (
- <Input
- type="search"
+ <SearchInput
placeholder={labels.searchPlaceholder}
value={search ?? ''}
- onChange={(e) => onSearchChange(e.target.value)}
+ onValueChange={onSearchChange}
+ clearLabel={labels.clearSearch}
className="h-9 max-w-sm"
/>
)}
diff --git a/packages/dashboard-ui/src/spree/form-actions.tsx b/packages/dashboard-ui/src/spree/form-actions.tsx
index 6224510db0..42d7ca9a94 100644
--- a/packages/dashboard-ui/src/spree/form-actions.tsx
+++ b/packages/dashboard-ui/src/spree/form-actions.tsx
@@ -31,7 +31,7 @@ export function FormSaveButton<TFieldValues extends FieldValues>({
const { isDirty, isSubmitting } = useFormState({ control: form.control })
return (
- <Button type="submit" size="sm" disabled={!isDirty || isSubmitting}>
+ <Button type="submit" disabled={!isDirty || isSubmitting}>
{isSubmitting && <Loader2Icon className="animate-spin" />}
{isSubmitting
? (savingLabel ?? t('admin.actions.saving'))
@@ -65,7 +65,6 @@ export function FormDiscardButton<TFieldValues extends FieldValues>({
return (
<Button
type="button"
- size="sm"
variant="outline"
disabled={isSubmitting}
onClick={onDiscard ?? (() => form.reset())}
diff --git a/packages/dashboard-ui/src/spree/search-input.tsx b/packages/dashboard-ui/src/spree/search-input.tsx
new file mode 100644
index 0000000000..11c4d3f539
--- /dev/null
+++ b/packages/dashboard-ui/src/spree/search-input.tsx
@@ -0,0 +1,76 @@
+import { SearchIcon, XIcon } from 'lucide-react'
+import type * as React from 'react'
+import { useRef } from 'react'
+import { cn } from '../lib/utils'
+import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from '../ui/input-group'
+
+/**
+ * Search box with a leading magnifier and our own clear button.
+ *
+ * The clear button is hand-rolled rather than `type="search"`'s native one:
+ * that control is unstyleable, ignores the design tokens, renders at a size no
+ * touch guideline would accept, and Safari on iOS omits it entirely — so on a
+ * phone the field could not be cleared at all. The input stays `type="text"`
+ * to keep the native affordance from rendering alongside this one, and carries
+ * `role="searchbox"` so it still announces as a search field — the role a
+ * `type="search"` input would have given it for free.
+ *
+ * Clearing returns focus to the field, since the user is almost always about
+ * to type a different query.
+ */
+export function SearchInput({
+ value,
+ onValueChange,
+ className,
+ clearLabel = 'Clear search',
+ ...props
+}: Omit<React.ComponentProps<'input'>, 'value' | 'onChange' | 'type' | 'className'> & {
+ value: string
+ onValueChange: (value: string) => void
+ /** Sizing and surface for the whole field. The input fills it. */
+ className?: string
+ /** Accessible name for the clear button. */
+ clearLabel?: string
+}) {
+ const inputRef = useRef<HTMLInputElement>(null)
+
+ return (
+ <InputGroup className={className}>
+ <InputGroupAddon>
+ <SearchIcon className="size-4" />
+ </InputGroupAddon>
+ {/* `h-full` so callers size the field once, on the wrapper, rather than
+ repeating the same height rule on both. */}
+ <InputGroupInput
+ ref={inputRef}
+ type="text"
+ role="searchbox"
+ value={value}
+ onChange={(event) => onValueChange(event.target.value)}
+ className="h-full"
+ {...props}
+ />
+ {value && (
+ <InputGroupAddon align="inline-end">
+ <InputGroupButton
+ // `icon-sm` rather than the default `xs`: that variant hardcodes
+ // `h-6`, which tailwind-merge cannot reconcile against a `size-*`
+ // override, so the button would stay 24px however it was classed.
+ size="icon-sm"
+ aria-label={clearLabel}
+ onClick={() => {
+ onValueChange('')
+ inputRef.current?.focus()
+ }}
+ // Touch-sized by default and only compact from `md` up, so a phone
+ // always gets the larger target whether or not the field happens to
+ // sit inside the mobile drawer. The glyph stays small either way.
+ className={cn('size-9 rounded-full md:size-6 in-data-[mobile=true]:size-9')}
+ >
+ <XIcon className="size-4" />
+ </InputGroupButton>
+ </InputGroupAddon>
+ )}
+ </InputGroup>
+ )
+}
diff --git a/packages/dashboard-ui/src/spree/secret-input.tsx b/packages/dashboard-ui/src/spree/secret-input.tsx
index f778e39b2c..dff8544819 100644
--- a/packages/dashboard-ui/src/spree/secret-input.tsx
+++ b/packages/dashboard-ui/src/spree/secret-input.tsx
@@ -108,7 +108,7 @@ export function SecretInput({
<Button
type="button"
size="sm"
- variant="ghost"
+ variant="outline"
onClick={() => {
onChange(pendingMask)
setPendingMask(null)
diff --git a/packages/dashboard-ui/src/styles.css b/packages/dashboard-ui/src/styles.css
index 26d46df1ab..feabe61ba7 100644
--- a/packages/dashboard-ui/src/styles.css
+++ b/packages/dashboard-ui/src/styles.css
@@ -454,6 +454,57 @@
outline: none;
}
+ /* iOS Safari zooms the viewport when a focused text field's font is under
+ * 16px, and this app's `text-base` is 14px — so tapping any input on an
+ * iPhone jumped the page and left it zoomed. Raise the rendered size on
+ * coarse pointers only; the desktop density is unchanged.
+ *
+ * `pointer: coarse` rather than a width breakpoint: this is about the input
+ * method, and a small window on a laptop should keep the compact type. */
+ /* Nav rows and menu labels read small on a phone at the desktop 14px.
+ * 16px is the size the platform uses for a primary list row. Sizing is left
+ * to the components themselves — buttons carry their own touch targets. */
+ @media (pointer: coarse) {
+ [data-slot='sidebar-menu-button'],
+ [data-slot='sidebar-menu-sub-button'],
+ [data-slot='dropdown-menu-item'],
+ [data-slot='select-item'],
+ [data-slot='command-item'] {
+ font-size: 1rem !important;
+ }
+ }
+
+ /* Menu and listbox rows are sized for a pointer — roughly 29px, against a
+ * 44pt touch minimum — so on a phone they are hard to hit and easy to hit
+ * wrongly. Raise them on coarse pointers only; the dense desktop menus are
+ * unchanged. Same `!important` reasoning as the font-size rule below: these
+ * rows carry utility classes that outrank any selector written here. */
+ @media (pointer: coarse) {
+ [data-slot='dropdown-menu-item'],
+ [data-slot='dropdown-menu-checkbox-item'],
+ [data-slot='dropdown-menu-radio-item'],
+ [data-slot='dropdown-menu-sub-trigger'],
+ [data-slot='select-item'],
+ [data-slot='command-item'],
+ [data-slot='combobox-item'] {
+ min-height: 2.75rem !important;
+ }
+ }
+
+ @media (pointer: coarse) {
+ /* `!important` is load-bearing here, not laziness: these controls carry a
+ * `text-*` utility class, which outranks any element selector this rule
+ * could write. Without it the declaration loses to `.text-base` and the
+ * zoom still happens. The rule is deliberately narrow — one property, on
+ * text-entry controls, under a coarse pointer. */
+ input:not([type='checkbox']):not([type='radio']),
+ textarea,
+ select,
+ [contenteditable] {
+ font-size: max(1rem, var(--text-base)) !important;
+ }
+ }
+
html {
@apply font-sans antialiased;
text-rendering: optimizeLegibility;
diff --git a/packages/dashboard-ui/src/ui/card.tsx b/packages/dashboard-ui/src/ui/card.tsx
index 73851fb9d3..39878ae30e 100644
--- a/packages/dashboard-ui/src/ui/card.tsx
+++ b/packages/dashboard-ui/src/ui/card.tsx
@@ -7,7 +7,12 @@ function Card({ className, ...props }: React.ComponentProps<'div'>) {
<div
data-slot="card"
className={cn(
- 'group/card flex flex-col min-w-0 break-words bg-card text-card-foreground border border-border rounded-xl shadow-sm',
+ // `overflow-x-clip`: a wide child (a table sized to its columns) otherwise
+ // propagates its width up through every `overflow: visible` ancestor to
+ // the document, laying the whole page out wider than the viewport. `clip`
+ // rather than `hidden` so `overflow-y` stays `visible` and sticky
+ // descendants keep resolving against the page.
+ 'group/card flex flex-col min-w-0 overflow-x-clip break-words bg-card text-card-foreground border border-border rounded-xl shadow-xs',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/combobox.tsx b/packages/dashboard-ui/src/ui/combobox.tsx
index 4bd3b7c8ac..a9e932b33e 100644
--- a/packages/dashboard-ui/src/ui/combobox.tsx
+++ b/packages/dashboard-ui/src/ui/combobox.tsx
@@ -286,7 +286,7 @@ function ComboboxChips({
// resize lets the positioner follow the anchor smoothly; making it
// instant jumps the open popup out from under the pointer, so the next
// option click lands on nothing.
- 'flex flex-wrap items-center gap-1 rounded-lg border border-border bg-card text-foreground shadow-xs px-2.5 py-1.5 text-base transition-all duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-aria-invalid:border-destructive has-data-[slot=combobox-chip]:px-1',
+ 'flex flex-wrap items-center gap-1.5 rounded-lg border border-border bg-card text-foreground shadow-xs px-2.5 py-1.5 text-base transition-all duration-100 ease-out focus-within:border-blue-500 focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] has-aria-invalid:border-destructive has-data-[slot=combobox-chip]:p-1.5',
className,
)}
{...props}
@@ -306,7 +306,10 @@ function ComboboxChip({
<ComboboxPrimitive.Chip
data-slot="combobox-chip"
className={cn(
- 'flex h-[calc(--spacing(5.25))] w-fit max-w-full items-center justify-center gap-1 rounded-sm bg-muted px-1.5 text-xs 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-0',
+ // Height comes from the content rather than a fixed 21px: the old value
+ // was shorter than the remove button inside it, and left the label with
+ // no vertical breathing room at any screen size.
+ 'flex min-h-8 w-fit max-w-full items-center justify-center gap-1 rounded-md bg-muted 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',
className,
)}
{...props}
@@ -314,8 +317,8 @@ function ComboboxChip({
<span className="min-w-0 truncate">{children}</span>
{showRemove && (
<ComboboxPrimitive.ChipRemove
- render={<Button variant="ghost" size="icon-xs" />}
- className="opacity-50 hover:opacity-100"
+ render={<Button variant="ghost" size="icon-sm" />}
+ className="size-6 shrink-0 opacity-50 hover:opacity-100"
data-slot="combobox-chip-remove"
// Names the chip it clears ("Remove Wholesale") rather than a bare
// "Remove": several sit side by side, and a dialog's own submit
diff --git a/packages/dashboard-ui/src/ui/command.tsx b/packages/dashboard-ui/src/ui/command.tsx
index 3dbb234a8c..5417676c30 100644
--- a/packages/dashboard-ui/src/ui/command.tsx
+++ b/packages/dashboard-ui/src/ui/command.tsx
@@ -45,7 +45,14 @@ function CommandDialog({
<DialogDescription>{description}</DialogDescription>
</DialogHeader>
<DialogContent
- className={cn('top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0', className)}
+ // `-translate-x-1/2` must be restated alongside `translate-y-0`: in
+ // Tailwind v4 both compile to the standalone `translate` property, so
+ // setting only the Y axis wipes the base dialog's horizontal centring
+ // and the panel drifts off both edges of a narrow screen.
+ className={cn(
+ 'top-1/3 -translate-x-1/2 translate-y-0 overflow-hidden rounded-xl! p-0',
+ className,
+ )}
showCloseButton={showCloseButton}
>
{children}
@@ -243,7 +250,9 @@ function CommandFooter({ className, children, ...props }: React.ComponentProps<'
<div
data-slot="command-footer"
className={cn(
- 'flex shrink-0 items-center justify-between gap-4 border-t border-border-subtle bg-muted text-muted-foreground px-4 py-2.5',
+ // Hidden on touch: the footer documents arrow/enter/esc shortcuts,
+ // which a phone has no keys for, and it costs 45px of a short viewport.
+ 'hidden shrink-0 items-center justify-between gap-4 border-t border-border-subtle bg-muted px-4 py-2.5 text-muted-foreground md:flex',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/data-table.tsx b/packages/dashboard-ui/src/ui/data-table.tsx
index 4da50a0780..1e8b422b0a 100644
--- a/packages/dashboard-ui/src/ui/data-table.tsx
+++ b/packages/dashboard-ui/src/ui/data-table.tsx
@@ -116,7 +116,7 @@ function Table({
// visible`, so sticky resolves against the page instead. Narrow viewports
// keep `auto`, where scrolling a wide table sideways matters more than a
// sticky header.
- <div className="overflow-x-auto md:overflow-x-clip">
+ <div className="@container/table-scroll overflow-x-auto md:overflow-x-clip">
<table
className={cn('w-full align-top text-foreground', roundedClasses, className)}
{...props}
@@ -132,7 +132,7 @@ function Table({
const tableClasses = cn('w-max min-w-full align-top text-foreground', roundedClasses, className)
return (
- <div className="relative">
+ <div className="relative min-w-0">
{/* 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. */}
@@ -148,7 +148,16 @@ function Table({
</table>
</div>
</div>
- <div ref={scrollRef} className="themed-scrollbar overflow-x-auto">
+ {/* `min-w-0`: without it this scroller keeps its default
+ `min-width: auto`, refuses to shrink below the table's intrinsic
+ width, and the overflow escapes to the document instead of scrolling
+ here — the whole page then lays out wider than the viewport. */}
+ <div
+ 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"
+ >
<table ref={bodyTableRef} className={tableClasses} {...props}>
{cloneElement(headerElement, {
// The sizer: reserves the header row and drives column widths. It
@@ -218,7 +227,7 @@ function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
return (
<th
className={cn(
- 'text-left text-sm font-medium text-muted-foreground bg-muted p-2 whitespace-nowrap first:pl-4 last:pr-4',
+ 'text-left text-sm font-medium text-muted-foreground bg-muted px-3 py-2.5 sm:p-2 whitespace-nowrap first:pl-4 last:pr-4',
'shadow-[inset_0_-1px_0_0_var(--border-subtle)]',
className,
)}
@@ -247,7 +256,10 @@ function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
return (
<td
className={cn(
- 'py-3 px-2 border-b border-border-subtle align-middle first:pl-4 last:pr-4',
+ // `h-16` on touch is a floor, not a fixed height: a table cell treats
+ // `height` as a minimum, so a row with a thumbnail or a wrapped
+ // second line still grows past it.
+ 'h-16 py-3 px-3 sm:h-auto sm:py-3 sm:px-2 border-b border-border-subtle align-middle first:pl-4 last:pr-4',
className,
)}
{...props}
@@ -259,7 +271,14 @@ function TableEmpty({ children, colSpan }: { children: ReactNode; colSpan: numbe
return (
<tr>
<td colSpan={colSpan} className="py-12 text-center text-muted-foreground">
- {children}
+ {/* The cell spans the table's full scroll width, so centring inside it
+ puts the message off-screen once the table is wider than its
+ container. `sticky left-0` pins this to the scroller's left edge and
+ `100cqw` sizes it to the scroller rather than the viewport — sizing
+ it to the viewport made the row itself the widest thing in the
+ table and produced a scrollbar on a list that had nothing to
+ scroll. */}
+ <div className="sticky left-0 flex w-[100cqw] justify-center">{children}</div>
</td>
</tr>
)
diff --git a/packages/dashboard-ui/src/ui/dialog.tsx b/packages/dashboard-ui/src/ui/dialog.tsx
index 57ff18f796..54af72471b 100644
--- a/packages/dashboard-ui/src/ui/dialog.tsx
+++ b/packages/dashboard-ui/src/ui/dialog.tsx
@@ -105,7 +105,7 @@ function DialogContent({
<DialogPrimitive.Popup
data-slot="dialog-content"
className={cn(
- 'fixed top-1/2 left-1/2 z-50 flex w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-card text-foreground text-sm shadow-lg duration-100 outline-none sm:max-w-[500px] 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]',
+ 'fixed top-1/2 left-1/2 z-50 flex w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-card text-foreground text-sm shadow-lg duration-100 outline-none sm:max-w-[min(500px,calc(100%-2rem))] 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,
)}
style={{ maxHeight: '90vh' }}
@@ -177,7 +177,7 @@ function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog
return (
<DialogPrimitive.Title
data-slot="dialog-title"
- className={cn('text-base font-medium', className)}
+ className={cn('text-lg font-medium', className)}
{...props}
/>
)
diff --git a/packages/dashboard-ui/src/ui/pagination.tsx b/packages/dashboard-ui/src/ui/pagination.tsx
index 92b6a65845..9f578dea54 100644
--- a/packages/dashboard-ui/src/ui/pagination.tsx
+++ b/packages/dashboard-ui/src/ui/pagination.tsx
@@ -38,16 +38,16 @@ export function Pagination({
return (
<div className="flex items-center justify-between border-t border-border-subtle pr-3 pl-4 py-2">
- <div className="text-sm text-muted-foreground">
+ <div className="whitespace-nowrap text-sm text-muted-foreground">
{t('admin.components.pagination.range', {
from: meta.from,
to: meta.to,
count: meta.count,
})}
</div>
- <div className="flex items-center gap-6">
+ <div className="flex items-center gap-2 sm:gap-6">
{onPageSizeChange && (
- <div className="flex items-center gap-2">
+ <div className="hidden items-center gap-2 sm:flex">
<span className="text-sm text-muted-foreground">
{t('admin.components.pagination.rows_per_page')}
</span>
@@ -70,7 +70,7 @@ export function Pagination({
)}
{meta.pages > 1 && (
<>
- <span className="text-sm text-muted-foreground">
+ <span className="hidden whitespace-nowrap text-sm text-muted-foreground sm:inline">
{t('admin.common.page_of', { page: meta.page, total: meta.pages })}
</span>
<div className="flex items-center gap-1">
@@ -87,6 +87,7 @@ export function Pagination({
<Button
size="icon-sm"
variant="outline"
+ className="size-9 sm:size-8"
disabled={!meta.previous}
onClick={() => meta.previous && onPageChange(meta.previous)}
>
@@ -96,6 +97,7 @@ export function Pagination({
<Button
size="icon-sm"
variant="outline"
+ className="size-9 sm:size-8"
disabled={!meta.next}
onClick={() => meta.next && onPageChange(meta.next)}
>
diff --git a/packages/dashboard-ui/src/ui/sheet.tsx b/packages/dashboard-ui/src/ui/sheet.tsx
index 738e99e359..a5707ccd59 100644
--- a/packages/dashboard-ui/src/ui/sheet.tsx
+++ b/packages/dashboard-ui/src/ui/sheet.tsx
@@ -144,7 +144,13 @@ function SheetContent({
<SheetPrimitive.Close
data-slot="sheet-close"
render={
- <Button variant="ghost" className="absolute top-3 right-3" size="icon-sm">
+ // `size-11` on touch: at `icon-sm`'s 28px this is well under the
+ // 44px minimum, and on a nav sheet it is the primary way out.
+ <Button
+ variant="ghost"
+ className="absolute top-2 right-2 size-11 md:top-3 md:right-3 md:size-7"
+ size="icon-sm"
+ >
<XIcon />
<span className="sr-only">{i18n.t('admin.actions.close')}</span>
</Button>
@@ -157,6 +163,14 @@ function SheetContent({
}
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
+ // different utility group from `sr-only`'s `absolute`), so the element stays
+ // 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')
+ if (srOnly) return <div data-slot="sheet-header" className={className} {...props} />
+
return (
<div
data-slot="sheet-header"
@@ -186,7 +200,7 @@ function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPr
return (
<SheetPrimitive.Title
data-slot="sheet-title"
- className={cn('text-base font-medium', className)}
+ className={cn('text-lg font-medium', className)}
{...props}
/>
)
diff --git a/packages/dashboard-ui/src/ui/sidebar.tsx b/packages/dashboard-ui/src/ui/sidebar.tsx
index 0aef44bd7c..788eaa0673 100644
--- a/packages/dashboard-ui/src/ui/sidebar.tsx
+++ b/packages/dashboard-ui/src/ui/sidebar.tsx
@@ -15,7 +15,20 @@ 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_MOBILE = '220px'
+/**
+ * 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
+ * unused while still cramping the labels. Exported so a second drawer (the
+ * settings nav sheet) matches this one instead of re-inlining the number.
+ */
+export const SIDEBAR_WIDTH_MOBILE = 'min(86vw, 360px)'
+
+/**
+ * Shared chrome for a mobile nav drawer — touch sizing, safe-area insets and
+ * the sidebar surface colours. Both drawers use it so a fix lands in one place.
+ */
+export const mobileDrawerClassName =
+ 'touch-manipulation bg-sidebar p-0 pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] text-sidebar-foreground'
const SIDEBAR_WIDTH_ICON = '59px'
const SIDEBAR_KEYBOARD_SHORTCUT = 'b'
@@ -199,7 +212,7 @@ function Sidebar({
data-sidebar="sidebar"
data-slot="sidebar"
data-mobile="true"
- className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
+ className={cn(mobileDrawerClassName, 'w-(--sidebar-width) [&>button]:hidden')}
style={
{
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
@@ -211,7 +224,11 @@ function Sidebar({
<SheetTitle>{i18n.t('admin.a11y.sidebar')}</SheetTitle>
<SheetDescription>{i18n.t('admin.a11y.sidebar_description')}</SheetDescription>
</SheetHeader>
- <div className="flex h-full w-full flex-col">{children}</div>
+ {/* `min-h-0` rather than `h-full`: the sheet carries safe-area
+ padding, and `h-full` resolves against its border box, so the
+ column ran past the bottom edge and clipped its last nav item
+ instead of letting `SidebarContent` scroll to it. */}
+ <div className="flex min-h-0 w-full flex-1 flex-col">{children}</div>
</SheetContent>
</Sheet>
)
@@ -344,7 +361,9 @@ function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>) {
data-slot="sidebar-header"
data-sidebar="header"
className={cn(
- 'flex flex-col gap-0 px-2 group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:items-center',
+ // 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',
className,
)}
{...props}
@@ -462,7 +481,9 @@ function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {
data-slot="sidebar-menu"
data-sidebar="menu"
className={cn(
- 'flex w-full min-w-0 flex-col gap-1 group-data-[collapsible=icon]:items-center',
+ // `gap-2` on touch: adjacent tap targets need 8px between them, and
+ // the rail's 4px is a pointer-precision value.
+ 'flex w-full min-w-0 flex-col gap-1 in-data-[mobile=true]:gap-2 group-data-[collapsible=icon]:items-center',
className,
)}
{...props}
@@ -496,8 +517,12 @@ const sidebarMenuButtonVariants = cva(
'bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',
},
size: {
- default: 'h-8 text-base',
- sm: 'h-7 text-xs',
+ // Inside the mobile drawer every row grows to a 48px touch target
+ // (iOS wants 44pt, Android 48dp) with a wider glyph to match. The
+ // desktop rail keeps its compact pointer-sized rows.
+ default:
+ 'h-8 text-base in-data-[mobile=true]:h-12 in-data-[mobile=true]:px-2 in-data-[mobile=true]:[&_svg]:size-5',
+ sm: 'h-7 text-xs in-data-[mobile=true]:h-11 in-data-[mobile=true]:text-sm',
lg: 'h-12 text-base group-data-[collapsible=icon]:p-0!',
},
},
@@ -676,7 +701,7 @@ function SidebarMenuSubButton({
data-size={size}
data-active={isActive}
className={cn(
- 'relative flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-xl p-1 text-sidebar-foreground/80 outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:shadow-[0_0_0_3px_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-xl p-1 text-sidebar-foreground/80 outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_15%,transparent)] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-base data-[size=sm]:text-xs data-active:font-semibold data-active:text-foreground data-active:bg-transparent data-active:shadow-none data-active:before:absolute data-active:before:-left-4 data-active:before:top-[10%] data-active:before:h-[80%] data-active:before:w-[3px] data-active:before:rounded-sm data-active:before:bg-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
className,
)}
{...props}
diff --git a/packages/dashboard-ui/src/ui/sonner.tsx b/packages/dashboard-ui/src/ui/sonner.tsx
deleted file mode 100644
index dc2d846eef..0000000000
--- a/packages/dashboard-ui/src/ui/sonner.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import {
- CircleCheckIcon,
- InfoIcon,
- Loader2Icon,
- OctagonXIcon,
- TriangleAlertIcon,
-} from 'lucide-react'
-import type { CSSProperties } from 'react'
-import { Toaster as Sonner, type ToasterProps } from 'sonner'
-import { useTheme } from '../spree/theme-provider'
-
-const Toaster = ({ ...props }: ToasterProps) => {
- // The shadcn-default Sonner template assumes `next-themes`. This app has its
- // own ThemeProvider that exposes a `mode` (the user's selection: light/dark/system)
- // — Sonner's `theme` prop accepts the same three values, so we forward it.
- const { mode } = useTheme()
-
- return (
- <Sonner
- theme={mode as ToasterProps['theme']}
- className="toaster group"
- icons={{
- success: <CircleCheckIcon className="size-4" />,
- info: <InfoIcon className="size-4" />,
- warning: <TriangleAlertIcon className="size-4" />,
- error: <OctagonXIcon className="size-4" />,
- loading: <Loader2Icon className="size-4 animate-spin" />,
- }}
- style={
- {
- '--normal-bg': 'var(--popover)',
- '--normal-text': 'var(--popover-foreground)',
- '--normal-border': 'var(--border)',
- '--border-radius': 'var(--radius)',
- } as CSSProperties
- }
- toastOptions={{
- classNames: {
- toast: 'cn-toast',
- },
- }}
- {...props}
- />
- )
-}
-
-export { Toaster }
diff --git a/packages/dashboard-ui/src/ui/toast.tsx b/packages/dashboard-ui/src/ui/toast.tsx
new file mode 100644
index 0000000000..af021eda9c
--- /dev/null
+++ b/packages/dashboard-ui/src/ui/toast.tsx
@@ -0,0 +1,112 @@
+'use client'
+
+import { Toast as ToastPrimitive } from '@base-ui/react/toast'
+import i18n from 'i18next'
+import {
+ CircleCheckIcon,
+ InfoIcon,
+ Loader2Icon,
+ OctagonXIcon,
+ TriangleAlertIcon,
+ XIcon,
+} from 'lucide-react'
+import type * as React from 'react'
+import { cn } from '../lib/utils'
+
+/**
+ * App-wide toast manager. Created outside React so a toast can be raised from
+ * anywhere — a mutation hook, an event subscriber, a plain async function —
+ * without threading a hook through the call stack.
+ *
+ * Raise one with `toastManager.add({ type: 'success', title: '…' })`. Passing
+ * an `id` that already exists updates that toast in place and restarts its
+ * timer, which is how a long-running job reports progress through a single
+ * toast rather than stacking one per step.
+ */
+export const toastManager = ToastPrimitive.createToastManager()
+
+const ICONS: Record<string, React.ReactNode> = {
+ success: <CircleCheckIcon className="size-4 text-emerald-600 dark:text-emerald-400" />,
+ error: <OctagonXIcon className="size-4 text-destructive" />,
+ warning: <TriangleAlertIcon className="size-4 text-amber-600 dark:text-amber-400" />,
+ info: <InfoIcon className="size-4 text-muted-foreground" />,
+ loading: <Loader2Icon className="size-4 animate-spin text-muted-foreground" />,
+}
+
+function ToastList() {
+ const { toasts } = ToastPrimitive.useToastManager()
+
+ return toasts.map((toast) => (
+ <ToastPrimitive.Root
+ key={toast.id}
+ toast={toast}
+ // Base UI types a toast as `dialog`, which puts every transient
+ // notification in the same bucket as real modals — a `getByRole('dialog')`
+ // lookup, ours or a screen reader user's, matches whatever toast happens
+ // to be on screen. `status` is what a passive notification should expose.
+ role={toast.type === 'error' ? 'alert' : 'status'}
+ // `--toast-index` / `--toast-offset-y` drive the stacked-card effect:
+ // toasts behind the front one scale down and sit slightly higher.
+ className={cn(
+ // Normal flow inside a bottom-anchored column, not absolute
+ // positioning: a zero-height viewport gives an absolutely-positioned
+ // child nothing to sit on, and it renders below the fold.
+ 'pointer-events-auto w-full',
+ 'rounded-xl border border-border bg-popover p-4 text-popover-foreground shadow-lg',
+ 'transition-all duration-200 ease-out',
+ 'data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0',
+ 'data-[ending-style]:translate-y-2 data-[ending-style]:opacity-0',
+ )}
+ >
+ <div className="flex items-start gap-3">
+ {toast.type && ICONS[toast.type] && (
+ <span className="mt-0.5 shrink-0">{ICONS[toast.type]}</span>
+ )}
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
+ <ToastPrimitive.Title className="font-medium text-sm leading-snug" />
+ <ToastPrimitive.Description className="text-muted-foreground text-sm leading-snug" />
+ </div>
+ <ToastPrimitive.Close
+ // 44px tap target on touch, compact for a pointer — the same rule the
+ // rest of the app follows for icon-only controls.
+ className="-mt-1 -mr-1 inline-flex size-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
+ aria-label={i18n.t('admin.actions.close')}
+ >
+ <XIcon className="size-4" />
+ </ToastPrimitive.Close>
+ </div>
+ </ToastPrimitive.Root>
+ ))
+}
+
+/**
+ * Mount once at the app root, inside the provider that owns the queue.
+ *
+ * Replaces the Sonner toaster: shadcn dropped that integration in favour of
+ * this Base UI primitive, which is also what every other overlay in this app
+ * (Sheet, Dialog, Popover, Select) is already built on.
+ */
+export function Toaster({ children }: { children?: React.ReactNode }) {
+ return (
+ <ToastPrimitive.Provider toastManager={toastManager}>
+ {children}
+ <ToastPrimitive.Portal>
+ <ToastPrimitive.Viewport
+ className={cn(
+ // Below the overlay layer (`z-50`) rather than above everything:
+ // the stack sits bottom-right, which is exactly where a side
+ // sheet's footer buttons are, and a toast drifting over Save is
+ // both unclickable and a click the merchant did not intend.
+ 'fixed right-4 z-40 flex w-[min(22rem,calc(100vw-2rem))] flex-col gap-2',
+ // `pointer-events-none` on the column so the empty space above the
+ // stack never blocks the page; each toast takes them back.
+ 'pointer-events-none',
+ 'bottom-[max(1rem,env(safe-area-inset-bottom))]',
+ )}
+ >
+ <ToastList />
+ </ToastPrimitive.Viewport>
+ </ToastPrimitive.Portal>
+ </ToastPrimitive.Provider>
+ )
+}
diff --git a/packages/dashboard/e2e/promotions.spec.ts b/packages/dashboard/e2e/promotions.spec.ts
index d78ce86d4a..2386e6cbfd 100644
--- a/packages/dashboard/e2e/promotions.spec.ts
+++ b/packages/dashboard/e2e/promotions.spec.ts
@@ -341,7 +341,9 @@ test.describe('promotions', () => {
await startNewPromotion(page, creds.store_id, name)
await submitCreate(page, name)
- await page.getByRole('button', { name: /^delete$/i }).click()
+ // Delete lives in the header's more-actions menu, away from Save.
+ await page.getByRole('button', { name: /more actions/i }).click()
+ await page.getByRole('menuitem', { name: /^delete$/i }).click()
await expect(page.getByRole('heading', { name: /delete promotion\?/i })).toBeVisible()
await page
.getByRole('dialog')
diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json
index 2ed28f7a82..f506e9ad9f 100644
--- a/packages/dashboard/package.json
+++ b/packages/dashboard/package.json
@@ -90,7 +90,6 @@
"react-hook-form": "^7.75.0",
"react-i18next": "^17.0.8",
"recharts": "^3.8.1",
- "sonner": "^2.0.7",
"spark-md5": "^3.0.2",
"tailwind-merge": "^3.5.0",
"tw-animate-css": "^1.4.0",
diff --git a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
index 04ec258de4..28d4e0870d 100644
--- a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
+++ b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor-dialog.tsx
@@ -154,7 +154,7 @@ export function BulkPriceEditorDialog({
<Button
type="button"
size="sm"
- variant="ghost"
+ variant="outline"
disabled={!isDirty || isSaving}
onClick={editorState.discard}
>
diff --git a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
index b6f6095bd8..631b9fc839 100644
--- a/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
+++ b/packages/dashboard/src/components/spree/bulk-price-editor/bulk-price-editor.tsx
@@ -1,10 +1,9 @@
import type { PriceBulkUpsertRow } from '@spree/admin-sdk'
import { adminClient, useResourceKey } from '@spree/dashboard-core'
-import { type BulkPriceRow, BulkPriceTable } from '@spree/dashboard-ui'
+import { type BulkPriceRow, BulkPriceTable, toastManager } from '@spree/dashboard-ui'
import { useQuery } from '@tanstack/react-query'
import { useCallback, useDeferredValue, useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { useCurrencyLocale } from '../../../hooks/use-currency-locale'
import { useBulkUpsertPrices } from '../../../hooks/use-prices'
import { currencyParts } from './currency-parts'
@@ -276,9 +275,12 @@ export function BulkPriceEditor({
})
try {
const res = await bulkUpsertAsync({ prices: payload })
- toast.success(
- t('admin.pages.products.price_lists.edit_prices.save_success', { count: res.price_count }),
- )
+ toastManager.add({
+ type: 'success',
+ title: t('admin.pages.products.price_lists.edit_prices.save_success', {
+ count: res.price_count,
+ }),
+ })
setEdits((prev) => {
const out = new Map(prev)
for (const key of savedKeys) out.delete(key)
@@ -290,7 +292,7 @@ export function BulkPriceEditor({
err instanceof Error
? err.message
: t('admin.pages.products.price_lists.edit_prices.save_failed')
- toast.error(message)
+ toastManager.add({ type: 'error', title: message })
return false
}
}, [edits, currency, priceListId, bulkUpsertAsync, marketLocale, t])
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 cfde8c2c12..85eb676f12 100644
--- a/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
+++ b/packages/dashboard/src/components/spree/command-palette/command-palette.tsx
@@ -2,8 +2,8 @@ import {
type NavEntry,
type Permissions,
permittedCreateActions,
+ resolveNavLabel,
type SearchGroup,
- type SettingsNavEntry,
useAuth,
useCommandPalette,
useCreateActions,
@@ -102,7 +102,14 @@ function CommandPaletteContent({ setOpen }: { setOpen: (open: boolean) => void }
<DialogDescription>{t('admin.components.command_palette.description')}</DialogDescription>
</DialogHeader>
<DialogContent
- className="top-1/3 translate-y-0 overflow-hidden rounded-2xl p-0 sm:max-w-2xl"
+ // `-translate-x-1/2 translate-y-0`, not a bare `translate-y-0`: in
+ // Tailwind v4 these compile to the standalone `translate` property, so
+ // setting only the Y axis wipes the base dialog's horizontal centring
+ // and the panel drifts off both edges of a narrow screen.
+ // `min(42rem, calc(100%-2rem))` rather than a bare `sm:max-w-2xl`: the
+ // `sm` breakpoint is 640px, so the 42rem cap takes over well before the
+ // viewport can hold it and the panel overhangs both edges on a phone.
+ className="top-1/3 -translate-x-1/2 translate-y-0 overflow-hidden rounded-2xl p-0 sm:max-w-[min(42rem,calc(100%-2rem))]"
showCloseButton={false}
// Don't restore focus to the trigger after navigating — the trigger is
// gone (we navigated away) and focus would land on the first sidebar
@@ -265,7 +272,7 @@ function buildGotoCommands({
if (!canRead(entry.subject, permissions)) continue
commands.push({
key: `nav:${entry.key}`,
- label: entry.label,
+ label: resolveNavLabel(entry, t),
icon: entry.icon ?? PackageIcon,
url: pathFor(entry.path),
})
@@ -273,7 +280,7 @@ function buildGotoCommands({
if (!canRead(child.subject, permissions)) continue
commands.push({
key: `nav:${entry.key}:${child.key}`,
- label: child.label,
+ label: resolveNavLabel(child, t),
// Children render no icon in the sidebar; inherit the parent's so the
// palette row still has a glyph.
icon: entry.icon ?? PackageIcon,
@@ -291,7 +298,7 @@ function buildGotoCommands({
if (!canRead(entry.subject, permissions)) continue
commands.push({
key: `settings:${entry.key}`,
- label: settingsLabel(entry, t),
+ label: resolveNavLabel(entry, t),
icon: entry.icon ?? SettingsIcon,
url: `/${storeId}/settings${entry.path}`,
})
@@ -300,10 +307,6 @@ function buildGotoCommands({
return commands
}
-function settingsLabel(entry: SettingsNavEntry, t: ReturnType<typeof useTranslation>['t']): string {
- return entry.labelKey ? t(entry.labelKey) : (entry.label ?? entry.key)
-}
-
/**
* Renders one resource's search results. The heading, row contents, result key,
* and destination all come from the registered `SearchEntry`, so the palette
diff --git a/packages/dashboard/src/components/spree/company-location-sheet.tsx b/packages/dashboard/src/components/spree/company-location-sheet.tsx
index 1a6ca872a6..4c773a553c 100644
--- a/packages/dashboard/src/components/spree/company-location-sheet.tsx
+++ b/packages/dashboard/src/components/spree/company-location-sheet.tsx
@@ -179,13 +179,12 @@ export function CompanyLocationSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/components/spree/custom-fields/custom-fields-inline.tsx b/packages/dashboard/src/components/spree/custom-fields/custom-fields-inline.tsx
index 6a9698a49b..0a07eab792 100644
--- a/packages/dashboard/src/components/spree/custom-fields/custom-fields-inline.tsx
+++ b/packages/dashboard/src/components/spree/custom-fields/custom-fields-inline.tsx
@@ -57,13 +57,13 @@ import {
Skeleton,
Switch,
Textarea,
+ toastManager,
} from '@spree/dashboard-ui'
import { Link, useParams } from '@tanstack/react-router'
import { Loader2Icon, PencilIcon, PlusIcon, TagIcon } from 'lucide-react'
import { createContext, type ReactNode, useCallback, useContext, useMemo, useState } from 'react'
import { type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import {
CUSTOM_FIELD_DEFINITION_DEFAULTS,
type CustomFieldDefinitionFormValues,
@@ -367,7 +367,10 @@ export function EditableApiCustomFieldsProvider({
const failed = tasks.filter((_, i) => results[i].status === 'rejected')
if (failed.length === 0) {
- toast.success(t('admin.components.custom_fields.values_saved'))
+ toastManager.add({
+ type: 'success',
+ title: t('admin.components.custom_fields.values_saved'),
+ })
setDrafts(null)
setIsEditing(false)
return
@@ -376,18 +379,19 @@ export function EditableApiCustomFieldsProvider({
// Some saved, some didn't. Keep edit mode with drafts intact so the user
// can retry — the refetched baseline means the succeeded fields now equal
// their persisted value, so a retry only re-sends the failures.
- toast.error(
- t('admin.components.custom_fields.values_save_partial_failed', {
+ toastManager.add({
+ type: 'error',
+ title: t('admin.components.custom_fields.values_save_partial_failed', {
fields: failed.map(({ def }) => def.label || def.key).join(', '),
}),
- )
+ })
} catch (err) {
// refetch() itself failed (network) — the saves may still have landed.
const message =
err instanceof Error
? err.message
: t('admin.components.custom_fields.errors.failed_to_save')
- toast.error(message)
+ toastManager.add({ type: 'error', title: message })
} finally {
setSaving(false)
}
@@ -478,9 +482,14 @@ function EditableHeaderActions() {
if (!mode.isEditing) {
return (
- <Button type="button" variant="outline" size="sm" onClick={mode.startEdit}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ type="button"
+ onClick={mode.startEdit}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
)
}
@@ -725,7 +734,6 @@ function CreateDefinitionSheet({
<Button
type="button"
variant="outline"
- size="sm"
// Reset through the same path as the Sheet's onOpenChange wrapper
// so reopening doesn't show stale input or server errors.
onClick={() => {
@@ -736,7 +744,7 @@ function CreateDefinitionSheet({
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={create.isPending}>
+ <Button type="submit" disabled={create.isPending}>
{create.isPending && <Loader2Icon className="size-4 animate-spin" />}
{t('admin.custom_field_definitions.create_label')}
</Button>
diff --git a/packages/dashboard/src/components/spree/integrations/configure-integration-sheet.tsx b/packages/dashboard/src/components/spree/integrations/configure-integration-sheet.tsx
index d06a2269e2..3d7b704c85 100644
--- a/packages/dashboard/src/components/spree/integrations/configure-integration-sheet.tsx
+++ b/packages/dashboard/src/components/spree/integrations/configure-integration-sheet.tsx
@@ -136,7 +136,6 @@ export function ConfigureIntegrationSheet({
<Button
type="button"
variant="destructive"
- size="sm"
onClick={handleDisconnect}
disabled={deleteMutation.isPending || saving}
className="mr-auto"
@@ -148,14 +147,13 @@ export function ConfigureIntegrationSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={saving}
>
{t('admin.actions.cancel')}
</Button>
<Can I={integration ? 'update' : 'create'} a={Subject.Integration}>
- <Button type="button" size="sm" onClick={handleSave} disabled={saving}>
+ <Button type="button" onClick={handleSave} disabled={saving}>
{saving
? t('admin.actions.saving')
: integration
diff --git a/packages/dashboard/src/components/spree/order-routing-rules-section.tsx b/packages/dashboard/src/components/spree/order-routing-rules-section.tsx
index eb58a38412..9627801605 100644
--- a/packages/dashboard/src/components/spree/order-routing-rules-section.tsx
+++ b/packages/dashboard/src/components/spree/order-routing-rules-section.tsx
@@ -332,7 +332,7 @@ function RuleTypePicker({
</button>
)
})}
- <Button type="button" variant="ghost" size="sm" className="self-start" onClick={onCancel}>
+ <Button type="button" variant="outline" size="sm" className="self-start" onClick={onCancel}>
{t('admin.actions.cancel')}
</Button>
</div>
diff --git a/packages/dashboard/src/components/spree/orders/fulfillment-edit-dialog.tsx b/packages/dashboard/src/components/spree/orders/fulfillment-edit-dialog.tsx
index daebe91dc7..bc0b34d74f 100644
--- a/packages/dashboard/src/components/spree/orders/fulfillment-edit-dialog.tsx
+++ b/packages/dashboard/src/components/spree/orders/fulfillment-edit-dialog.tsx
@@ -245,13 +245,12 @@ export function FulfillmentEditDialog({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={isSubmitting}>
+ <Button type="submit" disabled={isSubmitting}>
{isSubmitting
? t('admin.actions.saving')
: originMoved
diff --git a/packages/dashboard/src/components/spree/orders/order-customer-card.tsx b/packages/dashboard/src/components/spree/orders/order-customer-card.tsx
index 80252efb7d..d187cddd3f 100644
--- a/packages/dashboard/src/components/spree/orders/order-customer-card.tsx
+++ b/packages/dashboard/src/components/spree/orders/order-customer-card.tsx
@@ -19,11 +19,11 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
+ toastManager,
} from '@spree/dashboard-ui'
import { EllipsisVerticalIcon, PencilIcon } from 'lucide-react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { useOrderMutation } from '../../../hooks/use-order'
/**
@@ -123,11 +123,13 @@ export function CustomerCard({ order }: { order: Order }) {
// The dialog stays open on failure so the entered address is
// not lost and can be corrected and resubmitted.
onError: (error) =>
- toast.error(
- error instanceof Error
- ? error.message
- : t('admin.orders.errors.failed_to_update_address'),
- ),
+ toastManager.add({
+ type: 'error',
+ title:
+ error instanceof Error
+ ? error.message
+ : t('admin.orders.errors.failed_to_update_address'),
+ }),
},
)
}
diff --git a/packages/dashboard/src/components/spree/orders/order-header.tsx b/packages/dashboard/src/components/spree/orders/order-header.tsx
index 6aa7e37dfd..51662ca736 100644
--- a/packages/dashboard/src/components/spree/orders/order-header.tsx
+++ b/packages/dashboard/src/components/spree/orders/order-header.tsx
@@ -162,7 +162,7 @@ export function OrderHeader({ order }: { order: Order }) {
{/* Fully fulfilled means every unit has shipped, so there is
nothing left an edit could lawfully change. */}
{!GONE_STATUSES.includes(order.fulfillment_status ?? '') && (
- <Button variant="outline" size="sm" asChild>
+ <Button variant="outline" asChild>
<Link to="/$storeId/orders/$orderId/edit" params={{ storeId, orderId }}>
<PencilIcon className="size-4" />
{t('admin.orders.edit.action_label')}
@@ -172,7 +172,6 @@ export function OrderHeader({ order }: { order: Order }) {
{order.status === 'draft' && (
<Button
- size="sm"
onClick={async () => {
if (
await confirm({
diff --git a/packages/dashboard/src/components/spree/orders/order-notes-cards.tsx b/packages/dashboard/src/components/spree/orders/order-notes-cards.tsx
index c7b5a1beb5..05630ed548 100644
--- a/packages/dashboard/src/components/spree/orders/order-notes-cards.tsx
+++ b/packages/dashboard/src/components/spree/orders/order-notes-cards.tsx
@@ -39,9 +39,13 @@ export function SpecialInstructionsCard({ order }: { order: Order }) {
<CardHeader>
<CardTitle>{t('admin.orders.detail.section_customer_note')}</CardTitle>
<CardAction>
- <Button variant="ghost" size="icon-xs" onClick={() => setEditing(!editing)}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={() => setEditing(!editing)}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- <span className="sr-only">{t('admin.actions.edit')}</span>
</Button>
</CardAction>
</CardHeader>
@@ -85,14 +89,14 @@ export function TagsCard({ order }: { order: Order }) {
<CardAction>
<Button
variant="ghost"
- size="icon-xs"
+ size="icon-sm"
onClick={() => {
setTags(order.tags ?? [])
setEditing(!editing)
}}
+ aria-label={t('admin.actions.edit')}
>
<PencilIcon className="size-4" />
- <span className="sr-only">{t('admin.actions.edit')}</span>
</Button>
</CardAction>
</CardHeader>
@@ -160,9 +164,13 @@ export function InternalNoteCard({ order }: { order: Order }) {
<CardHeader>
<CardTitle>{t('admin.orders.detail.section_internal_note')}</CardTitle>
<CardAction>
- <Button variant="ghost" size="icon-xs" onClick={() => setEditing(!editing)}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={() => setEditing(!editing)}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- <span className="sr-only">{t('admin.actions.edit')}</span>
</Button>
</CardAction>
</CardHeader>
diff --git a/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx b/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
index 2087d194e7..19ff162359 100644
--- a/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
+++ b/packages/dashboard/src/components/spree/price-list-editors/price-list-form.tsx
@@ -9,7 +9,7 @@ import {
ResourceMultiAutocomplete,
useStore,
} from '@spree/dashboard-core'
-import { useConfirm } from '@spree/dashboard-ui'
+import { DropdownMenuItem, useConfirm } from '@spree/dashboard-ui'
import {
CalendarOffIcon,
PauseIcon,
@@ -22,13 +22,20 @@ import {
import { useEffect, useState } from 'react'
import { Controller, type UseFormReturn, useFieldArray, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
+import { spreeJsonLinkResolver } from '../../../lib/json-link-resolver'
import { BulkPriceEditorDialog } from '../bulk-price-editor/bulk-price-editor-dialog'
import { PriceListStatusBadge } from './status-badge'
// Side-effect import — registers per-rule editors (customer, customer
// group, …) into the slot registry. Must run before any RuleEditSheet
// mounts.
import './register'
-import { mapSpreeErrorsToForm, Slot, StoreDatePicker, Subject } from '@spree/dashboard-core'
+import {
+ mapSpreeErrorsToForm,
+ Slot,
+ StoreDatePicker,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
Button,
Card,
@@ -102,6 +109,9 @@ export function PriceListForm({
deletePending = false,
}: PriceListFormProps) {
const { t } = useTranslation()
+ const { storeId } = useStore()
+ const { permissions } = usePermissions()
+ const canDelete = permissions.can('destroy', Subject.PriceList)
const form = useForm<PriceListFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -160,26 +170,31 @@ export function PriceListForm({
}
backTo="products/price-lists"
badges={priceList && <PriceListStatusBadge priceList={priceList} />}
+ // `dropdownItems` rather than `onDelete`: the caller already runs
+ // its own confirm, naming the price list being deleted, and
+ // `onDelete` would stack the header's generic prompt in front of it.
+ dropdownItems={
+ mode === 'edit' && onDelete && canDelete ? (
+ <DropdownMenuItem variant="destructive" disabled={deletePending} onClick={onDelete}>
+ {t('admin.actions.delete')}
+ </DropdownMenuItem>
+ ) : undefined
+ }
+ jsonPreview={
+ mode === 'edit' && priceList
+ ? {
+ title: `Price list ${priceList.name}`,
+ fetch: () => adminClient.priceLists.get(priceList.id),
+ endpoint: `/api/v3/admin/price_lists/${priceList.id}`,
+ resolveLink: spreeJsonLinkResolver(storeId),
+ }
+ : undefined
+ }
actions={
<div className="flex gap-2">
{mode === 'edit' && priceList && <ActivationButtons priceList={priceList} />}
- {mode === 'edit' && onDelete && (
- <Can I="destroy" a={Subject.PriceList}>
- <Button
- type="button"
- size="sm"
- variant="ghost"
- onClick={onDelete}
- disabled={deletePending}
- className="text-destructive hover:bg-destructive/10 hover:text-destructive"
- >
- {t('admin.actions.delete')}
- </Button>
- </Can>
- )}
<Button
type="submit"
- size="sm"
disabled={
form.formState.isSubmitting || (mode === 'edit' && !form.formState.isDirty)
}
@@ -400,7 +415,6 @@ function ActivationButtons({ priceList }: { priceList: PriceList }) {
<Button
type="button"
variant="outline"
- size="sm"
onClick={handleDeactivate}
disabled={deactivate.isPending}
>
@@ -425,7 +439,6 @@ function ActivationButtons({ priceList }: { priceList: PriceList }) {
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => handleActivate(willSchedule)}
disabled={activate.isPending}
>
diff --git a/packages/dashboard/src/components/spree/product-membership-card.tsx b/packages/dashboard/src/components/spree/product-membership-card.tsx
index 980cb9fd9e..5d1c04199c 100644
--- a/packages/dashboard/src/components/spree/product-membership-card.tsx
+++ b/packages/dashboard/src/components/spree/product-membership-card.tsx
@@ -27,10 +27,8 @@ import {
Checkbox,
cn,
DragHandle,
- InputGroup,
- InputGroupAddon,
- InputGroupInput,
Pagination,
+ SearchInput,
Table,
TableBody,
TableCell,
@@ -41,7 +39,7 @@ import {
useConfirm,
} from '@spree/dashboard-ui'
import { Link } from '@tanstack/react-router'
-import { PlusIcon, SearchIcon, Trash2Icon, XIcon } from 'lucide-react'
+import { PlusIcon, Trash2Icon, XIcon } from 'lucide-react'
import { useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -271,18 +269,13 @@ export function ProductMembershipCard({
) : (
<>
<div className="border-border border-b p-3">
- <InputGroup>
- <InputGroupAddon>
- <SearchIcon className="size-4 text-muted-foreground" />
- </InputGroupAddon>
- <InputGroupInput
- type="search"
- value={query}
- onChange={(e) => setQuery(e.target.value)}
- onKeyDown={(e) => e.key === 'Enter' && e.preventDefault()}
- placeholder={tr('filter_placeholder')}
- />
- </InputGroup>
+ <SearchInput
+ value={query}
+ onValueChange={setQuery}
+ onKeyDown={(e) => e.key === 'Enter' && e.preventDefault()}
+ placeholder={tr('filter_placeholder')}
+ clearLabel={t('admin.common.clear')}
+ />
</div>
{visible.length === 0 ? (
<p className="p-6 text-muted-foreground text-sm">{tr('no_matches')}</p>
diff --git a/packages/dashboard/src/components/spree/products/bulk-variants-dialog.tsx b/packages/dashboard/src/components/spree/products/bulk-variants-dialog.tsx
index 20494f08eb..f702f81588 100644
--- a/packages/dashboard/src/components/spree/products/bulk-variants-dialog.tsx
+++ b/packages/dashboard/src/components/spree/products/bulk-variants-dialog.tsx
@@ -196,7 +196,7 @@ export function BulkVariantsDialog({ form, open, onOpenChange }: Props) {
{t('admin.products.variants.bulk_edit.title')}
</DialogTitle>
<div className="flex items-center gap-2">
- <Button type="button" size="sm" variant="ghost" onClick={handleCancel}>
+ <Button type="button" size="sm" variant="outline" onClick={handleCancel}>
{t('admin.actions.cancel')}
</Button>
<Button type="button" size="sm" onClick={handleDone}>
diff --git a/packages/dashboard/src/components/spree/products/media-edit-sheet.tsx b/packages/dashboard/src/components/spree/products/media-edit-sheet.tsx
index b959deeaac..0e0b3f64c2 100644
--- a/packages/dashboard/src/components/spree/products/media-edit-sheet.tsx
+++ b/packages/dashboard/src/components/spree/products/media-edit-sheet.tsx
@@ -347,7 +347,7 @@ export function MediaEditSheet({ form, mediaIndex, variants, open, onOpenChange
</div>
<SheetFooter>
- <Button type="button" variant="ghost" onClick={handleCancel}>
+ <Button type="button" variant="outline" onClick={handleCancel}>
{t('admin.actions.cancel')}
</Button>
<Button type="button" onClick={() => onOpenChange(false)}>
diff --git a/packages/dashboard/src/components/spree/products/product-form-cards.tsx b/packages/dashboard/src/components/spree/products/product-form-cards.tsx
index b08bcc85b5..c5a425739e 100644
--- a/packages/dashboard/src/components/spree/products/product-form-cards.tsx
+++ b/packages/dashboard/src/components/spree/products/product-form-cards.tsx
@@ -37,13 +37,13 @@ import {
SelectTrigger,
SelectValue,
Textarea,
+ toastManager,
useConfirm,
} from '@spree/dashboard-ui'
import { FilmIcon, ImagePlusIcon, Loader2Icon, PencilIcon, PlayIcon, TrashIcon } from 'lucide-react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Controller, type UseFormReturn, useWatch } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { categoryAutocompleteProps, useCategories } from '../../../hooks/use-categories'
import { collectionAutocompleteProps, useCollections } from '../../../hooks/use-collections'
import { useDeliveryProfiles } from '../../../hooks/use-delivery-profiles'
@@ -279,7 +279,10 @@ export function MediaCard({
prev.map((p) => (p.id === uploadId ? { ...p, progress: 'error' as const } : p)),
)
const message = err instanceof Error ? err.message : t('admin.errors.unexpected')
- toast.error(t('admin.products.media.upload_failed', { name: file.name, message }))
+ toastManager.add({
+ type: 'error',
+ title: t('admin.products.media.upload_failed', { name: file.name, message }),
+ })
}
}
},
@@ -292,7 +295,11 @@ export function MediaCard({
const accepted = Array.from(e.dataTransfer.files).filter(isAcceptedMedia)
const rejected = e.dataTransfer.files.length - accepted.length
- if (rejected > 0) toast.error(t('admin.products.media.unsupported_file', { count: rejected }))
+ if (rejected > 0)
+ toastManager.add({
+ type: 'error',
+ title: t('admin.products.media.unsupported_file', { count: rejected }),
+ })
if (accepted.length > 0) handleFiles(accepted)
},
[handleFiles, t],
@@ -344,7 +351,7 @@ export function MediaCard({
try {
await deleteMedia.mutateAsync(entry.id)
} catch {
- toast.error(t('admin.errors.failed_to_delete'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_delete') })
return
}
}
diff --git a/packages/dashboard/src/components/spree/products/publishing-card.tsx b/packages/dashboard/src/components/spree/products/publishing-card.tsx
index d5e110f04e..75ca8fb6cb 100644
--- a/packages/dashboard/src/components/spree/products/publishing-card.tsx
+++ b/packages/dashboard/src/components/spree/products/publishing-card.tsx
@@ -393,7 +393,7 @@ function ManageChannelsSheet({
})}
</div>
<SheetFooter>
- <Button type="button" size="sm" onClick={() => onOpenChange(false)}>
+ <Button type="button" onClick={() => onOpenChange(false)}>
{t('admin.actions.done')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/components/spree/products/variant-edit-sheet.tsx b/packages/dashboard/src/components/spree/products/variant-edit-sheet.tsx
index 493ccb7376..2d21c9c5a0 100644
--- a/packages/dashboard/src/components/spree/products/variant-edit-sheet.tsx
+++ b/packages/dashboard/src/components/spree/products/variant-edit-sheet.tsx
@@ -450,7 +450,7 @@ export function VariantEditSheet({ form, variantIndex, open, onOpenChange }: Pro
</div>
<SheetFooter>
- <Button type="button" variant="ghost" onClick={handleCancel}>
+ <Button type="button" variant="outline" onClick={handleCancel}>
{t('admin.actions.cancel')}
</Button>
<Button type="button" onClick={handleDone}>
diff --git a/packages/dashboard/src/components/spree/products/variants-options-builder.tsx b/packages/dashboard/src/components/spree/products/variants-options-builder.tsx
index 9a1bb522d1..b9562df7d5 100644
--- a/packages/dashboard/src/components/spree/products/variants-options-builder.tsx
+++ b/packages/dashboard/src/components/spree/products/variants-options-builder.tsx
@@ -10,11 +10,11 @@ import {
SelectItem,
SelectTrigger,
SelectValue,
+ toastManager,
} from '@spree/dashboard-ui'
import { CheckIcon, PencilIcon, PlusIcon, XIcon } from 'lucide-react'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import {
useCreateOptionType,
useOptionTypes,
@@ -252,7 +252,7 @@ function AddOptionForm({ availableTypes, allOptionTypes, onSave, onCancel }: Add
<PlusIcon />
{t('admin.products.variants.create_option_type')}
</Button>
- <Button type="button" variant="ghost" size="sm" onClick={onCancel}>
+ <Button type="button" variant="outline" size="sm" onClick={onCancel}>
{t('admin.actions.cancel')}
</Button>
</div>
@@ -336,7 +336,7 @@ function OptionPicker({ optionType, initialValues, onSave, onCancel }: OptionPic
err instanceof Error
? err.message
: t('admin.products.variants.errors.failed_to_create_value')
- toast.error(message)
+ toastManager.add({ type: 'error', title: message })
}
}
@@ -385,7 +385,7 @@ function OptionPicker({ optionType, initialValues, onSave, onCancel }: OptionPic
</button>
</div>
<div className="flex items-center justify-end gap-2">
- <Button type="button" variant="ghost" size="sm" onClick={onCancel}>
+ <Button type="button" variant="outline" size="sm" onClick={onCancel}>
{t('admin.actions.cancel')}
</Button>
<Button type="button" size="sm" onClick={handleSave} disabled={pickedNames.size === 0}>
@@ -433,7 +433,7 @@ function CreateOptionTypeInline({
err instanceof Error
? err.message
: t('admin.products.variants.errors.failed_to_create_option_type')
- toast.error(message)
+ toastManager.add({ type: 'error', title: message })
}
}
@@ -473,7 +473,7 @@ function CreateOptionTypeInline({
/>
</Field>
<div className="flex items-center justify-end gap-2">
- <Button type="button" variant="ghost" size="sm" onClick={onCancel} disabled={isPending}>
+ <Button type="button" variant="outline" size="sm" onClick={onCancel} disabled={isPending}>
{t('admin.actions.cancel')}
</Button>
<Button type="button" size="sm" onClick={submit} disabled={isPending || !label.trim()}>
@@ -540,7 +540,7 @@ function CreateOptionValueInline({ onCancel, onCreate, isPending }: CreateOption
/>
</Field>
<div className="flex items-center justify-end gap-2">
- <Button type="button" variant="ghost" size="sm" onClick={onCancel} disabled={isPending}>
+ <Button type="button" variant="outline" size="sm" onClick={onCancel} disabled={isPending}>
{t('admin.actions.cancel')}
</Button>
<Button type="button" size="sm" onClick={submit} disabled={isPending || !label.trim()}>
diff --git a/packages/dashboard/src/components/spree/profile-dialog.tsx b/packages/dashboard/src/components/spree/profile-dialog.tsx
index a133045ea7..9fcd989970 100644
--- a/packages/dashboard/src/components/spree/profile-dialog.tsx
+++ b/packages/dashboard/src/components/spree/profile-dialog.tsx
@@ -27,11 +27,11 @@ import {
SelectTrigger,
SelectValue,
Skeleton,
+ toastManager,
} from '@spree/dashboard-ui'
import { useEffect, useMemo } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { useProfile, useUpdateProfile } from '../../hooks/use-profile'
import { getAvailableUiLocales } from '../../i18n-setup'
import { type MeFormValues, meFormSchema, meToForm, meToParams } from '../../schemas/me'
@@ -137,7 +137,7 @@ function ProfileForm({
// Reflect the new name/locale/avatar in the auth context (top-bar, etc.)
// immediately instead of waiting for the next token refresh.
updateUser(updated.user)
- toast.success(t('admin.messages.profile_updated'))
+ toastManager.add({ type: 'success', title: t('admin.messages.profile_updated') })
// Closing unmounts the form, so the avatar state doesn't need preserving
// across the save — the reopened dialog re-hydrates from the mutation
// response that `useUpdateProfile` writes into the cache.
@@ -149,7 +149,10 @@ function ProfileForm({
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(err instanceof Error ? err.message : t('admin.errors.failed_to_update_profile'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.errors.failed_to_update_profile'),
+ })
}
}
@@ -253,7 +256,6 @@ function ProfileForm({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={isSubmitting}
>
@@ -262,7 +264,7 @@ function ProfileForm({
{/* Gated on `isDirty` to match `FormActions` (what the page this
replaced used) — without it a pristine Save PATCHes and toasts
success having changed nothing. */}
- <Button type="submit" size="sm" disabled={!isDirty || isSubmitting}>
+ <Button type="submit" disabled={!isDirty || isSubmitting}>
{isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</DialogFooter>
diff --git a/packages/dashboard/src/components/spree/promotion-editors/editor-shell.tsx b/packages/dashboard/src/components/spree/promotion-editors/editor-shell.tsx
index daff05d532..b51818ceab 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/editor-shell.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/editor-shell.tsx
@@ -30,10 +30,10 @@ export function EditorShell({
<>
<div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">{children}</div>
<SheetFooter>
- <Button type="button" variant="outline" size="sm" onClick={onCancel} disabled={pending}>
+ <Button type="button" variant="outline" onClick={onCancel} disabled={pending}>
{t('admin.actions.cancel')}
</Button>
- <Button type="button" size="sm" onClick={() => onSave()} disabled={pending || saveDisabled}>
+ <Button type="button" onClick={() => onSave()} disabled={pending || saveDisabled}>
{pending ? t('admin.actions.saving') : resolvedSaveLabel}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
index 8db332d9e5..03bb657d74 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -9,15 +9,24 @@ import type {
ResourceTypeDefinition,
} from '@spree/admin-sdk'
import { Can, PageHeader, PreferencesForm, StoreDatePicker } from '@spree/dashboard-core'
-import { formatCalculatorSummary, useConfirm } from '@spree/dashboard-ui'
+import { DropdownMenuItem, formatCalculatorSummary, useConfirm } from '@spree/dashboard-ui'
import i18n from 'i18next'
import { DownloadIcon, PlusIcon, SparklesIcon, TrashIcon } from 'lucide-react'
import { useEffect, useState } from 'react'
import { Controller, type UseFormReturn, useFieldArray, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
+import { spreeJsonLinkResolver } from '../../../lib/json-link-resolver'
import { EditorShell } from './editor-shell'
import './register'
-import { mapSpreeErrorsToForm, Slot, Subject, useExport, useStore } from '@spree/dashboard-core'
+import {
+ adminClient,
+ mapSpreeErrorsToForm,
+ Slot,
+ Subject,
+ useExport,
+ usePermissions,
+ useStore,
+} from '@spree/dashboard-core'
import {
ActiveBadge,
Badge,
@@ -155,6 +164,11 @@ export function PromotionForm({
deletePending = false,
}: PromotionFormProps) {
const { t } = useTranslation()
+ const { storeId } = useStore()
+ const { permissions } = usePermissions()
+ // `Can` is a component, and the header takes a callback rather than markup —
+ // so the same permission is checked as a predicate here.
+ const canDelete = permissions.can('destroy', Subject.Promotion)
const form = useForm<PromotionFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
resolver: zodResolver(promotionFormSchema) as any,
@@ -229,25 +243,33 @@ export function PromotionForm({
mode === 'create' ? t('admin.pages.promotions.new_title') : (promotion?.name ?? '')
}
backTo="promotions"
+ // Delete lives in the more-actions menu, not beside Save: a
+ // destructive action next to the primary one is easy to hit by
+ // mistake, and the menu is where every other record page puts it.
+ // `dropdownItems` rather than `onDelete`: the caller already runs
+ // its own confirm, naming the promotion being deleted, and
+ // `onDelete` would stack the header's generic prompt in front of it.
+ dropdownItems={
+ mode === 'edit' && onDelete && canDelete ? (
+ <DropdownMenuItem variant="destructive" disabled={deletePending} onClick={onDelete}>
+ {t('admin.actions.delete')}
+ </DropdownMenuItem>
+ ) : undefined
+ }
+ jsonPreview={
+ mode === 'edit' && promotion
+ ? {
+ title: `Promotion ${promotion.name}`,
+ fetch: () => adminClient.promotions.get(promotion.id),
+ endpoint: `/api/v3/admin/promotions/${promotion.id}`,
+ resolveLink: spreeJsonLinkResolver(storeId),
+ }
+ : undefined
+ }
actions={
<div className="flex gap-2">
- {mode === 'edit' && onDelete && (
- <Can I="destroy" a={Subject.Promotion}>
- <Button
- type="button"
- size="sm"
- variant="ghost"
- onClick={onDelete}
- disabled={deletePending}
- className="text-destructive hover:bg-destructive/10 hover:text-destructive"
- >
- {t('admin.actions.delete')}
- </Button>
- </Can>
- )}
<Button
type="submit"
- size="sm"
disabled={
form.formState.isSubmitting || (mode === 'edit' && !form.formState.isDirty)
}
@@ -950,7 +972,7 @@ function RulePickerSheet({
)}
</div>
<SheetFooter>
- <Button type="button" variant="outline" size="sm" onClick={() => onOpenChange(false)}>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
{t('admin.actions.cancel')}
</Button>
</SheetFooter>
@@ -1214,7 +1236,7 @@ function ActionPickerSheet({
))}
</div>
<SheetFooter>
- <Button type="button" variant="outline" size="sm" onClick={() => onOpenChange(false)}>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
{t('admin.actions.cancel')}
</Button>
</SheetFooter>
@@ -1401,7 +1423,6 @@ function CouponCodesSheet({
{totalCount > 0 && (
<Button
type="button"
- size="sm"
variant="outline"
onClick={handleExport}
disabled={exportMutation.isPending}
@@ -1412,7 +1433,7 @@ function CouponCodesSheet({
: t('admin.promotions.coupon_codes.export_csv')}
</Button>
)}
- <Button type="button" size="sm" variant="outline" onClick={() => onOpenChange(false)}>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
{t('admin.actions.close')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/components/spree/role-sheet.tsx b/packages/dashboard/src/components/spree/role-sheet.tsx
index 03d84d91c4..825db28dfd 100644
--- a/packages/dashboard/src/components/spree/role-sheet.tsx
+++ b/packages/dashboard/src/components/spree/role-sheet.tsx
@@ -16,12 +16,12 @@ import {
SheetTitle,
Skeleton,
Textarea,
+ toastManager,
} from '@spree/dashboard-ui'
import i18n from 'i18next'
import { useEffect, useMemo } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { z } from 'zod/v4'
import { useCreateRole, usePermissionCatalog, useRole, useUpdateRole } from '../../hooks/use-roles'
import { allReadKeys, allWriteKeys, PermissionGrid } from './permission-picker'
@@ -149,20 +149,20 @@ export function RoleSheet({
try {
if (roleId) {
await updateMutation.mutateAsync({ id: roleId, params })
- toast.success(t('admin.roles.messages.updated'))
+ toastManager.add({ type: 'success', title: t('admin.roles.messages.updated') })
} else {
await createMutation.mutateAsync(params)
- toast.success(t('admin.roles.messages.created'))
+ toastManager.add({ type: 'success', title: t('admin.roles.messages.created') })
}
form.reset(ROLE_DEFAULTS)
onOpenChange(false)
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) {
- toast.error(err.message)
+ toastManager.add({ type: 'error', title: err.message })
return
}
- toast.error(t('admin.roles.errors.failed_to_save'))
+ toastManager.add({ type: 'error', title: t('admin.roles.errors.failed_to_save') })
}
}
@@ -311,14 +311,13 @@ export function RoleSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
{!readOnly && (
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.saving')
: t('admin.actions.save')}
diff --git a/packages/dashboard/src/components/spree/sellers/seller-address-card.tsx b/packages/dashboard/src/components/spree/sellers/seller-address-card.tsx
index 7052653538..91214f8b4b 100644
--- a/packages/dashboard/src/components/spree/sellers/seller-address-card.tsx
+++ b/packages/dashboard/src/components/spree/sellers/seller-address-card.tsx
@@ -55,9 +55,13 @@ export function SellerAddressCard({
</CardTitle>
{canEdit && (
<CardAction>
- <Button variant="outline" size="sm" onClick={() => setEditing(true)}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={() => setEditing(true)}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
</CardAction>
)}
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 2c2564d670..dfa720f2f9 100644
--- a/packages/dashboard/src/components/spree/sellers/seller-onboarding-card.tsx
+++ b/packages/dashboard/src/components/spree/sellers/seller-onboarding-card.tsx
@@ -20,7 +20,7 @@ import {
CircleIcon,
ClockIcon,
DownloadIcon,
- MoreHorizontalIcon,
+ EllipsisVerticalIcon,
XCircleIcon,
} from 'lucide-react'
import { useTranslation } from 'react-i18next'
@@ -198,7 +198,7 @@ function RequirementRow({
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button size="icon-sm" variant="ghost" disabled={busy}>
- <MoreHorizontalIcon className="size-4" />
+ <EllipsisVerticalIcon className="size-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
diff --git a/packages/dashboard/src/components/spree/setup-tasks/add-products-task.tsx b/packages/dashboard/src/components/spree/setup-tasks/add-products-task.tsx
index 6ea980f7c2..e2890e3eef 100644
--- a/packages/dashboard/src/components/spree/setup-tasks/add-products-task.tsx
+++ b/packages/dashboard/src/components/spree/setup-tasks/add-products-task.tsx
@@ -25,7 +25,6 @@ export function AddProductsTask({ task, storeId }: SetupTaskSlotContext) {
</Button>
<ImportButton
type="products"
- size="default"
subject={Subject.Product}
label={t('admin.pages.getting_started.tasks.add_products.import_cta')}
onCreated={(imp) =>
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx b/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx
index afa273c9bd..5d346864cd 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx
+++ b/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx
@@ -885,7 +885,7 @@ function ServiceOverridesSheet({
</Field>
</div>
<SheetFooter>
- <Button type="button" size="sm" onClick={onClose}>
+ <Button type="button" onClick={onClose}>
{t('admin.actions.done')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx b/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx
index a5769b3f39..c5fd4d1d6a 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx
+++ b/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx
@@ -217,7 +217,6 @@ export function DeliveryMethodSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -225,7 +224,6 @@ export function DeliveryMethodSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || (editing && !form.formState.isDirty)}
>
{form.formState.isSubmitting
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-origin-group-dialog.tsx b/packages/dashboard/src/components/spree/shipping/delivery-origin-group-dialog.tsx
index 4872e418b5..49b86b1772 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-origin-group-dialog.tsx
+++ b/packages/dashboard/src/components/spree/shipping/delivery-origin-group-dialog.tsx
@@ -177,13 +177,12 @@ export function DeliveryOriginGroupDialog({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? editing
? t('admin.actions.saving')
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-zone-sheet.tsx b/packages/dashboard/src/components/spree/shipping/delivery-zone-sheet.tsx
index 6957f7e71d..40ee8cdd8f 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-zone-sheet.tsx
+++ b/packages/dashboard/src/components/spree/shipping/delivery-zone-sheet.tsx
@@ -160,7 +160,6 @@ export function DeliveryZoneSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -168,7 +167,6 @@ export function DeliveryZoneSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || (editing && !form.formState.isDirty)}
>
{form.formState.isSubmitting
diff --git a/packages/dashboard/src/components/spree/storefront-connect-sheet.tsx b/packages/dashboard/src/components/spree/storefront-connect-sheet.tsx
index 5b17e22fad..d61276bdde 100644
--- a/packages/dashboard/src/components/spree/storefront-connect-sheet.tsx
+++ b/packages/dashboard/src/components/spree/storefront-connect-sheet.tsx
@@ -10,11 +10,11 @@ import {
SheetHeader,
SheetTitle,
Skeleton,
+ toastManager,
} from '@spree/dashboard-ui'
import { ExternalLinkIcon, EyeIcon, EyeOffIcon } from 'lucide-react'
import { type ReactNode, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { useStorefrontPublishableKey } from '../../hooks/use-api-keys'
import { useConnectStorefront } from '../../hooks/use-store-settings'
@@ -111,17 +111,26 @@ export function StorefrontConnectSheet({
const handleSave = () => {
const origin = normalizeOrigin(url)
if (!origin) {
- toast.error(t('admin.pages.getting_started.storefront_sheet.invalid_url'))
+ toastManager.add({
+ type: 'error',
+ title: t('admin.pages.getting_started.storefront_sheet.invalid_url'),
+ })
return
}
connect.mutate(origin, {
onSuccess: () => {
- toast.success(t('admin.pages.getting_started.storefront_sheet.saved', { url: origin }))
+ toastManager.add({
+ type: 'success',
+ title: t('admin.pages.getting_started.storefront_sheet.saved', { url: origin }),
+ })
onOpenChange(false)
},
onError: (error) => {
- toast.error(error instanceof Error ? error.message : String(error))
+ toastManager.add({
+ type: 'error',
+ title: error instanceof Error ? error.message : String(error),
+ })
},
})
}
diff --git a/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx b/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx
index 8dd54bc80f..8b17d69de8 100644
--- a/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx
+++ b/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx
@@ -543,13 +543,12 @@ function CertificateSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.actions.create')}
diff --git a/packages/dashboard/src/components/spree/tax-identifiers-card.tsx b/packages/dashboard/src/components/spree/tax-identifiers-card.tsx
index 44105bbcfc..8d1fc30fe2 100644
--- a/packages/dashboard/src/components/spree/tax-identifiers-card.tsx
+++ b/packages/dashboard/src/components/spree/tax-identifiers-card.tsx
@@ -357,13 +357,12 @@ function TaxIdentifierSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/components/spree/translations/resource-translations-dialog.tsx b/packages/dashboard/src/components/spree/translations/resource-translations-dialog.tsx
index 3c5ad0c799..180e91d13f 100644
--- a/packages/dashboard/src/components/spree/translations/resource-translations-dialog.tsx
+++ b/packages/dashboard/src/components/spree/translations/resource-translations-dialog.tsx
@@ -22,12 +22,12 @@ import {
SelectValue,
Skeleton,
Textarea,
+ toastManager,
useConfirm,
} from '@spree/dashboard-ui'
import { XIcon } from 'lucide-react'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import {
type TranslatableResourceType,
useLocales,
@@ -164,7 +164,7 @@ export function ResourceTranslationsDialog({
setSaving(true)
try {
await adminClient.translations.batch(Array.from(byResource.values()))
- toast.success(t('admin.translations.saved'))
+ toastManager.add({ type: 'success', title: t('admin.translations.saved') })
setEdits(new Map())
refetch()
} catch (err) {
@@ -172,7 +172,7 @@ export function ResourceTranslationsDialog({
// server's validation message (if any) in the toast rather than the
// generic fallback.
const message = err instanceof SpreeError ? err.message : undefined
- toast.error(message || t('admin.translations.save_error'))
+ toastManager.add({ type: 'error', title: message || t('admin.translations.save_error') })
} finally {
setSaving(false)
}
@@ -230,7 +230,7 @@ export function ResourceTranslationsDialog({
<Button
type="button"
size="sm"
- variant="ghost"
+ variant="outline"
disabled={dirtyCount === 0 || saving}
onClick={() => setEdits(new Map())}
>
diff --git a/packages/dashboard/src/hooks/use-fulfillments.ts b/packages/dashboard/src/hooks/use-fulfillments.ts
index ea09dda346..ad7c318cae 100644
--- a/packages/dashboard/src/hooks/use-fulfillments.ts
+++ b/packages/dashboard/src/hooks/use-fulfillments.ts
@@ -5,8 +5,8 @@ import {
SpreeError,
} from '@spree/admin-sdk'
import { adminClient, useResourceKeyBuilder } from '@spree/dashboard-core'
+import { toastManager } from '@spree/dashboard-ui'
import { useMutation, useQueryClient } from '@tanstack/react-query'
-import { toast } from 'sonner'
/**
* A fulfillment mutation refreshes the order itself — every one of these moves
@@ -30,7 +30,10 @@ function useFulfillmentMutation<TParams>(
},
onError: (error) => {
if (error instanceof SpreeError && error.status === 422) return
- toast.error(error instanceof Error ? error.message : String(error))
+ toastManager.add({
+ type: 'error',
+ title: error instanceof Error ? error.message : String(error),
+ })
},
})
}
diff --git a/packages/dashboard/src/hooks/use-imports.ts b/packages/dashboard/src/hooks/use-imports.ts
index 2f4dfc4816..337f818c66 100644
--- a/packages/dashboard/src/hooks/use-imports.ts
+++ b/packages/dashboard/src/hooks/use-imports.ts
@@ -1,8 +1,8 @@
import type { Import, ImportCompleteMappingParams } from '@spree/admin-sdk'
import { adminClient, useResourceKey, useResourceKeyBuilder } from '@spree/dashboard-core'
+import { toastManager } from '@spree/dashboard-ui'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { useEffect } from 'react'
-import { toast } from 'sonner'
import { isImportActive } from '../lib/import-types'
export { isImportActive }
@@ -102,7 +102,7 @@ export function useRetryFailedRows(id: string) {
queryClient.invalidateQueries({ queryKey: buildKey('imports'), refetchType: 'none' })
},
onError: (err) => {
- toast.error(err instanceof Error ? err.message : String(err))
+ toastManager.add({ type: 'error', title: err instanceof Error ? err.message : String(err) })
},
})
}
@@ -118,7 +118,7 @@ export function useDeleteImport() {
queryClient.invalidateQueries({ queryKey: buildKey('imports') })
},
onError: (err) => {
- toast.error(err instanceof Error ? err.message : String(err))
+ toastManager.add({ type: 'error', title: err instanceof Error ? err.message : String(err) })
},
})
}
diff --git a/packages/dashboard/src/hooks/use-post-sale.ts b/packages/dashboard/src/hooks/use-post-sale.ts
index 22afcc6591..06f1d5a71a 100644
--- a/packages/dashboard/src/hooks/use-post-sale.ts
+++ b/packages/dashboard/src/hooks/use-post-sale.ts
@@ -1,6 +1,6 @@
import { adminClient, useResourceKey, useResourceKeyBuilder } from '@spree/dashboard-core'
+import { toastManager } from '@spree/dashboard-ui'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { toast } from 'sonner'
/**
* Exchanges and claims on an order. Fetched separately from the order for the
@@ -58,7 +58,10 @@ function usePostSaleMutation<TParams>(
onError: (error) => {
// Without this a rejected workflow — a claim with nothing to refund, a
// return that cannot be cancelled — looked like a dead button.
- toast.error(error instanceof Error ? error.message : String(error))
+ toastManager.add({
+ type: 'error',
+ title: error instanceof Error ? error.message : String(error),
+ })
},
})
}
diff --git a/packages/dashboard/src/hooks/use-returns.ts b/packages/dashboard/src/hooks/use-returns.ts
index 65f569ed35..468f6be4a6 100644
--- a/packages/dashboard/src/hooks/use-returns.ts
+++ b/packages/dashboard/src/hooks/use-returns.ts
@@ -1,6 +1,6 @@
import { adminClient, useResourceKey, useResourceKeyBuilder } from '@spree/dashboard-core'
+import { toastManager } from '@spree/dashboard-ui'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
-import { toast } from 'sonner'
/**
* Returns on an order. Fetched separately from the order itself so the order
@@ -40,7 +40,10 @@ function useReturnMutation<TParams>(
onError: (error) => {
// Without this a rejected workflow — a claim with nothing to refund, a
// return that cannot be cancelled — looked like a dead button.
- toast.error(error instanceof Error ? error.message : String(error))
+ toastManager.add({
+ type: 'error',
+ title: error instanceof Error ? error.message : String(error),
+ })
},
})
}
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 594b36567b..e8f5341d6b 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -4149,12 +4149,36 @@
}
},
"settings_nav": {
+ "descriptions": {
+ "allowed_origins": "النطاقات المسموح لها باستدعاء واجهة متجرك",
+ "api_keys": "مفاتيح تصرّح للتطبيقات والتكاملات",
+ "channels": "قنوات البيع وأماكن عرض منتجاتك",
+ "commission_rates": "ما يتقاضاه سوقك من البائعين",
+ "custom_field_definitions": "حقول إضافية للمنتجات والطلبات والعملاء",
+ "delivery_profiles": "طرق التوصيل والمناطق وتكاليف الشحن",
+ "emails": "عناوين المُرسِل وإعدادات رسائل المعاملات",
+ "imports": "سجل عمليات استيراد CSV ونتائجها",
+ "integrations": "اربط مزوّدي الشحن والضرائب وغيرهم",
+ "markets": "البلدان التي تبيع إليها وعملاتها",
+ "payment_methods": "بوابات الدفع وطريقة تحصيل المدفوعات",
+ "product_types": "قوالب تملأ المنتجات الجديدة مسبقًا",
+ "reasons": "أسباب المرتجعات والمبالغ المستردة والمطالبات",
+ "roles": "مجموعات الأذونات التي تسندها إلى الموظفين",
+ "seller_requirements": "قائمة يكملها البائعون قبل الموافقة",
+ "staff": "الأشخاص الذين يمكنهم الوصول إلى لوحة التحكم",
+ "stock_locations": "المستودعات ونقاط الاستلام التي تحتفظ بالمخزون",
+ "store": "اسم المتجر والمنطقة الزمنية والوحدات والإعدادات الإقليمية",
+ "tax_categories": "فئات الضريبة المخصصة للمنتجات",
+ "tax_rates": "النسب المطبقة حسب السوق والمنطقة",
+ "webhooks": "نقاط النهاية التي تُخطر عند وقوع الأحداث"
+ },
"groups": {
- "audit": "التدقيق",
- "fulfillment": "التنفيذ",
- "payments": "المدفوعات والضرائب",
+ "developer": "المطوّر",
+ "post_sale": "المرتجعات والبائعون",
+ "selling": "البيع",
+ "shipping": "الشحن والتوصيل",
"store": "المتجر",
- "team": "الفريق والوصول"
+ "team": "المستخدمون والأذونات"
},
"items": {
"allowed_origins": "المصادر المسموح بها",
@@ -4181,6 +4205,13 @@
"webhooks": "Webhooks"
}
},
+ "settings_page": {
+ "back_to_dashboard": "العودة إلى لوحة التحكم",
+ "description": "أدر متجرك وإعداد البيع والفريق.",
+ "no_results": "لا توجد إعدادات تطابق «{{query}}».",
+ "search_placeholder": "ابحث في الإعدادات",
+ "title": "الإعدادات"
+ },
"setup": {
"title": "إعداد Spree",
"subtitle": "أنشئ حساب المسؤول وأخبرنا عن متجرك. كل شيء هنا يمكن تغييره لاحقًا.",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 6cef7f68e5..63b7bb4719 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -4130,12 +4130,36 @@
}
},
"settings_nav": {
+ "descriptions": {
+ "allowed_origins": "Domains, die Ihre Storefront-API aufrufen dürfen",
+ "api_keys": "Schlüssel, die Apps und Integrationen autorisieren",
+ "channels": "Vertriebskanäle und wo Ihre Produkte angeboten werden",
+ "commission_rates": "Was Ihr Marktplatz Verkäufern berechnet",
+ "custom_field_definitions": "Zusätzliche Felder für Produkte, Bestellungen und Kunden",
+ "delivery_profiles": "Liefermethoden, Zonen und Versandkosten",
+ "emails": "Absenderadressen und Einstellungen für Transaktions-E-Mails",
+ "imports": "Verlauf der CSV-Importe und ihre Ergebnisse",
+ "integrations": "Versand-, Steuer- und andere Anbieter verbinden",
+ "markets": "Länder, in die Sie verkaufen, und ihre Währungen",
+ "payment_methods": "Zahlungsanbieter und wie Zahlungen eingezogen werden",
+ "product_types": "Vorlagen, die neue Produkte vorbefüllen",
+ "reasons": "Gründe für Retouren, Rückerstattungen und Reklamationen",
+ "roles": "Berechtigungssätze, die Sie Mitarbeitenden zuweisen",
+ "seller_requirements": "Checkliste, die Verkäufer vor der Freigabe erfüllen",
+ "staff": "Personen mit Zugriff auf dieses Dashboard",
+ "stock_locations": "Lager und Abholpunkte mit Beständen",
+ "store": "Shopname, Zeitzone, Einheiten und regionale Standards",
+ "tax_categories": "Steuerklassen für Produkte",
+ "tax_rates": "Sätze pro Markt und Region",
+ "webhooks": "Endpunkte, die bei Ereignissen benachrichtigt werden"
+ },
"groups": {
- "audit": "Audit",
- "fulfillment": "Fulfillment",
- "payments": "Zahlungen & Steuern",
+ "developer": "Entwickler",
+ "post_sale": "Retouren & Verkäufer",
+ "selling": "Verkauf",
+ "shipping": "Versand & Lieferung",
"store": "Shop",
- "team": "Team & Zugriff"
+ "team": "Benutzer & Berechtigungen"
},
"items": {
"allowed_origins": "Zugelassene Ursprünge",
@@ -4162,6 +4186,13 @@
"webhooks": "Webhooks"
}
},
+ "settings_page": {
+ "back_to_dashboard": "Zurück zum Dashboard",
+ "description": "Verwalten Sie Shop, Verkaufseinrichtung und Team.",
+ "no_results": "Keine Einstellungen für „{{query}}“.",
+ "search_placeholder": "Einstellungen durchsuchen",
+ "title": "Einstellungen"
+ },
"setup": {
"title": "Spree einrichten",
"subtitle": "Erstellen Sie Ihr Administratorkonto und beschreiben Sie Ihren Shop. Alles hier lässt sich später ändern.",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index bcf45d39cc..d7c054762f 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -4130,12 +4130,36 @@
}
},
"settings_nav": {
+ "descriptions": {
+ "allowed_origins": "Domains permitted to call your storefront API",
+ "api_keys": "Keys that authorize apps and integrations",
+ "channels": "Sales channels and where your products are offered",
+ "commission_rates": "What your marketplace charges sellers",
+ "custom_field_definitions": "Extra fields on products, orders and customers",
+ "delivery_profiles": "Delivery methods, zones and shipping rates",
+ "emails": "Sender addresses and transactional email settings",
+ "imports": "History of CSV imports and their results",
+ "integrations": "Connect shipping, tax and other providers",
+ "markets": "Countries you sell to and their currencies",
+ "payment_methods": "Payment gateways and how payments are captured",
+ "product_types": "Templates that pre-fill new products",
+ "reasons": "Reasons offered for returns, refunds and claims",
+ "roles": "Permission sets you assign to staff",
+ "seller_requirements": "Checklist sellers complete before approval",
+ "staff": "People with access to this dashboard",
+ "stock_locations": "Warehouses and pickup points that hold stock",
+ "store": "Store name, timezone, units and regional defaults",
+ "tax_categories": "Tax classes assigned to products",
+ "tax_rates": "Rates applied per market and region",
+ "webhooks": "Endpoints notified when events happen"
+ },
"groups": {
- "audit": "Audit",
- "fulfillment": "Fulfillment",
- "payments": "Payments & taxes",
+ "developer": "Developer",
+ "post_sale": "Returns & sellers",
+ "selling": "Selling",
+ "shipping": "Shipping & delivery",
"store": "Store",
- "team": "Team & access"
+ "team": "Users & permissions"
},
"items": {
"allowed_origins": "Allowed origins",
@@ -4162,6 +4186,13 @@
"webhooks": "Webhooks"
}
},
+ "settings_page": {
+ "back_to_dashboard": "Back to dashboard",
+ "description": "Manage your store, selling setup and team.",
+ "no_results": "No settings match “{{query}}”.",
+ "search_placeholder": "Search settings",
+ "title": "Settings"
+ },
"setup": {
"title": "Set up Spree",
"subtitle": "Create your admin account and tell us about your store. Everything here can be changed later.",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 07fef13f76..0d0eaff517 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -4130,12 +4130,36 @@
}
},
"settings_nav": {
+ "descriptions": {
+ "allowed_origins": "Domaines autorisés à appeler votre API boutique",
+ "api_keys": "Clés qui autorisent les applications et intégrations",
+ "channels": "Canaux de vente et lieux où vos produits sont proposés",
+ "commission_rates": "Ce que votre place de marché facture aux vendeurs",
+ "custom_field_definitions": "Champs supplémentaires sur les produits, commandes et clients",
+ "delivery_profiles": "Méthodes de livraison, zones et frais de port",
+ "emails": "Adresses d'expéditeur et paramètres des e-mails transactionnels",
+ "imports": "Historique des imports CSV et leurs résultats",
+ "integrations": "Connecter des prestataires d'expédition, de taxe et autres",
+ "markets": "Pays où vous vendez et leurs devises",
+ "payment_methods": "Passerelles de paiement et mode de capture",
+ "product_types": "Modèles qui préremplissent les nouveaux produits",
+ "reasons": "Motifs proposés pour retours, remboursements et réclamations",
+ "roles": "Ensembles d'autorisations attribués au personnel",
+ "seller_requirements": "Liste à compléter par les vendeurs avant validation",
+ "staff": "Personnes ayant accès à ce tableau de bord",
+ "stock_locations": "Entrepôts et points de retrait qui détiennent du stock",
+ "store": "Nom de la boutique, fuseau horaire, unités et valeurs régionales",
+ "tax_categories": "Classes de taxe attribuées aux produits",
+ "tax_rates": "Taux appliqués par marché et région",
+ "webhooks": "Points de terminaison notifiés lors d'événements"
+ },
"groups": {
- "audit": "Audit",
- "fulfillment": "Traitement des commandes",
- "payments": "Paiements et taxes",
+ "developer": "Développeur",
+ "post_sale": "Retours et vendeurs",
+ "selling": "Vente",
+ "shipping": "Expédition et livraison",
"store": "Boutique",
- "team": "Équipe et accès"
+ "team": "Utilisateurs et autorisations"
},
"items": {
"allowed_origins": "Origines autorisées",
@@ -4162,6 +4186,13 @@
"webhooks": "Webhooks"
}
},
+ "settings_page": {
+ "back_to_dashboard": "Retour au tableau de bord",
+ "description": "Gérez votre boutique, votre configuration de vente et votre équipe.",
+ "no_results": "Aucun paramètre ne correspond à « {{query}} ».",
+ "search_placeholder": "Rechercher dans les paramètres",
+ "title": "Paramètres"
+ },
"setup": {
"title": "Configurer Spree",
"subtitle": "Créez votre compte administrateur et présentez votre boutique. Tout ceci est modifiable par la suite.",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index fb2192d996..ccaff97aa0 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -4186,12 +4186,36 @@
}
},
"settings_nav": {
+ "descriptions": {
+ "allowed_origins": "Domeny uprawnione do wywoływania API sklepu",
+ "api_keys": "Klucze autoryzujące aplikacje i integracje",
+ "channels": "Kanały sprzedaży i miejsca oferowania produktów",
+ "commission_rates": "Opłaty pobierane od sprzedawców",
+ "custom_field_definitions": "Dodatkowe pola produktów, zamówień i klientów",
+ "delivery_profiles": "Metody dostawy, strefy i koszty wysyłki",
+ "emails": "Adresy nadawcy i ustawienia e-maili transakcyjnych",
+ "imports": "Historia importów CSV i ich wyniki",
+ "integrations": "Podłącz dostawców wysyłki, podatków i innych usług",
+ "markets": "Kraje, do których sprzedajesz, i ich waluty",
+ "payment_methods": "Bramki płatnicze i sposób pobierania płatności",
+ "product_types": "Szablony wstępnie wypełniające nowe produkty",
+ "reasons": "Powody zwrotów, refundacji i reklamacji",
+ "roles": "Zestawy uprawnień przypisywane pracownikom",
+ "seller_requirements": "Lista wymagań przed zatwierdzeniem sprzedawcy",
+ "staff": "Osoby z dostępem do tego panelu",
+ "stock_locations": "Magazyny i punkty odbioru przechowujące towar",
+ "store": "Nazwa sklepu, strefa czasowa, jednostki i ustawienia regionalne",
+ "tax_categories": "Klasy podatkowe przypisane do produktów",
+ "tax_rates": "Stawki stosowane według rynku i regionu",
+ "webhooks": "Adresy powiadamiane o zdarzeniach"
+ },
"groups": {
- "audit": "Audyt",
- "fulfillment": "Realizacja zamówień",
- "payments": "Płatności i podatki",
+ "developer": "Deweloper",
+ "post_sale": "Zwroty i sprzedawcy",
+ "selling": "Sprzedaż",
+ "shipping": "Wysyłka i dostawa",
"store": "Sklep",
- "team": "Zespół i dostęp"
+ "team": "Użytkownicy i uprawnienia"
},
"items": {
"allowed_origins": "Dozwolone źródła",
@@ -4218,6 +4242,13 @@
"webhooks": "Webhooki"
}
},
+ "settings_page": {
+ "back_to_dashboard": "Powrót do panelu",
+ "description": "Zarządzaj sklepem, konfiguracją sprzedaży i zespołem.",
+ "no_results": "Brak ustawień pasujących do „{{query}}”.",
+ "search_placeholder": "Szukaj w ustawieniach",
+ "title": "Ustawienia"
+ },
"setup": {
"title": "Skonfiguruj Spree",
"subtitle": "Utwórz konto administratora i opisz swój sklep. Wszystko tutaj możesz później zmienić.",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index ba98a32e71..d07efe8ae6 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -4125,12 +4125,36 @@
}
},
"settings_nav": {
+ "descriptions": {
+ "allowed_origins": "允许调用店铺 API 的域名",
+ "api_keys": "授权应用与集成的密钥",
+ "channels": "销售渠道以及商品的展示位置",
+ "commission_rates": "平台向卖家收取的费用",
+ "custom_field_definitions": "商品、订单和客户的额外字段",
+ "delivery_profiles": "配送方式、区域与运费",
+ "emails": "发件地址与交易邮件设置",
+ "imports": "CSV 导入历史与结果",
+ "integrations": "连接物流、税务及其他服务商",
+ "markets": "销售的国家/地区及其货币",
+ "payment_methods": "支付网关与收款方式",
+ "product_types": "用于预填新商品的模板",
+ "reasons": "退货、退款与索赔的可选原因",
+ "roles": "分配给员工的权限组",
+ "seller_requirements": "卖家通过审核前需完成的清单",
+ "staff": "可访问此后台的人员",
+ "stock_locations": "存放库存的仓库与自提点",
+ "store": "店铺名称、时区、单位与区域默认值",
+ "tax_categories": "分配给商品的税务类别",
+ "tax_rates": "按市场和地区适用的税率",
+ "webhooks": "事件发生时接收通知的端点"
+ },
"groups": {
- "audit": "审计",
- "fulfillment": "履约",
- "payments": "支付与税务",
+ "developer": "开发者",
+ "post_sale": "退货与卖家",
+ "selling": "销售",
+ "shipping": "配送与物流",
"store": "店铺",
- "team": "团队与权限"
+ "team": "用户与权限"
},
"items": {
"allowed_origins": "允许的来源",
@@ -4157,6 +4181,13 @@
"webhooks": "Webhooks"
}
},
+ "settings_page": {
+ "back_to_dashboard": "返回控制台",
+ "description": "管理店铺、销售配置与团队。",
+ "no_results": "没有与“{{query}}”匹配的设置。",
+ "search_placeholder": "搜索设置",
+ "title": "设置"
+ },
"setup": {
"title": "设置 Spree",
"subtitle": "创建您的管理员账户并介绍您的商店。此处的所有设置之后均可更改。",
diff --git a/packages/dashboard/src/nav/default.ts b/packages/dashboard/src/nav/default.ts
index d9a667c841..cc1b82b100 100644
--- a/packages/dashboard/src/nav/default.ts
+++ b/packages/dashboard/src/nav/default.ts
@@ -1,5 +1,7 @@
import type { Store } from '@spree/admin-sdk'
-import { hasVisibleSettingsEntries, i18n, nav, Subject } from '@spree/dashboard-core'
+// Entries use `labelKey` rather than a resolved `label` so the sidebar
+// re-renders on language change — see app-sidebar.tsx for resolution.
+import { hasVisibleSettingsEntries, nav, Subject } from '@spree/dashboard-core'
import {
BarChart3Icon,
HomeIcon,
@@ -20,7 +22,7 @@ import {
nav.add({
key: 'getting-started',
- label: i18n.t('admin.nav.getting_started'),
+ labelKey: 'admin.nav.getting_started',
path: '/getting-started',
icon: MapIcon,
position: 50,
@@ -35,7 +37,7 @@ nav.add({
nav.add({
key: 'home',
- label: i18n.t('admin.nav.home'),
+ labelKey: 'admin.nav.home',
path: '/',
icon: HomeIcon,
position: 100,
@@ -43,7 +45,7 @@ nav.add({
nav.add({
key: 'orders',
- label: i18n.t('admin.nav.orders'),
+ labelKey: 'admin.nav.orders',
path: '/orders',
icon: InboxIcon,
subject: Subject.Order,
@@ -51,7 +53,7 @@ nav.add({
children: [
{
key: 'orders.drafts',
- label: i18n.t('admin.nav.draft_orders'),
+ labelKey: 'admin.nav.draft_orders',
path: '/orders/drafts',
subject: Subject.Order,
position: 100,
@@ -61,7 +63,7 @@ nav.add({
// what came back from them.
{
key: 'returns',
- label: i18n.t('admin.nav.returns'),
+ labelKey: 'admin.nav.returns',
path: '/returns',
subject: Subject.Order,
position: 200,
@@ -69,7 +71,7 @@ nav.add({
},
{
key: 'exchanges',
- label: i18n.t('admin.nav.exchanges'),
+ labelKey: 'admin.nav.exchanges',
path: '/exchanges',
subject: Subject.Order,
position: 300,
@@ -77,7 +79,7 @@ nav.add({
},
{
key: 'claims',
- label: i18n.t('admin.nav.claims'),
+ labelKey: 'admin.nav.claims',
path: '/claims',
subject: Subject.Order,
position: 400,
@@ -88,7 +90,7 @@ nav.add({
nav.add({
key: 'products',
- label: i18n.t('admin.nav.products'),
+ labelKey: 'admin.nav.products',
path: '/products',
icon: PackageIcon,
subject: Subject.Product,
@@ -96,35 +98,35 @@ nav.add({
children: [
{
key: 'products.price-lists',
- label: i18n.t('admin.nav.price_lists'),
+ labelKey: 'admin.nav.price_lists',
path: '/products/price-lists',
subject: Subject.PriceList,
position: 100,
},
{
key: 'products.categories',
- label: i18n.t('admin.nav.categories'),
+ labelKey: 'admin.nav.categories',
path: '/products/categories',
subject: Subject.Category,
position: 300,
},
{
key: 'products.collections',
- label: i18n.t('admin.nav.collections'),
+ labelKey: 'admin.nav.collections',
path: '/products/collections',
subject: Subject.Collection,
position: 350,
},
{
key: 'products.options',
- label: i18n.t('admin.nav.options'),
+ labelKey: 'admin.nav.options',
path: '/products/options',
subject: Subject.OptionType,
position: 400,
},
{
key: 'products.transfers',
- label: i18n.t('admin.nav.transfers'),
+ labelKey: 'admin.nav.transfers',
path: '/products/transfers',
subject: Subject.StockTransfer,
position: 500,
@@ -134,7 +136,7 @@ nav.add({
nav.add({
key: 'customers',
- label: i18n.t('admin.nav.customers'),
+ labelKey: 'admin.nav.customers',
path: '/customers',
icon: UsersIcon,
subject: Subject.Customer,
@@ -142,14 +144,14 @@ nav.add({
children: [
{
key: 'customers.groups',
- label: i18n.t('admin.nav.customer_groups'),
+ labelKey: 'admin.nav.customer_groups',
path: '/customers/groups',
subject: Subject.CustomerGroup,
position: 100,
},
{
key: 'customers.companies',
- label: i18n.t('admin.nav.companies'),
+ labelKey: 'admin.nav.companies',
path: '/companies',
subject: Subject.Company,
position: 200,
@@ -161,7 +163,7 @@ nav.add({
// staff hold no seller permission at all.
nav.add({
key: 'sellers',
- label: i18n.t('admin.nav.sellers'),
+ labelKey: 'admin.nav.sellers',
path: '/sellers',
icon: StoreIcon,
subject: Subject.Seller,
@@ -170,7 +172,7 @@ nav.add({
nav.add({
key: 'promotions',
- label: i18n.t('admin.nav.promotions'),
+ labelKey: 'admin.nav.promotions',
path: '/promotions',
icon: TagIcon,
subject: Subject.Promotion,
@@ -178,7 +180,7 @@ nav.add({
children: [
{
key: 'promotions.gift-cards',
- label: i18n.t('admin.nav.gift_cards'),
+ labelKey: 'admin.nav.gift_cards',
path: '/promotions/gift-cards',
subject: Subject.GiftCard,
position: 100,
@@ -188,7 +190,7 @@ nav.add({
nav.add({
key: 'reports',
- label: i18n.t('admin.nav.reports'),
+ labelKey: 'admin.nav.reports',
path: '/reports',
icon: BarChart3Icon,
position: 600,
@@ -196,7 +198,7 @@ nav.add({
nav.add({
key: 'settings',
- label: i18n.t('admin.nav.settings'),
+ labelKey: 'admin.nav.settings',
path: '/settings',
icon: SettingsIcon,
// No `subject`: every staff member can read the store record (shell data),
diff --git a/packages/dashboard/src/nav/settings.ts b/packages/dashboard/src/nav/settings.ts
index f803bb059e..ac7b24a35c 100644
--- a/packages/dashboard/src/nav/settings.ts
+++ b/packages/dashboard/src/nav/settings.ts
@@ -26,24 +26,41 @@ import {
// Built-in entries use `labelKey` so labels re-render on language change —
// see settings-sidebar.tsx for resolution. Plugins can still pass `label`
// directly when they don't bundle their own translation files.
+//
+// `descriptionKey` is what the settings landing page shows under each entry;
+// `keywords` widen search so a merchant typing the word they know ("VAT",
+// "SKU") reaches the page named something else.
settingsNav.addGroup({ key: 'store', labelKey: 'admin.settings_nav.groups.store', position: 100 })
settingsNav.addGroup({
- key: 'payments',
- labelKey: 'admin.settings_nav.groups.payments',
- position: 150,
+ key: 'selling',
+ labelKey: 'admin.settings_nav.groups.selling',
+ position: 200,
})
settingsNav.addGroup({
- key: 'fulfillment',
- labelKey: 'admin.settings_nav.groups.fulfillment',
- position: 200,
+ key: 'shipping',
+ labelKey: 'admin.settings_nav.groups.shipping',
+ position: 300,
+})
+settingsNav.addGroup({
+ key: 'post_sale',
+ labelKey: 'admin.settings_nav.groups.post_sale',
+ position: 400,
+})
+settingsNav.addGroup({ key: 'team', labelKey: 'admin.settings_nav.groups.team', position: 500 })
+settingsNav.addGroup({
+ key: 'developer',
+ labelKey: 'admin.settings_nav.groups.developer',
+ position: 600,
})
-settingsNav.addGroup({ key: 'audit', labelKey: 'admin.settings_nav.groups.audit', position: 250 })
-settingsNav.addGroup({ key: 'team', labelKey: 'admin.settings_nav.groups.team', position: 300 })
+
+// --- Store ------------------------------------------------------------------
settingsNav.add({
key: 'settings.store',
labelKey: 'admin.settings_nav.items.store',
+ descriptionKey: 'admin.settings_nav.descriptions.store',
+ keywords: ['general', 'name', 'timezone', 'locale', 'units', 'weight', 'currency'],
path: '/store',
icon: StoreIcon,
group: 'store',
@@ -57,10 +74,12 @@ settingsNav.add({
settingsNav.add({
key: 'settings.emails',
labelKey: 'admin.settings_nav.items.emails',
+ descriptionKey: 'admin.settings_nav.descriptions.emails',
+ keywords: ['notifications', 'transactional', 'sender', 'from address'],
path: '/emails',
icon: MailIcon,
group: 'store',
- position: 125,
+ position: 200,
subject: Subject.Store,
action: 'update',
})
@@ -68,136 +87,172 @@ settingsNav.add({
settingsNav.add({
key: 'settings.channels',
labelKey: 'admin.settings_nav.items.channels',
+ descriptionKey: 'admin.settings_nav.descriptions.channels',
+ keywords: ['storefront', 'sales channel', 'pos', 'marketplace'],
path: '/channels',
icon: RadioTowerIcon,
group: 'store',
- position: 150,
+ position: 300,
subject: Subject.Channel,
})
+settingsNav.add({
+ key: 'settings.custom-field-definitions',
+ labelKey: 'admin.settings_nav.items.custom_field_definitions',
+ descriptionKey: 'admin.settings_nav.descriptions.custom_field_definitions',
+ keywords: ['metafields', 'attributes', 'extra fields'],
+ path: '/custom-field-definitions',
+ icon: TagIcon,
+ group: 'store',
+ position: 400,
+ subject: Subject.CustomFieldDefinition,
+})
+
+// --- Selling ----------------------------------------------------------------
+
+settingsNav.add({
+ key: 'settings.markets',
+ labelKey: 'admin.settings_nav.items.markets',
+ descriptionKey: 'admin.settings_nav.descriptions.markets',
+ keywords: ['countries', 'regions', 'currency', 'international', 'cross-border'],
+ path: '/markets',
+ icon: GlobeIcon,
+ group: 'selling',
+ position: 100,
+ subject: Subject.Market,
+})
+
settingsNav.add({
key: 'settings.payment-methods',
labelKey: 'admin.settings_nav.items.payment_methods',
+ descriptionKey: 'admin.settings_nav.descriptions.payment_methods',
+ keywords: ['gateway', 'stripe', 'paypal', 'checkout', 'capture'],
path: '/payment-methods',
icon: CreditCardIcon,
- group: 'payments',
- position: 100,
+ group: 'selling',
+ position: 200,
subject: Subject.PaymentMethod,
})
settingsNav.add({
key: 'settings.tax-categories',
labelKey: 'admin.settings_nav.items.tax_categories',
+ descriptionKey: 'admin.settings_nav.descriptions.tax_categories',
+ keywords: ['vat', 'gst', 'sales tax', 'tax class'],
path: '/tax-categories',
icon: PercentIcon,
- group: 'payments',
- position: 200,
+ group: 'selling',
+ position: 300,
subject: Subject.TaxCategory,
})
settingsNav.add({
key: 'settings.tax-rates',
labelKey: 'admin.settings_nav.items.tax_rates',
+ descriptionKey: 'admin.settings_nav.descriptions.tax_rates',
+ keywords: ['vat', 'gst', 'sales tax', 'rate', 'percentage'],
path: '/tax-rates',
icon: ReceiptTextIcon,
- group: 'payments',
- position: 250,
+ group: 'selling',
+ position: 400,
subject: Subject.TaxRate,
})
settingsNav.add({
- key: 'settings.commission-rates',
- labelKey: 'admin.settings_nav.items.commission_rates',
- path: '/commission-rates',
- icon: HandCoinsIcon,
- group: 'payments',
- position: 275,
- subject: Subject.CommissionRate,
-})
-
-settingsNav.add({
- key: 'settings.seller-requirements',
- labelKey: 'admin.settings_nav.items.seller_requirements',
- path: '/seller-requirements',
- icon: ClipboardCheckIcon,
- group: 'payments',
- position: 280,
- subject: Subject.Seller,
-})
-
-settingsNav.add({
- key: 'settings.markets',
- labelKey: 'admin.settings_nav.items.markets',
- path: '/markets',
- icon: GlobeIcon,
- group: 'payments',
- position: 300,
- subject: Subject.Market,
+ key: 'settings.integrations',
+ labelKey: 'admin.settings_nav.items.integrations',
+ descriptionKey: 'admin.settings_nav.descriptions.integrations',
+ keywords: ['apps', 'providers', 'credentials', 'easypost', 'avalara'],
+ path: '/integrations',
+ icon: PlugIcon,
+ group: 'selling',
+ position: 500,
+ subject: Subject.Integration,
})
-settingsNav.add({
- key: 'settings.product-types',
- labelKey: 'admin.settings_nav.items.product_types',
- path: '/product-types',
- icon: ShapesIcon,
- group: 'fulfillment',
- position: 70,
- subject: Subject.ProductType,
-})
+// --- Shipping & delivery ----------------------------------------------------
settingsNav.add({
key: 'settings.delivery-profiles',
labelKey: 'admin.settings_nav.items.delivery_profiles',
+ descriptionKey: 'admin.settings_nav.descriptions.delivery_profiles',
+ keywords: ['shipping', 'rates', 'zones', 'carriers', 'delivery methods'],
path: '/delivery-profiles',
icon: TruckIcon,
- group: 'fulfillment',
- position: 80,
+ group: 'shipping',
+ position: 100,
subject: Subject.DeliveryProfile,
})
settingsNav.add({
key: 'settings.stock-locations',
labelKey: 'admin.settings_nav.items.stock_locations',
+ descriptionKey: 'admin.settings_nav.descriptions.stock_locations',
+ keywords: ['warehouse', 'inventory', 'fulfillment', 'pickup'],
path: '/stock-locations',
icon: WarehouseIcon,
- group: 'fulfillment',
- position: 100,
+ group: 'shipping',
+ position: 200,
subject: Subject.StockLocation,
})
+settingsNav.add({
+ key: 'settings.product-types',
+ labelKey: 'admin.settings_nav.items.product_types',
+ descriptionKey: 'admin.settings_nav.descriptions.product_types',
+ keywords: ['templates', 'prototypes', 'product template'],
+ path: '/product-types',
+ icon: ShapesIcon,
+ group: 'shipping',
+ position: 300,
+ subject: Subject.ProductType,
+})
+
+// --- Returns & sellers ------------------------------------------------------
+
settingsNav.add({
key: 'settings.reasons',
labelKey: 'admin.settings_nav.items.reasons',
+ descriptionKey: 'admin.settings_nav.descriptions.reasons',
+ keywords: ['returns', 'refunds', 'claims', 'rma', 'reason'],
path: '/reasons',
icon: RotateCcwIcon,
- group: 'fulfillment',
- position: 200,
+ group: 'post_sale',
+ position: 100,
subject: Subject.ReturnReason,
})
settingsNav.add({
- key: 'settings.integrations',
- labelKey: 'admin.settings_nav.items.integrations',
- path: '/integrations',
- icon: PlugIcon,
- group: 'store',
- position: 175,
- subject: Subject.Integration,
+ key: 'settings.commission-rates',
+ labelKey: 'admin.settings_nav.items.commission_rates',
+ descriptionKey: 'admin.settings_nav.descriptions.commission_rates',
+ keywords: ['marketplace', 'sellers', 'payouts', 'fees'],
+ path: '/commission-rates',
+ icon: HandCoinsIcon,
+ group: 'post_sale',
+ position: 200,
+ subject: Subject.CommissionRate,
})
settingsNav.add({
- key: 'settings.custom-field-definitions',
- labelKey: 'admin.settings_nav.items.custom_field_definitions',
- path: '/custom-field-definitions',
- icon: TagIcon,
- group: 'store',
- position: 200,
- subject: Subject.CustomFieldDefinition,
+ key: 'settings.seller-requirements',
+ labelKey: 'admin.settings_nav.items.seller_requirements',
+ descriptionKey: 'admin.settings_nav.descriptions.seller_requirements',
+ keywords: ['marketplace', 'onboarding', 'approval', 'checklist'],
+ path: '/seller-requirements',
+ icon: ClipboardCheckIcon,
+ group: 'post_sale',
+ position: 300,
+ subject: Subject.Seller,
})
+// --- Users & permissions ----------------------------------------------------
+
settingsNav.add({
key: 'settings.staff',
labelKey: 'admin.settings_nav.items.staff',
+ descriptionKey: 'admin.settings_nav.descriptions.staff',
+ keywords: ['users', 'team', 'invite', 'admins'],
path: '/staff',
icon: UsersRoundIcon,
group: 'team',
@@ -208,39 +263,49 @@ settingsNav.add({
settingsNav.add({
key: 'settings.roles',
labelKey: 'admin.settings_nav.items.roles',
+ descriptionKey: 'admin.settings_nav.descriptions.roles',
+ keywords: ['permissions', 'access', 'rbac'],
path: '/roles',
icon: ShieldCheckIcon,
group: 'team',
- position: 150,
+ position: 200,
subject: Subject.Role,
})
+// --- Developer --------------------------------------------------------------
+
settingsNav.add({
key: 'settings.api-keys',
labelKey: 'admin.settings_nav.items.api_keys',
+ descriptionKey: 'admin.settings_nav.descriptions.api_keys',
+ keywords: ['tokens', 'secret key', 'publishable key', 'scopes'],
path: '/api-keys',
icon: KeyRoundIcon,
- group: 'team',
- position: 200,
+ group: 'developer',
+ position: 100,
subject: Subject.ApiKey,
})
settingsNav.add({
key: 'settings.webhooks',
labelKey: 'admin.settings_nav.items.webhooks',
+ descriptionKey: 'admin.settings_nav.descriptions.webhooks',
+ keywords: ['events', 'subscriptions', 'callbacks'],
path: '/webhooks',
icon: WebhookIcon,
- group: 'team',
- position: 250,
+ group: 'developer',
+ position: 200,
subject: Subject.WebhookEndpoint,
})
settingsNav.add({
key: 'settings.allowed-origins',
labelKey: 'admin.settings_nav.items.allowed_origins',
+ descriptionKey: 'admin.settings_nav.descriptions.allowed_origins',
+ keywords: ['cors', 'domains', 'headless'],
path: '/allowed-origins',
icon: GlobeLockIcon,
- group: 'team',
+ group: 'developer',
position: 300,
subject: Subject.AllowedOrigin,
})
@@ -251,10 +316,12 @@ settingsNav.add({
settingsNav.add({
key: 'settings.imports',
labelKey: 'admin.settings_nav.items.imports',
+ descriptionKey: 'admin.settings_nav.descriptions.imports',
+ keywords: ['csv', 'upload', 'bulk', 'migration'],
path: '/imports',
icon: UploadIcon,
- group: 'audit',
- position: 100,
+ group: 'developer',
+ position: 400,
subject: Subject.Product,
action: 'update',
})
diff --git a/packages/dashboard/src/routes/__root.tsx b/packages/dashboard/src/routes/__root.tsx
index d24bb29953..aefb54511a 100644
--- a/packages/dashboard/src/routes/__root.tsx
+++ b/packages/dashboard/src/routes/__root.tsx
@@ -9,7 +9,7 @@ function RootLayout() {
return (
<>
<Outlet />
- <Toaster position="bottom-right" />
+ <Toaster />
</>
)
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
index 2b454cca7e..5ae183c883 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId.tsx
@@ -2,6 +2,8 @@ import {
AppSidebar,
adminClient,
CommandPaletteProvider,
+ MobileBreadcrumbBar,
+ SettingsNavSheet,
SettingsSidebar,
StickyHeaderProvider,
StoreProvider,
@@ -75,6 +77,9 @@ function StoreShell({ inSettings }: { inSettings: boolean }) {
// open state — the trigger sits in the TopBar's user 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 (
<>
@@ -86,6 +91,8 @@ function StoreShell({ inSettings }: { inSettings: boolean }) {
<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 />
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
index 9c1a6e9058..2e201bbb34 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
@@ -1,6 +1,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Company, CompanyLocation } from '@spree/admin-sdk'
import {
+ adminClient,
mapSpreeErrorsToForm,
PageHeader,
Slot,
@@ -45,6 +46,7 @@ import {
useUpdateCompanyTaxIdentifier,
useValidateCompanyTaxIdentifier,
} from '../../../../hooks/use-companies'
+import { spreeJsonLinkResolver } from '../../../../lib/json-link-resolver'
import {
COMPANY_DEFAULTS,
type CompanyFormValues,
@@ -97,6 +99,12 @@ function CompanyBody({ company }: { company: Company }) {
subtitle={company.external_id ?? undefined}
backTo="companies"
resource={{ id: company.id }}
+ jsonPreview={{
+ title: `Company ${company.name}`,
+ fetch: () => adminClient.companies.get(company.id),
+ endpoint: `/api/v3/admin/companies/${company.id}`,
+ resolveLink: spreeJsonLinkResolver(storeId),
+ }}
onDelete={permissions.can('destroy', Subject.Company) ? handleDelete : undefined}
deleteLabel={t('admin.companies.detail.delete_label')}
/>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/companies/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/companies/index.tsx
index da44212701..207e910894 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/companies/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/companies/index.tsx
@@ -210,13 +210,12 @@ function CreateCompanySheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.companies.create_label')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/companies/locations.$locationId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/companies/locations.$locationId.tsx
index 560f7768b8..9ed77e2e9e 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/companies/locations.$locationId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/companies/locations.$locationId.tsx
@@ -4,7 +4,14 @@ import type {
CompanyLocation,
Customer,
} from '@spree/admin-sdk'
-import { PageHeader, ResourceCombobox, Slot, Subject, usePermissions } from '@spree/dashboard-core'
+import {
+ adminClient,
+ PageHeader,
+ ResourceCombobox,
+ Slot,
+ Subject,
+ usePermissions,
+} from '@spree/dashboard-core'
import {
AddressBlock,
Badge,
@@ -48,6 +55,7 @@ import {
useDeleteCompanyLocation,
} from '../../../../hooks/use-companies'
import { customerAutocompleteProps } from '../../../../hooks/use-customers'
+import { spreeJsonLinkResolver } from '../../../../lib/json-link-resolver'
export const Route = createFileRoute('/_authenticated/$storeId/companies/locations/$locationId')({
component: CompanyLocationDetailPage,
@@ -99,11 +107,21 @@ function CompanyLocationBody({ location }: { location: CompanyLocation }) {
subtitle={location.external_id ?? undefined}
backTo={`companies/${location.company_id}`}
resource={{ id: location.id }}
+ jsonPreview={{
+ title: `Location ${location.name}`,
+ fetch: () => adminClient.companyLocations.get(location.id),
+ endpoint: `/api/v3/admin/company_locations/${location.id}`,
+ resolveLink: spreeJsonLinkResolver(storeId),
+ }}
actions={
canEdit ? (
- <Button size="sm" variant="outline" onClick={() => setEditOpen(true)}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={() => setEditOpen(true)}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
) : undefined
}
@@ -340,7 +358,6 @@ function AddContactDialog({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={createMutation.isPending}
>
@@ -348,7 +365,6 @@ function AddContactDialog({
</Button>
<Button
type="button"
- size="sm"
disabled={createMutation.isPending || !customerId}
onClick={handleSubmit}
>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
index 0b3cf06cab..7d850670db 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/$customerId.tsx
@@ -247,9 +247,13 @@ function ProfileCard({ customer }: { customer: Customer }) {
<CardHeader>
<CardTitle>{t('admin.pages.customers.detail.section_profile')}</CardTitle>
<CardAction>
- <Button size="sm" variant="outline" onClick={() => setEditOpen(true)}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={() => setEditOpen(true)}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
</CardAction>
</CardHeader>
@@ -429,13 +433,12 @@ function EditProfileSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={mutation.isPending}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={mutation.isPending}>
+ <Button type="submit" disabled={mutation.isPending}>
{mutation.isPending ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
@@ -463,9 +466,13 @@ function CustomerGroupsCard({ customer }: { customer: Customer }) {
{groups.length > 0 && <Badge variant="outline">{groups.length}</Badge>}
</CardTitle>
<CardAction>
- <Button size="sm" variant="outline" onClick={() => setEditOpen(true)}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={() => setEditOpen(true)}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
</CardAction>
</CardHeader>
@@ -562,13 +569,12 @@ function EditGroupsSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={isPending}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="button" size="sm" onClick={handleSave} disabled={isPending || !dirty}>
+ <Button type="button" onClick={handleSave} disabled={isPending || !dirty}>
{isPending ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
@@ -804,9 +810,13 @@ function InternalNoteCard({ customer }: { customer: Customer }) {
<CardTitle>{t('admin.pages.customers.detail.section_internal_note')}</CardTitle>
{!editing && (
<CardAction>
- <Button size="sm" variant="outline" onClick={() => setEditing(true)}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={() => setEditing(true)}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
</CardAction>
)}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
index dd103e06e6..6d4bdc281f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
@@ -186,13 +186,12 @@ function CreateCustomerGroupSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.customers.groups.create_label')}
@@ -273,7 +272,6 @@ function EditCustomerGroupSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -281,7 +279,6 @@ function EditCustomerGroupSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
index 4769a2e96f..9928de657a 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/index.tsx
@@ -530,13 +530,12 @@ function NewCustomerSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={createMutation.isPending}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={createMutation.isPending}>
+ <Button type="submit" disabled={createMutation.isPending}>
{createMutation.isPending
? t('admin.actions.creating')
: t('admin.pages.customers.create_label')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
index b33bcd4975..7e35b447d8 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
@@ -94,20 +94,20 @@ function AnalyticsChart({ data }: { data: DashboardAnalytics }) {
return (
<Card>
- <CardHeader className="flex h-auto flex-col border-b p-0 sm:flex-row gap-0">
+ <CardHeader className="flex h-auto flex-row border-b p-0 gap-0">
{CHART_METRICS.map((metric) => (
<button
key={metric}
type="button"
onClick={() => setActiveMetric(metric)}
- className={`relative flex flex-1 flex-col justify-center gap-1 px-6 py-4 text-left ${
- activeMetric === metric ? 'bg-muted/50' : 'hover:bg-muted/25'
- } sm:border-l sm:first:border-l-0`}
+ className="relative flex min-w-0 flex-1 flex-col justify-center gap-1 border-l px-3 py-3 text-left transition-colors first:border-l-0 hover:bg-muted/40 sm:px-6 sm:py-4"
>
- <span className="text-xs text-muted-foreground">
+ <span className="truncate text-xs text-muted-foreground">
{t(`admin.pages.home.metrics.${metric}`)}
</span>
- <span className="text-lg font-bold leading-none">{summaryValues[metric]}</span>
+ <span className="truncate text-base font-bold leading-none sm:text-lg">
+ {summaryValues[metric]}
+ </span>
{activeMetric === metric && (
<span className="absolute inset-x-0 bottom-0 h-0.5 bg-primary" />
)}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/edit.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/edit.tsx
index 8d233fa6d6..2f0a92efd8 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/edit.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/orders/$orderId/edit.tsx
@@ -14,6 +14,7 @@ import {
FormActions,
ResourceLayout,
Separator,
+ toastManager,
useFormSubmitShortcut,
} from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
@@ -21,7 +22,6 @@ import { InfoIcon, PlusIcon } from 'lucide-react'
import { type ReactNode, useEffect, useState } from 'react'
import { useFieldArray, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { AddLineItemDialog } from '../../../../../components/spree/orders/line-item-dialogs'
import { OrderEditItemsTable } from '../../../../../components/spree/orders/order-edit-items-table'
import { useOrder, useOrderMutation } from '../../../../../hooks/use-order'
@@ -154,7 +154,7 @@ function OrderEditPage() {
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(t('admin.errors.failed_to_save'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_save') })
}
}
@@ -250,12 +250,7 @@ function OrderEditPage() {
backTo={`${storeId}/orders/${orderId}`}
actions={
<>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() => setAddingItem(true)}
- >
+ <Button type="button" variant="outline" onClick={() => setAddingItem(true)}>
<PlusIcon className="size-4" />
{t('admin.orders.edit.actions.add_product')}
</Button>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
index 0985459910..f93d7e0aa0 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
@@ -15,6 +15,7 @@ import {
ResourceLayout,
Skeleton,
StatusBadge,
+ toastManager,
useConfirm,
useFormSubmitShortcut,
} from '@spree/dashboard-ui'
@@ -23,7 +24,6 @@ import i18n from 'i18next'
import { useEffect } from 'react'
import { FormProvider, useForm, useWatch } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { CustomFieldsInlineCard } from '../../../../components/spree/custom-fields/custom-fields-inline'
import { ProductCustomFieldsProvider } from '../../../../components/spree/products/product-custom-fields-provider'
import {
@@ -393,11 +393,11 @@ function ProductForm({ product }: { product: Product }) {
),
}
form.reset(baseline)
- toast.success(t('admin.messages.product_saved'))
+ toastManager.add({ type: 'success', title: t('admin.messages.product_saved') })
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(t('admin.errors.failed_to_save'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_save') })
}
}
@@ -412,14 +412,14 @@ function ProductForm({ product }: { product: Product }) {
if (!confirmed) return
try {
await deleteProduct.mutateAsync(productId)
- toast.success(t('admin.messages.product_deleted'))
+ toastManager.add({ type: 'success', title: t('admin.messages.product_deleted') })
await router.navigate({
to: '/$storeId/products',
params: { storeId },
search: { filters: [], columns: [] },
})
} catch {
- toast.error(t('admin.errors.failed_to_delete'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_delete') })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/$categoryId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/$categoryId.tsx
index f004431233..37dca2a940 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/$categoryId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/$categoryId.tsx
@@ -13,6 +13,7 @@ import {
FormActions,
ResourceLayout,
Skeleton,
+ toastManager,
useConfirm,
useFormSubmitShortcut,
} from '@spree/dashboard-ui'
@@ -20,7 +21,6 @@ import { createFileRoute, useRouter } from '@tanstack/react-router'
import { useEffect } from 'react'
import { FormProvider, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import {
CategoryMain,
CategorySidebar,
@@ -101,7 +101,7 @@ function CategoryDetail({ categoryId, storeId }: { categoryId: string; storeId:
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(t('admin.errors.failed_to_save'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_save') })
}
}
@@ -118,7 +118,7 @@ function CategoryDetail({ categoryId, storeId }: { categoryId: string; storeId:
await deleteCategory.mutateAsync(categoryId)
await router.navigate({ to: '/$storeId/products/categories', params: { storeId } })
} catch {
- toast.error(t('admin.errors.failed_to_delete'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_delete') })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/new.tsx
index ad62304de2..3b7e482a9d 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/new.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/categories/new.tsx
@@ -6,11 +6,15 @@ import {
mapSpreeErrorsToForm,
PageHeader,
} from '@spree/dashboard-core'
-import { FormActions, ResourceLayout, useFormSubmitShortcut } from '@spree/dashboard-ui'
+import {
+ FormActions,
+ ResourceLayout,
+ toastManager,
+ useFormSubmitShortcut,
+} from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { FormProvider, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import {
CategoryMain,
CategorySidebar,
@@ -56,7 +60,7 @@ function NewCategoryPage() {
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(t('admin.errors.failed_to_create'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_create') })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/collections/$collectionId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/collections/$collectionId.tsx
index d7fc3658c9..34cda1adcd 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/collections/$collectionId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/collections/$collectionId.tsx
@@ -13,6 +13,7 @@ import {
FormActions,
ResourceLayout,
Skeleton,
+ toastManager,
useConfirm,
useFormSubmitShortcut,
} from '@spree/dashboard-ui'
@@ -20,7 +21,6 @@ import { createFileRoute, useRouter } from '@tanstack/react-router'
import { useEffect } from 'react'
import { FormProvider, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import {
CollectionMain,
CollectionSidebar,
@@ -106,7 +106,7 @@ function CollectionDetail({ collectionId, storeId }: { collectionId: string; sto
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(t('admin.errors.failed_to_save'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_save') })
}
}
@@ -123,7 +123,7 @@ function CollectionDetail({ collectionId, storeId }: { collectionId: string; sto
await deleteCollection.mutateAsync(collectionId)
await router.navigate({ to: '/$storeId/products/collections', params: { storeId } })
} catch {
- toast.error(t('admin.errors.failed_to_delete'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_delete') })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/collections/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/collections/new.tsx
index 11cecc336a..4f130270fc 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/collections/new.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/collections/new.tsx
@@ -6,11 +6,15 @@ import {
mapSpreeErrorsToForm,
PageHeader,
} from '@spree/dashboard-core'
-import { FormActions, ResourceLayout, useFormSubmitShortcut } from '@spree/dashboard-ui'
+import {
+ FormActions,
+ ResourceLayout,
+ toastManager,
+ useFormSubmitShortcut,
+} from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { FormProvider, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import {
CollectionMain,
CollectionSidebar,
@@ -56,7 +60,7 @@ function NewCollectionPage() {
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(t('admin.errors.failed_to_create'))
+ toastManager.add({ type: 'error', title: t('admin.errors.failed_to_create') })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
index 60fba78a3d..fbfb7730ab 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/index.tsx
@@ -38,7 +38,6 @@ import {
} from 'lucide-react'
import { useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { z } from 'zod/v4'
import { ImportWizardDialog } from '../../../../components/spree/imports/import-wizard-dialog'
import { categoryAutocompleteProps, useCategories } from '../../../../hooks/use-categories'
@@ -59,6 +58,7 @@ import {
useCloneProduct,
} from '../../../../hooks/use-products'
import '../../../../tables/products'
+import { toastManager } from '@spree/dashboard-ui'
// `import` carries the prefixed id of the import whose wizard dialog is open
// over the table — deep-linkable and refresh-safe.
@@ -423,9 +423,9 @@ function ProductRowActions({ product, storeId }: { product: Product; storeId: st
try {
await deleteMutation.mutateAsync(product.id)
- toast.success(t('admin.pages.products.delete_succeeded'))
+ toastManager.add({ type: 'success', title: t('admin.pages.products.delete_succeeded') })
} catch {
- toast.error(t('admin.pages.products.delete_failed'))
+ toastManager.add({ type: 'error', title: t('admin.pages.products.delete_failed') })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/new.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/new.tsx
index 3a2a659bb8..d81ba15aa0 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/new.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/new.tsx
@@ -6,11 +6,15 @@ import {
mapSpreeErrorsToForm,
PageHeader,
} from '@spree/dashboard-core'
-import { FormActions, ResourceLayout, useFormSubmitShortcut } from '@spree/dashboard-ui'
+import {
+ FormActions,
+ ResourceLayout,
+ toastManager,
+ useFormSubmitShortcut,
+} from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { FormProvider, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { CustomFieldsInlineCard } from '../../../../components/spree/custom-fields/custom-fields-inline'
import { ProductCustomFieldsProvider } from '../../../../components/spree/products/product-custom-fields-provider'
import {
@@ -139,7 +143,7 @@ function NewProductPage() {
try {
const product = await create.mutateAsync(payload)
- toast.success(t('admin.pages.products.new.create_succeeded'))
+ toastManager.add({ type: 'success', title: t('admin.pages.products.new.create_succeeded') })
// Replace history rather than pushing — otherwise the edit page's back
// button lands the merchant back on the (now-stale) new product form.
navigate({
@@ -150,7 +154,7 @@ function NewProductPage() {
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(t('admin.pages.products.new.create_failed'))
+ toastManager.add({ type: 'error', title: t('admin.pages.products.new.create_failed') })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
index 44c990573a..0132b8fad0 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
@@ -60,6 +60,7 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
+ toastManager,
useConfirm,
useRowClickBridge,
} from '@spree/dashboard-ui'
@@ -82,7 +83,6 @@ import {
useForm,
} from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { z } from 'zod/v4'
import { ResourceTranslationsDialog } from '../../../../components/spree/translations/resource-translations-dialog'
import {
@@ -253,13 +253,12 @@ function CreateOptionTypeSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.products.options.create_label')}
@@ -372,7 +371,6 @@ function EditOptionTypeSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -380,7 +378,6 @@ function EditOptionTypeSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
@@ -576,7 +573,7 @@ function OptionValuesFieldArray({
/>
))}
<TableRow className="hover:bg-transparent">
- <TableCell colSpan={totalColCount} className="p-0">
+ <TableCell colSpan={totalColCount} className="h-auto p-0">
<button
type="button"
onClick={() =>
@@ -761,7 +758,7 @@ function OptionValueImageField({
} catch (err) {
const message =
err instanceof Error ? err.message : t('admin.products.options.image_upload_failed')
- toast.error(message)
+ toastManager.add({ type: 'error', title: message })
} finally {
setUploading(false)
if (fileInputRef.current) fileInputRef.current.value = ''
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/$priceListId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/$priceListId/index.tsx
index afe8be70f0..d98d49d3bd 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/$priceListId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/$priceListId/index.tsx
@@ -1,7 +1,6 @@
-import { useConfirm } from '@spree/dashboard-ui'
+import { toastManager, useConfirm } from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { PriceListForm } from '../../../../../../components/spree/price-list-editors/price-list-form'
import {
useDeletePriceList,
@@ -41,7 +40,10 @@ function EditPriceListPage() {
} catch (err) {
// Surface failure as a toast and stay on the page — navigating away
// would tell the user the row vanished when it didn't.
- toast.error(err instanceof Error ? err.message : t('admin.errors.failed_to_delete'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.errors.failed_to_delete'),
+ })
return
}
navigate({ to: '/$storeId/products/price-lists', params: { storeId } })
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
index 9c70ec51d7..a45a01c900 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/price-lists/index.tsx
@@ -11,9 +11,9 @@ import { Button, RowActions, useConfirm, useRowClickBridge } from '@spree/dashbo
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { PlusIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { useDeletePriceList } from '../../../../../hooks/use-price-lists'
import '../../../../../tables/price-lists'
+import { toastManager } from '@spree/dashboard-ui'
export const Route = createFileRoute('/_authenticated/$storeId/products/price-lists/')({
validateSearch: resourceSearchSchema,
@@ -53,7 +53,10 @@ function PriceListsPage() {
try {
await deleteMutation.mutateAsync(list.id)
} catch (err) {
- toast.error(err instanceof Error ? err.message : t('admin.errors.failed_to_delete'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.errors.failed_to_delete'),
+ })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
index 43a8230210..4f88ad72af 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/transfers.tsx
@@ -386,7 +386,6 @@ function CreateStockTransferSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={createMutation.isPending}
>
@@ -394,7 +393,6 @@ function CreateStockTransferSheet({
</Button>
<Button
type="button"
- size="sm"
onClick={handleSubmit}
disabled={!canSubmit || createMutation.isPending}
>
@@ -512,7 +510,7 @@ function ViewStockTransferSheet({
)}
<SheetFooter>
- <Button type="button" variant="outline" size="sm" onClick={() => onOpenChange(false)}>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
{t('admin.actions.close')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
index d1d8361ca4..f3ebbf4eec 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/promotions/gift-cards.tsx
@@ -229,13 +229,12 @@ function CreateGiftCardSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: isBatch
@@ -348,7 +347,6 @@ function EditGiftCardSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -356,7 +354,6 @@ function EditGiftCardSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={!editable || form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
index f45db6c8aa..41de04bcbc 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
@@ -1,6 +1,7 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { Seller } from '@spree/admin-sdk'
import {
+ adminClient,
mapSpreeErrorsToForm,
PageHeader,
Slot,
@@ -70,6 +71,7 @@ import {
useSuspendSeller,
useUpdateSeller,
} from '../../../../hooks/use-sellers'
+import { spreeJsonLinkResolver } from '../../../../lib/json-link-resolver'
import {
PAYOUT_INTERVALS,
SELLER_DEFAULTS,
@@ -221,7 +223,7 @@ function SellerBody({ seller }: { seller: Seller }) {
query leaves `isPending` false with no data, which is why this gates
on the data rather than the loading flag. */}
{canApprove && (
- <Button size="sm" disabled={busy || !onboarding} onClick={handleApprove}>
+ <Button disabled={busy || !onboarding} onClick={handleApprove}>
{status === 'suspended'
? t('admin.sellers.actions.reinstate')
: t('admin.sellers.actions.approve')}
@@ -229,7 +231,6 @@ function SellerBody({ seller }: { seller: Seller }) {
)}
{canInvite && (
<Button
- size="sm"
variant={canApprove ? 'outline' : 'default'}
disabled={busy}
onClick={() => setInviting(true)}
@@ -290,6 +291,12 @@ function SellerBody({ seller }: { seller: Seller }) {
actions={primaryAction}
dropdownItems={dropdownItems}
resource={{ id: seller.id }}
+ jsonPreview={{
+ title: `Seller ${seller.name}`,
+ fetch: () => adminClient.sellers.get(seller.id),
+ endpoint: `/api/v3/admin/sellers/${seller.id}`,
+ resolveLink: spreeJsonLinkResolver(storeId),
+ }}
onDelete={permissions.can('destroy', Subject.Seller) ? handleDelete : undefined}
deleteLabel={t('admin.sellers.detail.delete_label')}
/>
@@ -377,9 +384,14 @@ function SellerBrandCard({
<div className="h-20 w-full border-border border-b bg-muted" />
)}
{canEdit && (
- <Button size="sm" variant="outline" className="absolute top-3 right-3" onClick={onEdit}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ className="absolute top-3 right-3 bg-background/80 backdrop-blur-sm hover:bg-background"
+ onClick={onEdit}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
)}
</div>
@@ -501,9 +513,13 @@ function SellerContactCard({
<CardTitle>{t('admin.sellers.detail.contact')}</CardTitle>
{canEdit && (
<CardAction>
- <Button variant="outline" size="sm" onClick={onEdit}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={onEdit}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
</CardAction>
)}
@@ -542,9 +558,13 @@ function SellerSettlementCard({
<CardTitle>{t('admin.sellers.detail.settlement')}</CardTitle>
{canEdit && (
<CardAction>
- <Button size="sm" variant="outline" onClick={onEdit}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={onEdit}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
</CardAction>
)}
@@ -750,13 +770,12 @@ function EditProfileSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
@@ -954,13 +973,12 @@ function EditSettlementSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
@@ -1039,13 +1057,12 @@ function InviteSellerSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.saving')
: t('admin.sellers.actions.send_invitation')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/index.tsx
index 547b78db4f..c707ea82af 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/index.tsx
@@ -214,13 +214,12 @@ function CreateSellerSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.sellers.create_label')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings.tsx
index 5b8bb1690b..4179e0e8f4 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings.tsx
@@ -8,6 +8,11 @@ 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.
+ *
+ * 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
+ * rest of the area. Start a settings page at `<div className="flex flex-col
+ * gap-6">`.
*/
function SettingsLayout() {
return (
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
index b18ade11a7..39343f1238 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/allowed-origins.tsx
@@ -202,13 +202,12 @@ function CreateAllowedOriginSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.allowed_origins.create_label')}
@@ -273,7 +272,6 @@ function EditAllowedOriginSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -281,7 +279,6 @@ function EditAllowedOriginSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx
index c476473f15..ccdaa57054 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/api-keys.tsx
@@ -54,6 +54,7 @@ import {
TableHead,
TableHeader,
TableRow,
+ toastManager,
useConfirm,
useCopyToClipboard,
} from '@spree/dashboard-ui'
@@ -71,7 +72,6 @@ import {
import { useEffect, useMemo, useState } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { z } from 'zod/v4'
import { PermissionGrid } from '../../../../components/spree/permission-picker'
import {
@@ -116,7 +116,7 @@ function ApiKeysSettingsPage() {
title={t('admin.pages.settings.api_keys.title')}
subtitle={t('admin.pages.settings.api_keys.subtitle')}
actions={
- <Button size="sm" onClick={() => setCreateOpen(true)}>
+ <Button onClick={() => setCreateOpen(true)}>
<PlusIcon className="size-4" />
{t('admin.pages.settings.api_keys.new_cta')}
</Button>
@@ -298,9 +298,12 @@ function ApiKeyRow({
try {
await revokeMutation.mutateAsync(apiKey.id)
- toast.success(t('admin.messages.key_revoked'))
+ toastManager.add({ type: 'success', title: t('admin.messages.key_revoked') })
} catch (err) {
- toast.error(err instanceof Error ? err.message : t('admin.errors.failed_to_revoke_key'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.errors.failed_to_revoke_key'),
+ })
}
}
@@ -315,9 +318,12 @@ function ApiKeyRow({
try {
await deleteMutation.mutateAsync(apiKey.id)
- toast.success(t('admin.messages.key_deleted'))
+ toastManager.add({ type: 'success', title: t('admin.messages.key_deleted') })
} catch (err) {
- toast.error(err instanceof Error ? err.message : t('admin.api_keys.errors.failed_to_delete'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.api_keys.errors.failed_to_delete'),
+ })
}
}
@@ -563,13 +569,16 @@ function CreateApiKeyDialog({
}
try {
const key = await createMutation.mutateAsync(params)
- toast.success(t('admin.messages.key_created'))
+ toastManager.add({ type: 'success', title: t('admin.messages.key_created') })
form.reset({ name: '', key_type: 'secret', scopes: [], channel_id: '' })
onCreated(key)
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(err instanceof Error ? err.message : t('admin.api_keys.errors.failed_to_create'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.api_keys.errors.failed_to_create'),
+ })
}
}
@@ -661,13 +670,12 @@ function CreateApiKeyDialog({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.api_keys.create_key_cta')}
@@ -716,12 +724,15 @@ function EditApiKeyDialog({
if (!apiKey) return
try {
await updateMutation.mutateAsync({ id: apiKey.id, params: { name: values.name } })
- toast.success(t('admin.messages.key_updated'))
+ toastManager.add({ type: 'success', title: t('admin.messages.key_updated') })
onOpenChange(false)
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(err instanceof Error ? err.message : t('admin.api_keys.errors.failed_to_update'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.api_keys.errors.failed_to_update'),
+ })
}
}
@@ -757,13 +768,12 @@ function EditApiKeyDialog({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
@@ -990,9 +1000,7 @@ function TokenRevealDialog({
)}
</DialogBody>
<DialogFooter>
- <Button size="sm" onClick={() => onOpenChange(false)}>
- {t('admin.actions.done')}
- </Button>
+ <Button onClick={() => onOpenChange(false)}>{t('admin.actions.done')}</Button>
</DialogFooter>
</DialogContent>
</Dialog>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/channels.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/channels.tsx
index af8a4dbcc7..0d2f7360ee 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/channels.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/channels.tsx
@@ -201,13 +201,12 @@ function CreateChannelSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.pages.channels.create_label')}
@@ -293,7 +292,6 @@ function EditChannelSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -301,7 +299,6 @@ function EditChannelSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/commission-rates.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/commission-rates.tsx
index 38f1d5492c..25abc160f8 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/commission-rates.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/commission-rates.tsx
@@ -226,13 +226,12 @@ function CreateCommissionRateSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.commission_rates.create_label')}
@@ -297,7 +296,6 @@ function EditCommissionRateSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -305,7 +303,6 @@ function EditCommissionRateSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
index 7f14069cad..148fe3954f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/custom-field-definitions.tsx
@@ -191,13 +191,12 @@ function CreateSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.custom_field_definitions.create_label')}
@@ -281,7 +280,6 @@ function EditSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -289,7 +287,6 @@ function EditSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx
index 42c190b326..13d4f23312 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/$profileId/index.tsx
@@ -7,6 +7,7 @@ import type {
DeliveryZoneMember,
} from '@spree/admin-sdk'
import {
+ adminClient,
Can,
mapSpreeErrorsToForm,
PageHeader,
@@ -77,6 +78,7 @@ import {
formatAmount,
summarizeRules,
} from '../../../../../../lib/delivery-method-summary'
+import { spreeJsonLinkResolver } from '../../../../../../lib/json-link-resolver'
import {
type DeliveryProfileGeneralValues,
type DeliveryProfileLocationsValues,
@@ -198,6 +200,12 @@ function DeliveryProfileDetailBody({ profile }: { profile: DeliveryProfile }) {
title={profile.name}
backTo="settings/delivery-profiles"
resource={{ id: profile.id }}
+ jsonPreview={{
+ title: `Delivery profile ${profile.name}`,
+ fetch: () => adminClient.deliveryProfiles.get(profile.id),
+ endpoint: `/api/v3/admin/delivery_profiles/${profile.id}`,
+ resolveLink: spreeJsonLinkResolver(storeId),
+ }}
onDelete={profile.default ? undefined : handleDelete}
deleteLabel={t('admin.delivery_profiles.detail.delete_label')}
/>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/index.tsx
index ebd11ee8b6..b7233c21e7 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/delivery-profiles/index.tsx
@@ -300,13 +300,12 @@ function CreateProfileDialog({ onClose }: { onClose: () => void }) {
<Button
type="button"
variant="outline"
- size="sm"
onClick={onClose}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.delivery_profiles.create_label')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails.tsx
index 62ec757b3d..375c4da759 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails.tsx
@@ -17,12 +17,12 @@ import {
ResourceLayout,
Skeleton,
Switch,
+ toastManager,
useFormSubmitShortcut,
} from '@spree/dashboard-ui'
import { createFileRoute } from '@tanstack/react-router'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { useStoreSettings, useUpdateStoreSettings } from '../../../../hooks/use-store-settings'
import { type StoreEmailsFormValues, storeEmailsFormSchema } from '../../../../schemas/store-emails'
@@ -103,7 +103,7 @@ function EmailSettingsForm({ store }: { store: Store }) {
const onSubmit = async (values: StoreEmailsFormValues) => {
try {
await updateMutation.mutateAsync(formValuesToApiParams(values))
- toast.success(t('admin.messages.store_settings_updated'))
+ toastManager.add({ type: 'success', title: t('admin.messages.store_settings_updated') })
// Re-seed the form from `values` so dirty state collapses; the next render
// will reflect the server's mailer_logo_url through `store`.
form.reset({
@@ -115,7 +115,10 @@ function EmailSettingsForm({ store }: { store: Store }) {
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(err instanceof Error ? err.message : t('admin.errors.failed_to_update_store'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.errors.failed_to_update_store'),
+ })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/index.tsx
index c28f019d29..4605885b1c 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/index.tsx
@@ -1,11 +1,114 @@
-import { createFileRoute, redirect } from '@tanstack/react-router'
+import {
+ filterSettingsByPermissions,
+ filterSettingsByQuery,
+ PageHeader,
+ resolveNavDescription,
+ resolveNavLabel,
+ type SettingsNavEntry,
+ usePermissions,
+ useSettingsNav,
+} from '@spree/dashboard-core'
+import { Card, SearchInput } from '@spree/dashboard-ui'
+import { createFileRoute, Link } from '@tanstack/react-router'
+import { PackageIcon } from 'lucide-react'
+import { useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
export const Route = createFileRoute('/_authenticated/$storeId/settings/')({
- beforeLoad: ({ params }) => {
- throw redirect({
- to: '/$storeId/settings/store',
- params: { storeId: params.storeId },
- replace: true,
- })
- },
+ component: SettingsIndexPage,
})
+
+/**
+ * Settings landing page — a card grid of every settings area the current staff
+ * member can reach, grouped the same way the sidebar groups them.
+ *
+ * It doubles as the settings navigation below `lg`, where `SettingsSidebar` is
+ * hidden: on a narrow viewport this grid is the only way into the area, so it
+ * must never be replaced by a redirect to a specific page.
+ */
+function SettingsIndexPage() {
+ const { t } = useTranslation()
+ const snapshot = useSettingsNav()
+ const { permissions } = usePermissions()
+ const [query, setQuery] = useState('')
+
+ // Permission filtering depends only on the snapshot, so it survives typing.
+ const allowed = useMemo(
+ () => filterSettingsByPermissions(snapshot, permissions),
+ [snapshot, permissions],
+ )
+ const groups = useMemo(() => filterSettingsByQuery(allowed, query, t).groups, [allowed, query, t])
+
+ return (
+ <div className="flex flex-col gap-6">
+ <PageHeader
+ title={t('admin.settings_page.title')}
+ subtitle={t('admin.settings_page.description')}
+ />
+
+ {/* Hidden from `lg`, where the settings sidebar is on screen listing the
+ same entries and carrying the same search. Below that the sidebar is
+ gone, so this is the only way to filter — and the only navigation. */}
+ <div className="lg:hidden">
+ <SearchInput
+ value={query}
+ onValueChange={setQuery}
+ placeholder={t('admin.settings_page.search_placeholder')}
+ aria-label={t('admin.settings_page.search_placeholder')}
+ clearLabel={t('admin.common.clear')}
+ className="h-11 max-w-md"
+ />
+ </div>
+
+ {groups.length === 0 ? (
+ <p className="text-sm text-muted-foreground">
+ {t('admin.settings_page.no_results', { query: query.trim() })}
+ </p>
+ ) : (
+ groups.map(({ group, entries }) => (
+ <section key={group.key} className="flex flex-col gap-3">
+ <h2 className="text-sm font-medium text-muted-foreground">
+ {resolveNavLabel(group, t)}
+ </h2>
+ <div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
+ {entries.map((entry) => (
+ <SettingsCard key={entry.key} entry={entry} />
+ ))}
+ </div>
+ </section>
+ ))
+ )}
+ </div>
+ )
+}
+
+function SettingsCard({ entry }: { entry: SettingsNavEntry }) {
+ const { t } = useTranslation()
+ const { storeId } = Route.useParams()
+ const Icon = entry.icon ?? PackageIcon
+ const label = resolveNavLabel(entry, t)
+ const description = resolveNavDescription(entry, t)
+
+ return (
+ <Card className="p-0 transition-colors hover:bg-accent/20">
+ {/* The whole card is the target — a small title-only link would fail the
+ 44px minimum on touch and leaves most of the card dead to a click. */}
+ {/* Paths come from a runtime registry plugins extend, so they can't be
+ checked against the generated route tree. */}
+ <Link
+ to={`/${storeId}/settings${entry.path}` as never}
+ // The whole card is the target, so without a replacement for the
+ // suppressed outline a keyboard user tabbing the grid cannot tell which
+ // card they are on. A solid ring rather than the border pair buttons
+ // use: this link draws no border of its own to recolour.
+ className="flex h-full items-start gap-3 rounded-xl p-4 outline-none focus-visible:shadow-[0_0_0_2px_var(--ring)]"
+ >
+ <Icon className="mt-0.5 size-6 shrink-0 text-muted-foreground opacity-80 hover:opacity-100" />
+ <span className="flex min-w-0 flex-col gap-1">
+ <span className="text-sm font-medium leading-none">{label}</span>
+ {description && <span className="text-sm text-muted-foreground">{description}</span>}
+ </span>
+ </Link>
+ </Card>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/integrations.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/integrations.tsx
index 93a432a4ba..c0079f0fc9 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/integrations.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/integrations.tsx
@@ -70,7 +70,7 @@ function IntegrationsPage() {
const configuringType = types.find((type) => type.type === search.configure)
return (
- <div className="flex flex-col gap-6 p-4">
+ <div className="flex flex-col gap-6">
<PageHeader
title={t('admin.integrations.title')}
subtitle={t('admin.integrations.description')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
index aea65558f8..e0d106bcce 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/markets.tsx
@@ -205,13 +205,12 @@ function CreateMarketSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.markets.create_label')}
@@ -287,7 +286,6 @@ function EditMarketSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -295,7 +293,6 @@ function EditMarketSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
index 7e0cb98d4b..2e16581125 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/payment-methods.tsx
@@ -231,13 +231,12 @@ function CreatePaymentMethodSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.payment_methods.create_label')}
@@ -356,7 +355,6 @@ function EditPaymentMethodSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -364,7 +362,6 @@ function EditPaymentMethodSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={
form.formState.isSubmitting || (!form.formState.isDirty && !preferencesDirty)
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/product-types.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/product-types.tsx
index 4c684c02ab..9b46af4d72 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/product-types.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/product-types.tsx
@@ -239,13 +239,12 @@ function CreateProductTypeSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.product_types.create_label')}
@@ -322,7 +321,6 @@ function EditProductTypeSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -330,7 +328,6 @@ function EditProductTypeSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles.tsx
index 9e8012fbd5..33c99ca7dd 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/roles.tsx
@@ -18,12 +18,12 @@ import {
TableHead,
TableHeader,
TableRow,
+ toastManager,
useConfirm,
} from '@spree/dashboard-ui'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { CopyIcon, LockIcon, PlusIcon, ShieldIcon } from 'lucide-react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { z } from 'zod/v4'
import { permissionKeyLabel } from '../../../../components/spree/permission-picker'
import { RoleSheet } from '../../../../components/spree/role-sheet'
@@ -73,7 +73,7 @@ function RolesSettingsPage() {
subtitle={t('admin.pages.roles.subtitle')}
actions={
permissions.can('create', 'Spree::Role') && (
- <Button size="sm" onClick={() => openCreate()}>
+ <Button onClick={() => openCreate()}>
<PlusIcon className="size-4" />
{t('admin.pages.roles.add_cta')}
</Button>
@@ -160,9 +160,12 @@ function RoleRow({
try {
await deleteMutation.mutateAsync(role.id)
- toast.success(t('admin.roles.messages.deleted'))
+ toastManager.add({ type: 'success', title: t('admin.roles.messages.deleted') })
} catch (err) {
- toast.error(err instanceof Error ? err.message : t('admin.roles.errors.failed_to_delete'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.roles.errors.failed_to_delete'),
+ })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
index 0ef94d090a..8a16087a97 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/staff.tsx
@@ -49,6 +49,7 @@ import {
TableHead,
TableHeader,
TableRow,
+ toastManager,
useConfirm,
useCopyToClipboard,
} from '@spree/dashboard-ui'
@@ -66,7 +67,6 @@ import {
import { useState } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { z } from 'zod/v4'
import {
useCreateInvitation,
@@ -101,7 +101,7 @@ function StaffSettingsPage() {
title={t('admin.pages.staff.title')}
subtitle={t('admin.pages.staff.subtitle')}
actions={
- <Button size="sm" onClick={() => setInviteOpen(true)}>
+ <Button onClick={() => setInviteOpen(true)}>
<PlusIcon className="size-4" />
{t('admin.pages.staff.invite_cta')}
</Button>
@@ -188,9 +188,12 @@ function StaffRow({ member }: { member: AdminUser }) {
try {
await removeMutation.mutateAsync(member.id)
- toast.success(t('admin.pages.staff.messages.removed'))
+ toastManager.add({ type: 'success', title: t('admin.pages.staff.messages.removed') })
} catch (err) {
- toast.error(err instanceof Error ? err.message : t('admin.staff.errors.failed_to_remove'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.staff.errors.failed_to_remove'),
+ })
}
}
@@ -305,15 +308,18 @@ function InvitationRow({ invitation }: { invitation: Invitation }) {
? `${window.location.origin}${invitation.acceptance_url}`
: invitation.acceptance_url
await copy(url)
- toast.success(t('admin.staff.actions.invitation_link_copied'))
+ toastManager.add({ type: 'success', title: t('admin.staff.actions.invitation_link_copied') })
}
async function handleResend() {
try {
await resendMutation.mutateAsync(invitation.id)
- toast.success(t('admin.messages.invitation_resent'))
+ toastManager.add({ type: 'success', title: t('admin.messages.invitation_resent') })
} catch (err) {
- toast.error(err instanceof Error ? err.message : t('admin.staff.errors.failed_to_resend'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.staff.errors.failed_to_resend'),
+ })
}
}
@@ -328,9 +334,12 @@ function InvitationRow({ invitation }: { invitation: Invitation }) {
try {
await deleteMutation.mutateAsync(invitation.id)
- toast.success(t('admin.pages.staff.messages.revoked'))
+ toastManager.add({ type: 'success', title: t('admin.pages.staff.messages.revoked') })
} catch (err) {
- toast.error(err instanceof Error ? err.message : t('admin.staff.errors.failed_to_revoke'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.staff.errors.failed_to_revoke'),
+ })
}
}
@@ -423,13 +432,16 @@ function InviteDialog({
async function onSubmit(values: InviteFormValues) {
try {
await createMutation.mutateAsync(values)
- toast.success(t('admin.messages.invitation_sent'))
+ toastManager.add({ type: 'success', title: t('admin.messages.invitation_sent') })
form.reset({ email: '', role_id: '' })
onOpenChange(false)
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(err instanceof Error ? err.message : t('admin.errors.failed_to_send_invitation'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.errors.failed_to_send_invitation'),
+ })
}
}
@@ -513,13 +525,12 @@ function InviteDialog({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.sending')
: t('admin.actions.send_invitation')}
@@ -578,12 +589,15 @@ function EditStaffSheet({
role_ids: values.role_ids,
},
})
- toast.success(t('admin.pages.staff.messages.updated'))
+ toastManager.add({ type: 'success', title: t('admin.pages.staff.messages.updated') })
onOpenChange(false)
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(err instanceof Error ? err.message : t('admin.errors.failed_to_update_staff'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.errors.failed_to_update_staff'),
+ })
}
}
@@ -664,17 +678,12 @@ function EditStaffSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button
- type="submit"
- size="sm"
- disabled={form.formState.isSubmitting || !form.formState.isDirty}
- >
+ <Button type="submit" disabled={form.formState.isSubmitting || !form.formState.isDirty}>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
index 5188e92e05..bed562e130 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/stock-locations.tsx
@@ -222,13 +222,12 @@ function CreateStockLocationSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.stock_locations.create_label')}
@@ -303,7 +302,6 @@ function EditStockLocationSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -311,7 +309,6 @@ function EditStockLocationSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
index 254667753c..2ec11bd14e 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
@@ -32,6 +32,7 @@ import {
SelectValue,
Skeleton,
Switch,
+ toastManager,
useFormSubmitShortcut,
} from '@spree/dashboard-ui'
import { createFileRoute } from '@tanstack/react-router'
@@ -45,7 +46,6 @@ import {
useForm,
} from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { ChoiceCardPicker } from '../../../../components/spree/choice-card-picker'
import { useStoreSettings, useUpdateStoreSettings } from '../../../../hooks/use-store-settings'
import { getAvailableUiLocales } from '../../../../i18n-setup'
@@ -229,7 +229,7 @@ function StoreSettingsForm({ store }: { store: Store }) {
preferred_order_number_sequence_start: values.preferred_order_number_sequence_start,
...extensionValues,
})
- toast.success(t('admin.messages.store_settings_updated'))
+ toastManager.add({ type: 'success', title: t('admin.messages.store_settings_updated') })
// Reset FIRST so the form is no longer dirty — otherwise the language
// switch below reloads the page while the `beforeunload` dirty-guard is
// still armed, triggering the browser's "unsaved changes" prompt.
@@ -255,7 +255,10 @@ function StoreSettingsForm({ store }: { store: Store }) {
} catch (err) {
if (mapSpreeErrorsToForm(err, form.setError)) return
if (err instanceof SpreeError) throw err
- toast.error(err instanceof Error ? err.message : t('admin.errors.failed_to_update_store'))
+ toastManager.add({
+ type: 'error',
+ title: err instanceof Error ? err.message : t('admin.errors.failed_to_update_store'),
+ })
}
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
index 8b7fad0f8e..8dd14a652c 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-categories.tsx
@@ -181,13 +181,12 @@ function CreateTaxCategorySheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.tax_categories.create_label')}
@@ -259,7 +258,6 @@ function EditTaxCategorySheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -267,7 +265,6 @@ function EditTaxCategorySheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx
index b89a8a4d73..9ad44f9ecc 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/tax-rates.tsx
@@ -188,13 +188,12 @@ function CreateTaxRateSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.tax_rates.create_label')}
@@ -269,7 +268,6 @@ function EditTaxRateSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
@@ -277,7 +275,6 @@ function EditTaxRateSheet({
</Button>
<Button
type="submit"
- size="sm"
disabled={form.formState.isSubmitting || !form.formState.isDirty}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
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 902f16b8c6..812558b8bd 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId.tsx
@@ -42,7 +42,6 @@ import { AlertTriangleIcon, PencilIcon, PlayIcon, RotateCcwIcon } from 'lucide-r
import { lazy, Suspense } from 'react'
import { type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { z } from 'zod/v4'
import { WebhookEndpointFormFields } from '../../../../../components/spree/webhook-endpoint-form'
import {
@@ -61,6 +60,8 @@ import {
webhookEndpointFormSchema,
} from '../../../../../schemas/webhook-endpoint'
import '../../../../../tables/webhook-deliveries'
+import { toastManager } from '@spree/dashboard-ui'
+import { spreeJsonLinkResolver } from '../../../../../lib/json-link-resolver'
// `<JsonValueView>` pulls in `@uiw/react-json-view` (~30 KB gzip). Lazy-loading
// it keeps the route's entry chunk small — the renderer only matters when an
@@ -165,13 +166,18 @@ function WebhookEndpointDetailBody({ endpoint }: { endpoint: WebhookEndpoint })
async function handleSendTest() {
try {
await sendTestMutation.mutateAsync(endpoint.id)
- toast.success(t('admin.pages.settings.webhooks.deliveries.test_sent'))
+ toastManager.add({
+ type: 'success',
+ title: t('admin.pages.settings.webhooks.deliveries.test_sent'),
+ })
} catch (err) {
- toast.error(
- err instanceof Error
- ? err.message
- : t('admin.pages.settings.webhooks.deliveries.test_failed'),
- )
+ toastManager.add({
+ type: 'error',
+ title:
+ err instanceof Error
+ ? err.message
+ : t('admin.pages.settings.webhooks.deliveries.test_failed'),
+ })
}
}
@@ -226,12 +232,17 @@ function WebhookEndpointDetailBody({ endpoint }: { endpoint: WebhookEndpoint })
subtitle={endpoint.name ? <CopyableUrl url={endpoint.url} /> : undefined}
backTo="settings/webhooks"
resource={{ id: endpoint.id }}
+ jsonPreview={{
+ title: `Webhook ${endpoint.url}`,
+ fetch: () => adminClient.webhookEndpoints.get(endpoint.id),
+ endpoint: `/api/v3/admin/webhook_endpoints/${endpoint.id}`,
+ resolveLink: spreeJsonLinkResolver(storeId),
+ }}
onDelete={handleDelete}
deleteLabel={t('admin.pages.settings.webhooks.detail.delete_label')}
actions={
<Can I="update" a={Subject.WebhookEndpoint}>
<Button
- size="sm"
variant="outline"
onClick={handleSendTest}
disabled={sendTestMutation.isPending || !!endpoint.disabled_at}
@@ -239,9 +250,13 @@ function WebhookEndpointDetailBody({ endpoint }: { endpoint: WebhookEndpoint })
<PlayIcon className="size-4" />
{t('admin.pages.settings.webhooks.actions.send_test')}
</Button>
- <Button size="sm" variant="outline" onClick={openEdit}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ onClick={openEdit}
+ aria-label={t('admin.actions.edit')}
+ >
<PencilIcon className="size-4" />
- {t('admin.actions.edit')}
</Button>
</Can>
}
@@ -521,17 +536,12 @@ function EditEndpointSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button
- type="submit"
- size="sm"
- disabled={form.formState.isSubmitting || !form.formState.isDirty}
- >
+ <Button type="submit" disabled={form.formState.isSubmitting || !form.formState.isDirty}>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
</SheetFooter>
@@ -717,12 +727,14 @@ function DeliveryDetailSheet({
<SheetFooter>
<Button
type="button"
- size="sm"
onClick={() =>
redeliver
.mutateAsync(deliveryId)
.then(() =>
- toast.success(t('admin.pages.settings.webhooks.deliveries.redeliver_queued')),
+ toastManager.add({
+ type: 'success',
+ title: t('admin.pages.settings.webhooks.deliveries.redeliver_queued'),
+ }),
)
.catch(() => undefined)
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index.tsx
index 5e942742bd..8016ab4604 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index.tsx
@@ -34,7 +34,6 @@ import { AlertTriangleIcon, BanIcon, CheckIcon, CopyIcon, PlayIcon, PlusIcon } f
import { useState } from 'react'
import { useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { z } from 'zod/v4'
import { WebhookEndpointFormFields } from '../../../../../components/spree/webhook-endpoint-form'
import {
@@ -49,6 +48,7 @@ import {
webhookEndpointFormSchema,
} from '../../../../../schemas/webhook-endpoint'
import '../../../../../tables/webhook-endpoints'
+import { toastManager } from '@spree/dashboard-ui'
const webhooksSearchSchema = resourceSearchSchema.extend({
new: z.coerce.boolean().optional(),
@@ -112,13 +112,18 @@ function WebhooksPage() {
async function handleSendTest(endpoint: WebhookEndpoint) {
try {
await sendTestMutation.mutateAsync(endpoint.id)
- toast.success(t('admin.pages.settings.webhooks.deliveries.test_sent'))
+ toastManager.add({
+ type: 'success',
+ title: t('admin.pages.settings.webhooks.deliveries.test_sent'),
+ })
} catch (err) {
- toast.error(
- err instanceof Error
- ? err.message
- : t('admin.pages.settings.webhooks.deliveries.test_failed'),
- )
+ toastManager.add({
+ type: 'error',
+ title:
+ err instanceof Error
+ ? err.message
+ : t('admin.pages.settings.webhooks.deliveries.test_failed'),
+ })
}
}
@@ -270,13 +275,12 @@ function CreateEndpointSheet({
<Button
type="button"
variant="outline"
- size="sm"
onClick={() => onOpenChange(false)}
disabled={form.formState.isSubmitting}
>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" size="sm" disabled={form.formState.isSubmitting}>
+ <Button type="submit" disabled={form.formState.isSubmitting}>
{form.formState.isSubmitting
? t('admin.actions.creating')
: t('admin.actions.create')}
@@ -327,9 +331,7 @@ function SecretRevealDialog({
)}
</DialogBody>
<DialogFooter>
- <Button size="sm" onClick={() => onOpenChange(false)}>
- {t('admin.actions.done')}
- </Button>
+ <Button onClick={() => onOpenChange(false)}>{t('admin.actions.done')}</Button>
</DialogFooter>
</DialogContent>
</Dialog>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f1a25ecb43..e4d6d51f37 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -264,9 +264,6 @@ importers:
recharts:
specifier: ^3.8.1
- sonner:
- specifier: ^2.0.7
spark-md5:
specifier: ^3.0.2
version: 3.0.2
@@ -373,9 +370,6 @@ importers:
react-i18next:
specifier: ^17.0.8
- sonner:
- specifier: ^2.0.7
spark-md5:
specifier: ^3.0.2
version: 3.0.2
@@ -589,9 +583,6 @@ importers:
recharts:
specifier: ^3.8.1
- sonner:
- specifier: ^2.0.7
tailwind-merge:
specifier: ^3.5.0
version: 3.5.0
@@ -4040,12 +4031,6 @@ packages:
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
engines: {node: '>=8'}
- resolution: {integrity: sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==}
- peerDependencies:
- react: ^18.0.0 || ^19.0.0 || ^19.0.0-rc
- react-dom: ^18.0.0 || ^19.0.0 || ^19.0.0-rc
-
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
@@ -7793,11 +7778,6 @@ snapshots:
- dependencies:
- react: 19.2.6
- react-dom: 19.2.6([email protected])
-