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.

Changed dashboard rows to Item and banners to Alert (#14925)

Damian Legawiecd4948ef587a7
diff --git a/packages/dashboard-core/src/components/import-wizard-dialog.tsx b/packages/dashboard-core/src/components/import-wizard-dialog.tsx
index 29a50843ba..be785f466a 100644
--- a/packages/dashboard-core/src/components/import-wizard-dialog.tsx
+++ b/packages/dashboard-core/src/components/import-wizard-dialog.tsx
@@ -1,4 +1,6 @@
import {
+ Alert,
+ AlertDescription,
Badge,
Button,
Card,
@@ -33,6 +35,7 @@ import {
CheckCircle2Icon,
ChevronLeftIcon,
ChevronRightIcon,
+ CircleAlertIcon,
DownloadIcon,
RotateCcwIcon,
XIcon,
@@ -107,13 +110,7 @@ export function ImportWizardDialog({ importId, onClose, onViewRecords }: ImportW
}}
modal
>
- <DialogContent
- // Edge-to-edge minus a 3-unit gutter — see BulkPriceEditorDialog for
- // why every inset/translate/max is overridden.
- className="!inset-3 !w-auto !max-w-none !translate-x-0 !translate-y-0 flex flex-col p-0"
- style={{ maxHeight: 'none' }}
- showCloseButton={false}
- >
+ <DialogContent fullScreen showCloseButton={false}>
{importId && (
<ImportWizard
importId={importId}
@@ -472,10 +469,10 @@ function MappingStep({
</div>
{error && (
- <div className="flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-destructive text-sm">
- <AlertTriangleIcon className="size-4 shrink-0" />
- <span>{error.message}</span>
- </div>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertDescription>{error.message}</AlertDescription>
+ </Alert>
)}
</CardContent>
</Card>
diff --git a/packages/dashboard-core/src/components/resource-picker-sheet.tsx b/packages/dashboard-core/src/components/resource-picker-sheet.tsx
index 205148f776..229a12050d 100644
--- a/packages/dashboard-core/src/components/resource-picker-sheet.tsx
+++ b/packages/dashboard-core/src/components/resource-picker-sheet.tsx
@@ -1,6 +1,11 @@
import {
Button,
Checkbox,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemTitle,
type PaginationMeta,
SearchInput,
Sheet,
@@ -308,11 +313,10 @@ export function ResourcePickerSheet<T extends PickerOption>({
const subtitle = getOptionSubtitle?.(option)
return (
<li key={option.id}>
- <button
- type="button"
- disabled={inList}
+ <Item
+ render={<button type="button" disabled={inList} />}
onClick={() => toggle(option)}
- className="flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-accent/50 disabled:cursor-not-allowed disabled:opacity-60"
+ className="flex-nowrap gap-3 rounded-none px-4 py-2.5 text-left hover:bg-accent/50 disabled:cursor-not-allowed disabled:opacity-60"
>
<Checkbox
checked={checked}
@@ -320,20 +324,22 @@ export function ResourcePickerSheet<T extends PickerOption>({
className="pointer-events-none"
/>
{getOptionImageUrl && <Thumbnail src={imageUrl} size="sm" />}
- <span className="min-w-0 flex-1">
- <span className="block truncate text-sm">{getOptionLabel(option)}</span>
+ <ItemContent className="min-w-0 gap-0">
+ <ItemTitle className="block truncate font-normal">
+ {getOptionLabel(option)}
+ </ItemTitle>
{subtitle && (
- <span className="block truncate text-muted-foreground text-xs">
+ <ItemDescription className="line-clamp-1 text-xs">
{subtitle}
- </span>
+ </ItemDescription>
)}
- </span>
+ </ItemContent>
{inList && (
- <span className="shrink-0 text-muted-foreground text-xs">
+ <ItemActions className="shrink-0 text-muted-foreground text-xs">
{t('admin.resource_picker.already_added')}
- </span>
+ </ItemActions>
)}
- </button>
+ </Item>
</li>
)
})}
diff --git a/packages/dashboard-core/src/products/bulk-variants-dialog.tsx b/packages/dashboard-core/src/products/bulk-variants-dialog.tsx
index 1faf22d3eb..d849248d69 100644
--- a/packages/dashboard-core/src/products/bulk-variants-dialog.tsx
+++ b/packages/dashboard-core/src/products/bulk-variants-dialog.tsx
@@ -215,13 +215,7 @@ export function BulkVariantsDialog({ form, open, onOpenChange }: Props) {
return (
<Dialog open={open} onOpenChange={(next) => (next ? onOpenChange(true) : handleCancel())} modal>
- <DialogContent
- // Edge-to-edge minus a 3-unit gutter, same overrides as the bulk
- // price dialog (see BulkPriceEditorDialog for why each is needed).
- className="!inset-3 !w-auto !max-w-none !translate-x-0 !translate-y-0 flex flex-col p-0"
- style={{ maxHeight: 'none' }}
- showCloseButton={false}
- >
+ <DialogContent fullScreen showCloseButton={false}>
<DialogHeader className="flex flex-row items-center justify-between gap-3 space-y-0 border-b p-3">
<DialogTitle className="truncate">
{t('admin.products.variants.bulk_edit.title')}
diff --git a/packages/dashboard-core/src/products/variants-options-builder.tsx b/packages/dashboard-core/src/products/variants-options-builder.tsx
index 566c01c7d2..47935f3e00 100644
--- a/packages/dashboard-core/src/products/variants-options-builder.tsx
+++ b/packages/dashboard-core/src/products/variants-options-builder.tsx
@@ -4,6 +4,10 @@ import {
Field,
FieldLabel,
Input,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemTitle,
Select,
SelectContent,
SelectItem,
@@ -130,39 +134,38 @@ export function VariantsOptionsBuilder({ selected, onChange, extraOptionTypes }:
)
}
return (
- <li
- key={ot.id}
- className="flex items-center gap-3 rounded-lg border border-border-subtle px-3 py-2"
- >
- <div className="min-w-0 flex-1">
- <div className="text-sm font-medium">{ot.label}</div>
- <div className="mt-1 flex flex-wrap gap-1">
+ <Item key={ot.id} variant="outline" render={<li />} className="border-border-subtle">
+ <ItemContent className="min-w-0">
+ <ItemTitle>{ot.label}</ItemTitle>
+ <div className="flex flex-wrap gap-1">
{ot.values.map((v) => (
<Badge key={v.name} variant="secondary">
{v.label ?? v.name}
</Badge>
))}
</div>
- </div>
- <Button
- type="button"
- variant="ghost"
- size="icon-sm"
- aria-label={t('admin.actions.edit')}
- onClick={() => setEditingIndex(i)}
- >
- <PencilIcon />
- </Button>
- <Button
- type="button"
- variant="ghost"
- size="icon-sm"
- aria-label={t('admin.actions.remove')}
- onClick={() => removeAt(i)}
- >
- <XIcon />
- </Button>
- </li>
+ </ItemContent>
+ <ItemActions>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t('admin.actions.edit')}
+ onClick={() => setEditingIndex(i)}
+ >
+ <PencilIcon />
+ </Button>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t('admin.actions.remove')}
+ onClick={() => removeAt(i)}
+ >
+ <XIcon />
+ </Button>
+ </ItemActions>
+ </Item>
)
})}
</ul>
diff --git a/packages/dashboard-core/src/products/variants-section.tsx b/packages/dashboard-core/src/products/variants-section.tsx
index 787475248c..31bae2f2c1 100644
--- a/packages/dashboard-core/src/products/variants-section.tsx
+++ b/packages/dashboard-core/src/products/variants-section.tsx
@@ -16,6 +16,9 @@ import {
import { CSS } from '@dnd-kit/utilities'
import type { ProductFormValues, VariantFormValues } from '@spree/dashboard-core'
import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
Button,
Card,
CardContent,
@@ -31,7 +34,7 @@ import {
TableHeader,
TableRow,
} from '@spree/dashboard-ui'
-import { PencilIcon, SwatchBookIcon, XIcon } from '@spree/dashboard-ui/icons'
+import { PencilIcon, SwatchBookIcon, TriangleAlertIcon, XIcon } from '@spree/dashboard-ui/icons'
import { type CSSProperties, useEffect, useMemo, useState } from 'react'
import { type UseFormReturn, useFieldArray, useWatch } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
@@ -361,31 +364,34 @@ export function VariantsSection({ form, seedFromType = false }: Props) {
/>
{orphanedKeys.length > 0 && (
- <div className="rounded-lg border border-amber-300 bg-amber-50 p-3 text-sm dark:border-amber-700 dark:bg-amber-950/40">
- <p className="font-medium text-amber-900 dark:text-amber-100">
+ <Alert variant="warning">
+ <TriangleAlertIcon />
+ <AlertTitle>
{t('admin.products.variants.orphan_warning', { count: orphanedKeys.length })}
- </p>
- {orphanedEntries.length > 0 && (
- <ul className="mt-1 list-disc pl-5 text-amber-900 dark:text-amber-200">
- {orphanedEntries.map((entry) => (
- <li key={entry.key}>{entry.label}</li>
- ))}
- </ul>
- )}
- <div className="mt-2 flex items-center justify-end gap-2">
- <Button type="button" variant="ghost" size="sm" onClick={handleKeepOrphans}>
- {t('admin.products.variants.keep')}
- </Button>
- <Button
- type="button"
- variant="destructive"
- size="sm"
- onClick={handleConfirmDropOrphans}
- >
- {t('admin.actions.remove')}
- </Button>
- </div>
- </div>
+ </AlertTitle>
+ <AlertDescription>
+ {orphanedEntries.length > 0 && (
+ <ul className="list-disc pl-5">
+ {orphanedEntries.map((entry) => (
+ <li key={entry.key}>{entry.label}</li>
+ ))}
+ </ul>
+ )}
+ <div className="mt-2 flex items-center justify-end gap-2">
+ <Button type="button" variant="ghost" size="sm" onClick={handleKeepOrphans}>
+ {t('admin.products.variants.keep')}
+ </Button>
+ <Button
+ type="button"
+ variant="destructive"
+ size="sm"
+ onClick={handleConfirmDropOrphans}
+ >
+ {t('admin.actions.remove')}
+ </Button>
+ </div>
+ </AlertDescription>
+ </Alert>
)}
{fields.length > 0 && !awaitingOptionValues && (
diff --git a/packages/dashboard-ui/src/spree/address-book-row.tsx b/packages/dashboard-ui/src/spree/address-book-row.tsx
index 111102e3c0..5c30413ca3 100644
--- a/packages/dashboard-ui/src/spree/address-book-row.tsx
+++ b/packages/dashboard-ui/src/spree/address-book-row.tsx
@@ -1,14 +1,8 @@
import { useTranslation } from 'react-i18next'
import { Badge } from '../ui/badge'
-import { Button } from '../ui/button'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from '../ui/dropdown-menu'
+import { Item, ItemActions, ItemContent, ItemTitle } from '../ui/item'
import { AddressBlock, type AddressBlockValue } from './address-block'
-import { EllipsisVerticalIcon, PencilIcon, TrashIcon } from './icons'
+import { RowActions } from './row-actions'
/** What every address book row needs, whoever owns the book. */
export interface AddressBookEntry extends AddressBlockValue {
@@ -45,52 +39,44 @@ export function AddressBookRow({
const { t } = useTranslation()
return (
- <div className="flex items-start justify-between gap-2 rounded-md border p-3">
- <div className="flex min-w-0 flex-col gap-1">
- <span className="flex flex-wrap items-center gap-2">
- {address.label && (
- <span className="font-medium text-foreground text-sm">{address.label}</span>
- )}
- {address.is_default_billing && (
- <Badge variant="outline">{t('admin.address_book.default_billing')}</Badge>
- )}
- {address.is_default_shipping && (
- <Badge variant="outline">{t('admin.address_book.default_shipping')}</Badge>
- )}
- </span>
+ <Item variant="outline" className="items-start">
+ <ItemContent className="min-w-0">
+ {(address.label || address.is_default_billing || address.is_default_shipping) && (
+ <ItemTitle className="flex-wrap">
+ {address.label}
+ {address.is_default_billing && (
+ <Badge variant="outline">{t('admin.address_book.default_billing')}</Badge>
+ )}
+ {address.is_default_shipping && (
+ <Badge variant="outline">{t('admin.address_book.default_shipping')}</Badge>
+ )}
+ </ItemTitle>
+ )}
<AddressBlock address={address} />
- </div>
+ </ItemContent>
{canEdit && (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" size="icon-xs" className="shrink-0">
- <EllipsisVerticalIcon className="size-4" />
- <span className="sr-only">{t('admin.actions.actions_menu')}</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem onClick={onEdit}>
- <PencilIcon className="size-4" />
- {t('admin.actions.edit')}
- </DropdownMenuItem>
- {onSetDefaultBilling && !address.is_default_billing && (
- <DropdownMenuItem onClick={onSetDefaultBilling}>
- {t('admin.address_book.set_default_billing')}
- </DropdownMenuItem>
- )}
- {onSetDefaultShipping && !address.is_default_shipping && (
- <DropdownMenuItem onClick={onSetDefaultShipping}>
- {t('admin.address_book.set_default_shipping')}
- </DropdownMenuItem>
- )}
- <DropdownMenuItem variant="destructive" onClick={onRemove}>
- <TrashIcon className="size-4" />
- {t('admin.actions.delete')}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ <ItemActions>
+ <RowActions
+ actions={[
+ { key: 'edit', onSelect: onEdit },
+ {
+ key: 'set_default_billing',
+ label: t('admin.address_book.set_default_billing'),
+ visible: !!onSetDefaultBilling && !address.is_default_billing,
+ onSelect: () => onSetDefaultBilling?.(),
+ },
+ {
+ key: 'set_default_shipping',
+ label: t('admin.address_book.set_default_shipping'),
+ visible: !!onSetDefaultShipping && !address.is_default_shipping,
+ onSelect: () => onSetDefaultShipping?.(),
+ },
+ { key: 'delete', destructive: true, onSelect: onRemove },
+ ]}
+ />
+ </ItemActions>
)}
- </div>
+ </Item>
)
}
diff --git a/packages/dashboard-ui/src/spree/bulk-price-table.tsx b/packages/dashboard-ui/src/spree/bulk-price-table.tsx
index fa88671c9e..885c41855e 100644
--- a/packages/dashboard-ui/src/spree/bulk-price-table.tsx
+++ b/packages/dashboard-ui/src/spree/bulk-price-table.tsx
@@ -1,5 +1,6 @@
import { PlusIcon, XIcon } from 'lucide-react'
import { useMemo } from 'react'
+import { Alert, AlertDescription } from '../ui/alert'
import { Button } from '../ui/button'
import {
DataGrid,
@@ -9,6 +10,7 @@ import {
MoneyCell,
ReadOnlyCell,
} from './data-grid'
+import { CircleAlertIcon } from './icons'
import { SearchInput } from './search-input'
export interface BulkPriceRow {
@@ -318,12 +320,10 @@ export function BulkPriceTable({
// table in a card does.
<div className="flex h-full flex-col gap-3">
{error && (
- <div
- role="alert"
- className="mx-3 shrink-0 rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-destructive text-sm"
- >
- {error}
- </div>
+ <Alert variant="destructive" className="mx-3 w-auto shrink-0">
+ <CircleAlertIcon />
+ <AlertDescription>{error}</AlertDescription>
+ </Alert>
)}
{showToolbar && (
// Always-mounted toolbar. Conditionally rendering the search input
diff --git a/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx b/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
index 37a3c7f52c..17817b01b3 100644
--- a/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
+++ b/packages/dashboard-ui/src/spree/claim-resolve-dialog.tsx
@@ -11,6 +11,7 @@ import {
} from '../ui/dialog'
import { Field, FieldLabel } from '../ui/field'
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from '../ui/input-group'
+import { Item, ItemActions, ItemContent, ItemTitle } from '../ui/item'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select'
import { Switch } from '../ui/switch'
import type { RefundMethod } from './return-dialogs'
@@ -178,21 +179,23 @@ export function ClaimResolveDialog({
{t('admin.pages.orders.detail.claims.replacement_items')}
</span>
{lines.map((line) => (
- <div
- key={line.id}
- className="flex items-center justify-between gap-4 rounded-lg border border-border-subtle p-3"
- >
- <span className="truncate text-sm">
- {line.label}
- <span className="text-muted-foreground"> ×{line.quantity}</span>
- </span>
- <Switch
- checked={replacing[line.id] ?? false}
- onCheckedChange={(checked) =>
- setReplacing({ ...replacing, [line.id]: checked })
- }
- />
- </div>
+ <Item key={line.id} variant="outline" className="flex-nowrap border-border-subtle">
+ <ItemContent className="min-w-0">
+ <ItemTitle className="block truncate font-normal">
+ {line.label}
+ <span className="text-muted-foreground"> ×{line.quantity}</span>
+ </ItemTitle>
+ </ItemContent>
+ <ItemActions>
+ <Switch
+ aria-label={line.label}
+ checked={replacing[line.id] ?? false}
+ onCheckedChange={(checked) =>
+ setReplacing({ ...replacing, [line.id]: checked })
+ }
+ />
+ </ItemActions>
+ </Item>
))}
</div>
)}
diff --git a/packages/dashboard-ui/src/spree/fulfillment-item-list.tsx b/packages/dashboard-ui/src/spree/fulfillment-item-list.tsx
index 0cdca1c143..c09f60c7bf 100644
--- a/packages/dashboard-ui/src/spree/fulfillment-item-list.tsx
+++ b/packages/dashboard-ui/src/spree/fulfillment-item-list.tsx
@@ -1,4 +1,5 @@
import type { ReactNode } from 'react'
+import { Item, ItemActions, ItemContent, ItemDescription, ItemTitle } from '../ui/item'
import { Thumbnail } from '../ui/thumbnail'
import { PackageIcon } from './icons'
@@ -30,17 +31,17 @@ export type FulfillmentItemRowData = {
*/
function ItemRow({ row }: { row: FulfillmentItemRowData }) {
return (
- <div className="flex items-center gap-3 p-3">
+ <Item className="flex-nowrap gap-3 rounded-none border-0 p-3">
<Thumbnail src={row.thumbnailUrl} fallback={<PackageIcon />} />
- <div className="min-w-0 flex-1">
- <div className="truncate text-sm font-medium">{row.name}</div>
+ <ItemContent className="min-w-0 gap-0">
+ <ItemTitle className="block truncate">{row.name}</ItemTitle>
{row.optionsText && (
- <div className="truncate text-xs text-muted-foreground">{row.optionsText}</div>
+ <ItemDescription className="line-clamp-1 text-xs">{row.optionsText}</ItemDescription>
)}
- </div>
+ </ItemContent>
- <div className="min-w-0 shrink text-right text-muted-foreground text-sm">
+ <ItemActions className="min-w-0 shrink flex-col items-end gap-0 text-right text-muted-foreground text-sm">
{row.displayPrice ? (
<span className="whitespace-nowrap">
{row.displayPrice} × {row.quantity}
@@ -48,9 +49,9 @@ function ItemRow({ row }: { row: FulfillmentItemRowData }) {
) : (
<span className="whitespace-nowrap">× {row.quantity}</span>
)}
- {row.priceSource && <div className="truncate text-xs">{row.priceSource}</div>}
- </div>
- </div>
+ {row.priceSource && <div className="max-w-full truncate text-xs">{row.priceSource}</div>}
+ </ItemActions>
+ </Item>
)
}
diff --git a/packages/dashboard-ui/src/spree/icons.ts b/packages/dashboard-ui/src/spree/icons.ts
index e99c58bf8c..f6caea8214 100644
--- a/packages/dashboard-ui/src/spree/icons.ts
+++ b/packages/dashboard-ui/src/spree/icons.ts
@@ -38,6 +38,7 @@ export {
ChevronsLeftIcon,
ChevronsRightIcon,
ChevronsUpDownIcon,
+ CircleAlertIcon,
CircleCheckIcon,
CircleDotIcon,
CircleIcon,
diff --git a/packages/dashboard-ui/src/spree/post-sale-fields.tsx b/packages/dashboard-ui/src/spree/post-sale-fields.tsx
index fc89be0b1c..4c6ae826cd 100644
--- a/packages/dashboard-ui/src/spree/post-sale-fields.tsx
+++ b/packages/dashboard-ui/src/spree/post-sale-fields.tsx
@@ -1,6 +1,7 @@
import { useTranslation } from 'react-i18next'
import { Field, FieldLabel } from '../ui/field'
import { Input } from '../ui/input'
+import { Item, ItemActions, ItemContent, ItemTitle } from '../ui/item'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select'
/** A unit on the order that a return, exchange or claim can name. */
@@ -31,26 +32,27 @@ export function QuantityPicker({
return (
<div className="flex flex-col gap-2">
{units.map((unit) => (
- <div
- key={unit.id}
- className="flex items-center justify-between gap-4 rounded-lg border border-border-subtle p-3"
- >
- <span className="min-w-0 truncate text-sm">{unit.label}</span>
- <Input
- type="number"
- min={0}
- max={unit.quantity}
- className="w-20"
- value={selection[unit.id] ?? 0}
- aria-label={unit.label}
- onChange={(event) =>
- onChange({
- ...selection,
- [unit.id]: Math.max(0, Math.min(Number(event.target.value), unit.quantity)),
- })
- }
- />
- </div>
+ <Item key={unit.id} variant="outline" className="flex-nowrap border-border-subtle">
+ <ItemContent className="min-w-0">
+ <ItemTitle className="block truncate font-normal">{unit.label}</ItemTitle>
+ </ItemContent>
+ <ItemActions>
+ <Input
+ type="number"
+ min={0}
+ max={unit.quantity}
+ className="w-20"
+ value={selection[unit.id] ?? 0}
+ aria-label={unit.label}
+ onChange={(event) =>
+ onChange({
+ ...selection,
+ [unit.id]: Math.max(0, Math.min(Number(event.target.value), unit.quantity)),
+ })
+ }
+ />
+ </ItemActions>
+ </Item>
))}
</div>
)
diff --git a/packages/dashboard-ui/src/spree/tax-identifiers-card.tsx b/packages/dashboard-ui/src/spree/tax-identifiers-card.tsx
index b53f4c9359..6d7da6a4ec 100644
--- a/packages/dashboard-ui/src/spree/tax-identifiers-card.tsx
+++ b/packages/dashboard-ui/src/spree/tax-identifiers-card.tsx
@@ -15,17 +15,20 @@ import {
ComboboxInput,
ComboboxItem,
ComboboxList,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
Field,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
Input,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemGroup,
+ ItemTitle,
RelativeTime,
+ RowActions,
Sheet,
SheetContent,
SheetDescription,
@@ -35,7 +38,7 @@ import {
StatusBadge,
useConfirm,
} from '../index'
-import { BadgeCheckIcon, EllipsisVerticalIcon, PencilIcon, PlusIcon, TrashIcon } from './icons'
+import { BadgeCheckIcon, PlusIcon } from './icons'
/** One selectable registration kind. */
interface KindOption {
@@ -153,81 +156,71 @@ export function TaxIdentifiersCard({
<p className="text-muted-foreground text-sm">{t('admin.tax_identifiers.empty')}</p>
</CardContent>
) : (
- <CardContent className="flex flex-col gap-3">
- {identifiers.map((identifier) => (
- <div
- key={identifier.id}
- className="flex items-start justify-between gap-3 rounded-md border p-3"
- >
- <div className="flex min-w-0 flex-col gap-1">
- <div className="flex flex-wrap items-center gap-2">
- <span className="font-medium text-sm">{identifier.value}</span>
- <Badge variant="outline">
- {t(`admin.tax_identifiers.kinds.${identifier.kind}`, {
- defaultValue: identifier.kind,
- })}
- </Badge>
- {identifier.validation_status ? (
- <StatusBadge
- status={identifier.validation_status}
- label={t(
- `admin.tax_identifiers.validation_status.${identifier.validation_status}`,
- { defaultValue: identifier.validation_status },
- )}
- />
- ) : (
- <Badge variant="secondary">
- {t('admin.tax_identifiers.validation_status.not_checked')}
+ <CardContent>
+ <ItemGroup className="gap-3">
+ {identifiers.map((identifier) => (
+ <Item key={identifier.id} role="listitem" variant="outline" className="items-start">
+ <ItemContent className="min-w-0">
+ <ItemTitle className="flex-wrap">
+ {identifier.value}
+ <Badge variant="outline">
+ {t(`admin.tax_identifiers.kinds.${identifier.kind}`, {
+ defaultValue: identifier.kind,
+ })}
</Badge>
+ {identifier.validation_status ? (
+ <StatusBadge
+ status={identifier.validation_status}
+ label={t(
+ `admin.tax_identifiers.validation_status.${identifier.validation_status}`,
+ { defaultValue: identifier.validation_status },
+ )}
+ />
+ ) : (
+ <Badge variant="secondary">
+ {t('admin.tax_identifiers.validation_status.not_checked')}
+ </Badge>
+ )}
+ </ItemTitle>
+ {identifier.validated_at && (
+ <ItemDescription className="text-xs">
+ <RelativeTime
+ iso={identifier.validated_at}
+ prefix={t('admin.tax_identifiers.checked_prefix')}
+ />
+ </ItemDescription>
+ )}
+ {!identifier.validatable && (
+ <ItemDescription className="text-xs">
+ {t('admin.tax_identifiers.not_validatable')}
+ </ItemDescription>
)}
- </div>
- {identifier.validated_at && (
- <span className="text-muted-foreground text-xs">
- <RelativeTime
- iso={identifier.validated_at}
- prefix={t('admin.tax_identifiers.checked_prefix')}
+ </ItemContent>
+
+ {canEdit && (
+ <ItemActions>
+ <RowActions
+ actions={[
+ {
+ key: 'validate',
+ label: t('admin.tax_identifiers.validate_action'),
+ icon: <BadgeCheckIcon className="size-4" />,
+ disabled: !identifier.validatable || mutations.isValidating,
+ onSelect: () => mutations.validate(identifier.id).catch(() => undefined),
+ },
+ { key: 'edit', onSelect: () => setEditing(identifier) },
+ {
+ key: 'delete',
+ destructive: true,
+ onSelect: () => handleDelete(identifier),
+ },
+ ]}
/>
- </span>
- )}
- {!identifier.validatable && (
- <span className="text-muted-foreground text-xs">
- {t('admin.tax_identifiers.not_validatable')}
- </span>
+ </ItemActions>
)}
- </div>
-
- {canEdit && (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" size="icon-xs">
- <EllipsisVerticalIcon className="size-4" />
- <span className="sr-only">{t('admin.actions.actions_menu')}</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem
- disabled={!identifier.validatable || mutations.isValidating}
- onClick={() => mutations.validate(identifier.id).catch(() => undefined)}
- >
- <BadgeCheckIcon className="size-4" />
- {t('admin.tax_identifiers.validate_action')}
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => setEditing(identifier)}>
- <PencilIcon className="size-4" />
- {t('admin.actions.edit')}
- </DropdownMenuItem>
- <DropdownMenuItem
- className="text-destructive focus:text-destructive"
- onClick={() => handleDelete(identifier)}
- >
- <TrashIcon className="size-4" />
- {t('admin.actions.delete')}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- )}
- </div>
- ))}
+ </Item>
+ ))}
+ </ItemGroup>
</CardContent>
)}
diff --git a/packages/dashboard-ui/src/spree/wizard.tsx b/packages/dashboard-ui/src/spree/wizard.tsx
index 8087d21948..446021da82 100644
--- a/packages/dashboard-ui/src/spree/wizard.tsx
+++ b/packages/dashboard-ui/src/spree/wizard.tsx
@@ -188,13 +188,7 @@ export function Wizard({
}}
modal
>
- <DialogContent
- // Edge-to-edge minus a gutter, like the import wizard and the bulk
- // price editor — every inset/translate/max is overridden.
- className="!inset-3 !w-auto !max-w-none !translate-x-0 !translate-y-0 flex flex-col p-0"
- style={{ maxHeight: 'none' }}
- showCloseButton={false}
- >
+ <DialogContent fullScreen showCloseButton={false}>
<DialogHeader className="h-14 shrink-0 flex-row items-center gap-3 space-y-0 border-b border-border-subtle bg-background px-4 py-0">
<div className="flex min-w-0 items-center gap-3">
<DialogTitle className="truncate text-base">{title}</DialogTitle>
diff --git a/packages/dashboard-ui/src/ui/dialog.tsx b/packages/dashboard-ui/src/ui/dialog.tsx
index 83e595d6e1..997704cbb3 100644
--- a/packages/dashboard-ui/src/ui/dialog.tsx
+++ b/packages/dashboard-ui/src/ui/dialog.tsx
@@ -95,20 +95,29 @@ function DialogContent({
className,
children,
showCloseButton = true,
+ fullScreen = false,
...props
}: React.ComponentProps<typeof DialogPrimitive.Popup> & {
showCloseButton?: boolean
+ /**
+ * Fills the window minus a small gutter, over an opaque overlay — for
+ * wizards and editors that replace the page rather than sit on top of it.
+ * A see-through overlay would let the page's own panel edges show around
+ * the dialog as a second border.
+ */
+ fullScreen?: boolean
}) {
return (
<DialogPortal>
- <DialogOverlay />
+ <DialogOverlay className={cn(fullScreen && 'bg-background dark:bg-background')} />
<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-[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]',
+ fullScreen && 'inset-3 w-auto max-w-none translate-x-0 translate-y-0 sm:max-w-none',
className,
)}
- style={{ maxHeight: '90vh' }}
+ style={fullScreen ? undefined : { maxHeight: '90vh' }}
{...props}
>
{children}
diff --git a/packages/dashboard/src/components/spree/api-keys/api-key-token-reveal-dialog.tsx b/packages/dashboard/src/components/spree/api-keys/api-key-token-reveal-dialog.tsx
index 5741b67ea6..3667631f48 100644
--- a/packages/dashboard/src/components/spree/api-keys/api-key-token-reveal-dialog.tsx
+++ b/packages/dashboard/src/components/spree/api-keys/api-key-token-reveal-dialog.tsx
@@ -1,5 +1,7 @@
import type { ApiKey } from '@spree/admin-sdk'
import {
+ Alert,
+ AlertDescription,
Button,
Dialog,
DialogBody,
@@ -34,10 +36,10 @@ export function TokenRevealDialog({
</DialogDescription>
</DialogHeader>
<DialogBody className="flex flex-col gap-3">
- <div className="flex items-start gap-2 rounded-md border border-yellow-200 bg-yellow-50 p-3 text-sm text-yellow-900 dark:border-yellow-900/40 dark:bg-yellow-950/40 dark:text-yellow-200">
- <AlertTriangleIcon className="size-4 shrink-0" />
- <span>{t('admin.api_keys.warning_treat_like_password')}</span>
- </div>
+ <Alert variant="warning">
+ <AlertTriangleIcon />
+ <AlertDescription>{t('admin.api_keys.warning_treat_like_password')}</AlertDescription>
+ </Alert>
{apiKey?.plaintext_token && (
<div className="flex items-center gap-2 rounded-md border border-border bg-muted/40 p-3">
<code className="flex-1 truncate font-mono text-sm">{apiKey.plaintext_token}</code>
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 2812a81fe9..13224004b3 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
@@ -150,18 +150,7 @@ export function BulkPriceEditorDialog({
onOpenChange={(next, eventDetails) => handleOpenChange(next, eventDetails?.reason)}
modal
>
- <DialogContent
- // Edge-to-edge minus a 3-unit (0.75rem) gutter on all sides.
- // The primitive ships `top-1/2 left-1/2 -translate-1/2` (centered
- // popup) and inline `maxHeight: 90vh`. We override all four
- // insets with `!` utilities, zero the translate, and pass
- // `maxHeight: 'none'` to beat the inline style — together those
- // let the popup actually stretch between top-3 / bottom-3 / left-3
- // / right-3 instead of collapsing to its content size.
- className="!inset-3 !w-auto !max-w-none !translate-x-0 !translate-y-0 flex flex-col p-0"
- style={{ maxHeight: 'none' }}
- showCloseButton={false}
- >
+ <DialogContent fullScreen showCloseButton={false}>
<DialogHeader className="flex flex-row items-center justify-between gap-3 space-y-0 border-b p-3">
<div className="min-w-0">
<DialogTitle className="truncate">{title}</DialogTitle>
diff --git a/packages/dashboard/src/components/spree/catalog-pricing-fields.tsx b/packages/dashboard/src/components/spree/catalog-pricing-fields.tsx
index 564ad8a81e..c236eea0b4 100644
--- a/packages/dashboard/src/components/spree/catalog-pricing-fields.tsx
+++ b/packages/dashboard/src/components/spree/catalog-pricing-fields.tsx
@@ -22,7 +22,7 @@ import {
SelectValue,
Switch,
} from '@spree/dashboard-ui'
-import { InfoIcon, TableIcon } from '@spree/dashboard-ui/icons'
+import { CircleAlertIcon, InfoIcon, TableIcon } from '@spree/dashboard-ui/icons'
import { useState } from 'react'
import { Controller, type UseFormReturn, useFieldArray } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
@@ -260,15 +260,17 @@ export function CatalogPricingFields({
rule-less one matches every shopper — so the consequence is stated
before Save, not after. */}
{hasOwnedList && mode === 'base' && (
- <p className="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive" role="alert">
- {t('admin.catalogs.detach_warning')}
- </p>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertDescription>{t('admin.catalogs.detach_warning')}</AlertDescription>
+ </Alert>
)}
{willDiscardPrices && (
- <p className="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive" role="alert">
- {t('admin.catalogs.discard_prices_warning')}
- </p>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertDescription>{t('admin.catalogs.discard_prices_warning')}</AlertDescription>
+ </Alert>
)}
{/* Fixed pricing is only half-configured until amounts exist, so the
diff --git a/packages/dashboard/src/components/spree/catalog-wizard-dialog.tsx b/packages/dashboard/src/components/spree/catalog-wizard-dialog.tsx
index 72c97b5293..6bd3c83bf6 100644
--- a/packages/dashboard/src/components/spree/catalog-wizard-dialog.tsx
+++ b/packages/dashboard/src/components/spree/catalog-wizard-dialog.tsx
@@ -17,6 +17,9 @@ import {
FieldGroup,
FieldLabel,
Input,
+ Item,
+ ItemContent,
+ ItemTitle,
Pagination,
SearchInput,
Textarea,
@@ -24,7 +27,14 @@ import {
toastManager,
Wizard,
} from '@spree/dashboard-ui'
-import { CheckIcon, InfoIcon, PackageIcon, PlusIcon, XIcon } from '@spree/dashboard-ui/icons'
+import {
+ CheckIcon,
+ CircleAlertIcon,
+ InfoIcon,
+ PackageIcon,
+ PlusIcon,
+ XIcon,
+} from '@spree/dashboard-ui/icons'
import { useDeferredValue, useEffect, useMemo, useState } from 'react'
import { type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
@@ -218,9 +228,10 @@ function CatalogWizard({
</div>
{form.formState.errors.root?.message && (
- <p className="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive" role="alert">
- {form.formState.errors.root.message}
- </p>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertDescription>{form.formState.errors.root.message}</AlertDescription>
+ </Alert>
)}
{step === 'details' && <DetailsStep form={form} />}
@@ -228,9 +239,12 @@ function CatalogWizard({
<>
<CatalogAudienceStep form={form} assigning={assigning} onAssigningChange={setAssigning} />
{audienceCount === 0 && (
- <p className="rounded-md bg-muted px-3 py-2 text-muted-foreground text-sm">
- {t('admin.catalogs.wizard.audience_none_warning')}
- </p>
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
+ {t('admin.catalogs.wizard.audience_none_warning')}
+ </AlertDescription>
+ </Alert>
)}
</>
)}
@@ -238,9 +252,12 @@ function CatalogWizard({
<>
<ProductsStep products={products} onChange={setProducts} />
{products.length === 0 && (
- <p className="rounded-md bg-muted px-3 py-2 text-muted-foreground text-sm">
- {t('admin.catalogs.wizard.products_none_warning')}
- </p>
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
+ {t('admin.catalogs.wizard.products_none_warning')}
+ </AlertDescription>
+ </Alert>
)}
</>
)}
@@ -349,13 +366,21 @@ function ProductsStep({
) : (
<div className="flex max-h-96 flex-col divide-y overflow-y-auto rounded-md border">
{products.map((product) => (
- <div key={product.id} className="flex items-center gap-3 p-2">
+ <Item
+ key={product.id}
+ size="xs"
+ className="flex-nowrap gap-3 rounded-none border-0 p-2"
+ >
<Thumbnail
src={product.thumbnail_url}
alt={product.name ?? ''}
className="size-8"
/>
- <span className="min-w-0 flex-1 truncate text-sm">{product.name}</span>
+ <ItemContent className="min-w-0">
+ <ItemTitle className="block truncate text-sm font-normal">
+ {product.name}
+ </ItemTitle>
+ </ItemContent>
<Button
variant="ghost"
size="icon-xs"
@@ -365,7 +390,7 @@ function ProductsStep({
>
<XIcon className="size-4" />
</Button>
- </div>
+ </Item>
))}
</div>
)}
@@ -395,13 +420,21 @@ function ProductsStep({
const added = chosen.has(product.id)
return (
- <div key={product.id} className="flex items-center gap-3 p-2">
+ <Item
+ key={product.id}
+ size="xs"
+ className="flex-nowrap gap-3 rounded-none border-0 p-2"
+ >
<Thumbnail
src={product.thumbnail_url}
alt={product.name ?? ''}
className="size-8"
/>
- <span className="min-w-0 flex-1 truncate text-sm">{product.name}</span>
+ <ItemContent className="min-w-0">
+ <ItemTitle className="block truncate text-sm font-normal">
+ {product.name}
+ </ItemTitle>
+ </ItemContent>
{/* An added row stays visible and disabled rather than
disappearing: a list that reshuffles as you click it is
hard to work down. */}
@@ -415,7 +448,7 @@ function ProductsStep({
>
{added ? <CheckIcon className="size-4" /> : <PlusIcon className="size-4" />}
</Button>
- </div>
+ </Item>
)
})}
</div>
diff --git a/packages/dashboard/src/components/spree/customers/customer-lifetime-stats-card.tsx b/packages/dashboard/src/components/spree/customers/customer-lifetime-stats-card.tsx
index 8ae9b84535..29713ef391 100644
--- a/packages/dashboard/src/components/spree/customers/customer-lifetime-stats-card.tsx
+++ b/packages/dashboard/src/components/spree/customers/customer-lifetime-stats-card.tsx
@@ -1,6 +1,6 @@
import { type Customer, decimalPlaces } from '@spree/admin-sdk'
import { formatAmount, isPositiveMoney, useMoneyLocale, useStore } from '@spree/dashboard-core'
-import { Card, CardContent, RelativeTime } from '@spree/dashboard-ui'
+import { Item, ItemContent, ItemDescription, ItemTitle, RelativeTime } from '@spree/dashboard-ui'
import type { ReactNode } from 'react'
import { useTranslation } from 'react-i18next'
@@ -19,32 +19,32 @@ export function CustomerLifetimeStatsCard({ customer }: { customer: Customer })
averageForDisplay === null ? '—' : formatAmount(averageForDisplay, defaultCurrency, moneyLocale)
return (
- <Card>
- <CardContent className="grid grid-cols-2 lg:grid-cols-5 gap-6 py-6">
- <Stat
- label={t('admin.pages.customers.detail.stat_total_spent')}
- value={formatAmount(totalSpent, defaultCurrency, moneyLocale)}
- />
- <Stat label={t('admin.pages.customers.detail.stat_orders')} value={String(orders)} />
- <Stat label={t('admin.pages.customers.detail.stat_avg_order_value')} value={aovDisplay} />
- <Stat
- label={t('admin.pages.customers.detail.section_store_credit')}
- value={formatAmount(customer.available_store_credit_total, defaultCurrency, moneyLocale)}
- />
- <Stat
- label={t('admin.customers.detail.customer_since')}
- value={<RelativeTime iso={customer.created_at} />}
- />
- </CardContent>
- </Card>
+ <div className="grid grid-cols-2 gap-3 lg:grid-cols-5">
+ <Stat
+ label={t('admin.pages.customers.detail.stat_total_spent')}
+ value={formatAmount(totalSpent, defaultCurrency, moneyLocale)}
+ />
+ <Stat label={t('admin.pages.customers.detail.stat_orders')} value={String(orders)} />
+ <Stat label={t('admin.pages.customers.detail.stat_avg_order_value')} value={aovDisplay} />
+ <Stat
+ label={t('admin.pages.customers.detail.section_store_credit')}
+ value={formatAmount(customer.available_store_credit_total, defaultCurrency, moneyLocale)}
+ />
+ <Stat
+ label={t('admin.customers.detail.customer_since')}
+ value={<RelativeTime iso={customer.created_at} />}
+ />
+ </div>
)
}
function Stat({ label, value }: { label: string; value: ReactNode }) {
return (
- <div className="flex flex-col gap-1">
- <span className="text-sm text-muted-foreground">{label}</span>
- <span className="text-lg font-semibold">{value}</span>
- </div>
+ <Item variant="outline" className="rounded-xl border-border-card bg-card px-4 py-3 shadow-xs">
+ <ItemContent>
+ <ItemDescription>{label}</ItemDescription>
+ <ItemTitle className="text-lg font-semibold">{value}</ItemTitle>
+ </ItemContent>
+ </Item>
)
}
diff --git a/packages/dashboard/src/components/spree/email-templates/problems-alert.tsx b/packages/dashboard/src/components/spree/email-templates/problems-alert.tsx
index 1c54deda5d..eb912e7817 100644
--- a/packages/dashboard/src/components/spree/email-templates/problems-alert.tsx
+++ b/packages/dashboard/src/components/spree/email-templates/problems-alert.tsx
@@ -1,4 +1,5 @@
import { Alert, AlertDescription, AlertTitle } from '@spree/dashboard-ui'
+import { CircleAlertIcon } from '@spree/dashboard-ui/icons'
import { useTranslation } from 'react-i18next'
import type { EmailTemplateProblem } from '../../../hooks/use-email-templates'
import { emailTemplateName } from '../../../lib/email-template-name'
@@ -9,6 +10,7 @@ export function EmailTemplateProblemsAlert({ problems }: { problems: EmailTempla
return (
<Alert variant="destructive">
+ <CircleAlertIcon />
<AlertTitle>{t('admin.email_templates.problems.title')}</AlertTitle>
<AlertDescription>
<ul className="list-disc pl-4">
diff --git a/packages/dashboard/src/components/spree/mcp-connect-sheet.tsx b/packages/dashboard/src/components/spree/mcp-connect-sheet.tsx
index dd5dd713e3..2e6392fb30 100644
--- a/packages/dashboard/src/components/spree/mcp-connect-sheet.tsx
+++ b/packages/dashboard/src/components/spree/mcp-connect-sheet.tsx
@@ -19,6 +19,7 @@ import {
TabsList,
TabsTrigger,
} from '@spree/dashboard-ui'
+import { CircleAlertIcon, InfoIcon } from '@spree/dashboard-ui/icons'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -155,6 +156,7 @@ export function McpConnectSheet({ open, onOpenChange }: McpConnectSheetProps) {
<div className="flex flex-1 flex-col gap-6 overflow-y-auto p-4">
{failure ? (
<Alert variant="destructive">
+ <CircleAlertIcon />
<AlertDescription>{failure}</AlertDescription>
</Alert>
) : null}
@@ -309,6 +311,7 @@ function ConnectInstructions({
)}
<Alert variant="info">
+ <InfoIcon />
<AlertDescription>{t('admin.mcp_connect.bounded_note')}</AlertDescription>
</Alert>
</div>
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 0d4df9382a..d46b4e2a23 100644
--- a/packages/dashboard/src/components/spree/order-routing-rules-section.tsx
+++ b/packages/dashboard/src/components/spree/order-routing-rules-section.tsx
@@ -30,7 +30,16 @@ import {
usePermissions,
useResourceKeyBuilder,
} from '@spree/dashboard-core'
-import { Button, DragHandle, Switch, useConfirm } from '@spree/dashboard-ui'
+import {
+ Button,
+ DragHandle,
+ Item,
+ ItemContent,
+ ItemDescription,
+ ItemTitle,
+ Switch,
+ useConfirm,
+} from '@spree/dashboard-ui'
import { PlusIcon, SlidersHorizontalIcon, Trash2Icon } from '@spree/dashboard-ui/icons'
import { useQueryClient } from '@tanstack/react-query'
import { type CSSProperties, useMemo, useState } from 'react'
@@ -334,20 +343,18 @@ function RuleTypePicker({
{types.map((type) => {
const description = typeDescription('order_routing_rule', type.type, type.description ?? '')
return (
- <button
+ <Item
key={type.type}
- type="button"
- disabled={disabled}
- className="rounded-md px-2 py-1.5 text-left hover:bg-accent disabled:opacity-50"
+ size="xs"
+ render={<button type="button" disabled={disabled} />}
+ className="cursor-pointer text-left hover:bg-accent disabled:cursor-default disabled:opacity-50"
onClick={() => onPick(type)}
>
- <span className="block text-sm">
- {typeLabel('order_routing_rule', type.type, type.label)}
- </span>
- {description && (
- <span className="block text-xs text-muted-foreground">{description}</span>
- )}
- </button>
+ <ItemContent>
+ <ItemTitle>{typeLabel('order_routing_rule', type.type, type.label)}</ItemTitle>
+ {description && <ItemDescription>{description}</ItemDescription>}
+ </ItemContent>
+ </Item>
)
})}
<Button type="button" variant="outline" size="sm" className="self-start" onClick={onCancel}>
diff --git a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
index 2670fb513a..8f684484dd 100644
--- a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
+++ b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
@@ -38,6 +38,9 @@ import {
type FulfillmentItemRowData,
FulfillmentPanel,
Input,
+ type PostSaleSelection,
+ type PostSaleUnit,
+ QuantityPicker,
RelativeTime,
Select,
SelectContent,
@@ -45,6 +48,7 @@ import {
SelectTrigger,
SelectValue,
StatusBadge,
+ selectedUnits,
toastManager,
useConfirm,
} from '@spree/dashboard-ui'
@@ -114,9 +118,9 @@ function unitsOf(fulfillment: Fulfillment): FulfillmentUnit[] {
* unclaimed remainder is offered: units already sitting in a fulfillment move
* via Split, and shipped ones do not move at all.
*/
-function orderUnits(order: Order): Array<{ itemId: string; label: string; quantity: number }> {
+function orderUnits(order: Order): PostSaleUnit[] {
return unfulfilledItemRows(order.items ?? [], order.fulfillments ?? []).map((row) => ({
- itemId: row.key,
+ id: row.key,
label: [row.name, row.optionsText].filter(Boolean).join(' — ') || row.key,
quantity: row.quantity,
}))
@@ -300,11 +304,12 @@ function CreateFulfillmentDialog({
const locations = data?.data ?? []
const [stockLocationId, setStockLocationId] = useState('')
const [error, setError] = useState<string | null>(null)
- const [selection, setSelection] = useState<Record<string, number>>({})
+ const [selection, setSelection] = useState<PostSaleSelection>({})
- const items = Object.entries(selection)
- .filter(([, quantity]) => quantity > 0)
- .map(([itemId, quantity]) => ({ item_id: itemId, quantity }))
+ const items = selectedUnits(selection).map(([itemId, quantity]) => ({
+ item_id: itemId,
+ quantity,
+ }))
const locationOptions = locations.map((location) => ({
value: location.id,
@@ -382,33 +387,7 @@ function CreateFulfillmentDialog({
<Field>
<FieldLabel>{t('admin.orders.detail.fulfillments.create_items')}</FieldLabel>
- <div className="flex flex-col gap-2">
- {units.map((unit) => (
- <div
- key={unit.itemId}
- className="flex items-center justify-between gap-4 rounded-lg border border-border-subtle p-3"
- >
- <span className="text-sm truncate">{unit.label}</span>
- <Input
- type="number"
- min={0}
- max={unit.quantity}
- className="w-20"
- aria-label={unit.label}
- value={selection[unit.itemId] ?? 0}
- onChange={(event) =>
- setSelection((current) => ({
- ...current,
- [unit.itemId]: Math.max(
- 0,
- Math.min(Number(event.target.value), unit.quantity),
- ),
- }))
- }
- />
- </div>
- ))}
- </div>
+ <QuantityPicker units={units} selection={selection} onChange={setSelection} />
</Field>
</FieldGroup>
</DialogBody>
diff --git a/packages/dashboard/src/components/spree/orders/line-item-dialogs.tsx b/packages/dashboard/src/components/spree/orders/line-item-dialogs.tsx
index 1183064611..d2bfecc3c8 100644
--- a/packages/dashboard/src/components/spree/orders/line-item-dialogs.tsx
+++ b/packages/dashboard/src/components/spree/orders/line-item-dialogs.tsx
@@ -6,6 +6,11 @@ import {
FieldGroup,
FieldLabel,
Input,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemTitle,
Sheet,
SheetContent,
SheetDescription,
@@ -112,28 +117,29 @@ export function AddLineItemDialog({
</Field>
{selectedVariant && (
- <div className="flex items-center justify-between rounded-lg border border-primary/30 bg-primary/5 p-3">
- <div>
- <div className="text-sm font-medium">
- {selectedVariant.product_name ?? selectedVariant.sku}
- </div>
- <div className="text-xs text-muted-foreground">
+ <Item variant="outline" className="border-primary/30 bg-primary/5">
+ <ItemContent>
+ <ItemTitle>{selectedVariant.product_name ?? selectedVariant.sku}</ItemTitle>
+ <ItemDescription className="text-xs">
{selectedVariant.options_text && (
<span>{selectedVariant.options_text} · </span>
)}
{t('admin.orders.detail.variant_search.sku_prefix')}:{' '}
{selectedVariant.sku || '—'} · {formatPrice(selectedVariant.price)}
- </div>
- </div>
- <button
- type="button"
- onClick={() => setSelectedVariant(null)}
- className="rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground"
- aria-label={t('admin.a11y.clear_selection')}
- >
- <XCircleIcon className="size-4" />
- </button>
- </div>
+ </ItemDescription>
+ </ItemContent>
+ <ItemActions>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-xs"
+ onClick={() => setSelectedVariant(null)}
+ aria-label={t('admin.a11y.clear_selection')}
+ >
+ <XCircleIcon className="size-4" />
+ </Button>
+ </ItemActions>
+ </Item>
)}
<Field>
diff --git a/packages/dashboard/src/components/spree/orders/order-discounts-sidebar-card.tsx b/packages/dashboard/src/components/spree/orders/order-discounts-sidebar-card.tsx
index 9033087c2e..0119485d43 100644
--- a/packages/dashboard/src/components/spree/orders/order-discounts-sidebar-card.tsx
+++ b/packages/dashboard/src/components/spree/orders/order-discounts-sidebar-card.tsx
@@ -19,6 +19,10 @@ import {
FieldGroup,
FieldLabel,
Input,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemTitle,
Separator,
useConfirm,
} from '@spree/dashboard-ui'
@@ -218,20 +222,26 @@ function CouponCodeDialog({
</FieldLabel>
<div className="flex max-h-48 flex-col gap-1 overflow-y-auto">
{couponPromotions.map((promotion) => (
- <button
- type="button"
+ <Item
key={promotion.id}
+ variant="outline"
+ size="sm"
+ render={<button type="button" />}
onClick={() => setCode(promotion.code ?? '')}
className={cn(
- 'flex items-center justify-between rounded-md border px-3 py-2 text-left text-sm hover:bg-accent',
+ 'flex-nowrap py-2 text-left hover:bg-accent',
code === promotion.code && 'border-primary',
)}
>
- <span className="truncate">{promotion.name}</span>
- <span className="ml-2 shrink-0 font-mono text-xs text-muted-foreground">
+ <ItemContent className="min-w-0">
+ <ItemTitle className="block truncate font-normal">
+ {promotion.name}
+ </ItemTitle>
+ </ItemContent>
+ <ItemActions className="font-mono text-xs text-muted-foreground">
{promotion.code}
- </span>
- </button>
+ </ItemActions>
+ </Item>
))}
</div>
</Field>
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 984c476207..2aa0db370f 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
@@ -17,9 +17,10 @@ import {
useResourceKey,
useStore,
} from '@spree/dashboard-core'
-import { DropdownMenuItem, useConfirm } from '@spree/dashboard-ui'
+import { Alert, AlertDescription, DropdownMenuItem, useConfirm } from '@spree/dashboard-ui'
import {
CalendarOffIcon,
+ CircleAlertIcon,
PauseIcon,
PencilIcon,
PlayIcon,
@@ -47,6 +48,7 @@ import {
ProductMembershipStagingProvider,
useProductMembershipStaging,
} from '../product-membership-staging'
+import { TypePickerSheet } from '../type-picker-sheet'
import { PriceListStatusBadge } from './status-badge'
// Side-effect import — registers per-rule editors (customer, customer
// group, …) into the slot registry. Must run before any RuleEditSheet
@@ -298,12 +300,10 @@ export function PriceListForm({
main={
<>
{form.formState.errors.root?.message && (
- <p
- className="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
- role="alert"
- >
- {form.formState.errors.root.message}
- </p>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertDescription>{form.formState.errors.root.message}</AlertDescription>
+ </Alert>
)}
<RulesCard form={form} rulesArray={rulesArray} />
{mode === 'edit' && priceList && (
@@ -666,10 +666,17 @@ function RulesCard({
</div>
{pickerOpen && (
- <RulePickerSheet
+ <TypePickerSheet
+ family="price_rule"
+ title={t('admin.pages.products.price_lists.add_rule')}
+ description={t('admin.pages.products.price_lists.add_rule_help')}
+ emptyMessage={t(
+ registeredTypes.length === 0
+ ? 'admin.pages.products.price_lists.rule_types_empty'
+ : 'admin.pages.products.price_lists.rule_types_all_used',
+ )}
// One rule type per list (backend uniqueness on `type`).
types={types.filter((tt) => !watchedRules.some((r) => r.type === tt.type))}
- registeredCount={registeredTypes.length}
open
onOpenChange={(o) => !o && setPickerOpen(false)}
onPicked={(type) => {
@@ -869,62 +876,6 @@ function humanize(key: string): string {
return spaced.charAt(0).toUpperCase() + spaced.slice(1)
}
-function RulePickerSheet({
- types,
- registeredCount,
- open,
- onOpenChange,
- onPicked,
-}: {
- /** Types still selectable — already-added types are filtered out upstream. */
- types: ResourceTypeDefinition[]
- /** Total registered types regardless of selection — lets the empty state
- * distinguish "nothing registered" from "all already used". */
- registeredCount: number
- open: boolean
- onOpenChange: (open: boolean) => void
- onPicked: (type: ResourceTypeDefinition) => void
-}) {
- const { t } = useTranslation()
- const emptyKey =
- registeredCount === 0
- ? 'admin.pages.products.price_lists.rule_types_empty'
- : 'admin.pages.products.price_lists.rule_types_all_used'
- return (
- <Sheet open={open} onOpenChange={onOpenChange}>
- <SheetContent>
- <SheetHeader>
- <SheetTitle>{t('admin.pages.products.price_lists.add_rule')}</SheetTitle>
- <SheetDescription>{t('admin.pages.products.price_lists.add_rule_help')}</SheetDescription>
- </SheetHeader>
- <div className="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-4">
- {types.length === 0 ? (
- <p className="text-sm text-muted-foreground">{t(emptyKey)}</p>
- ) : (
- types.map((tt) => (
- <button
- key={tt.type}
- type="button"
- onClick={() => onPicked(tt)}
- className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-accent/50"
- >
- <span className="text-sm font-medium">
- {typeLabel('price_rule', tt.type, tt.label)}
- </span>
- {typeDescription('price_rule', tt.type, tt.description) && (
- <span className="text-xs text-muted-foreground">
- {typeDescription('price_rule', tt.type, tt.description)}
- </span>
- )}
- </button>
- ))
- )}
- </div>
- </SheetContent>
- </Sheet>
- )
-}
-
function RuleEditSheet({
draft,
definition,
diff --git a/packages/dashboard/src/components/spree/products/publishing-card.tsx b/packages/dashboard/src/components/spree/products/publishing-card.tsx
index a4d1e7db4d..9b4f4c6bad 100644
--- a/packages/dashboard/src/components/spree/products/publishing-card.tsx
+++ b/packages/dashboard/src/components/spree/products/publishing-card.tsx
@@ -10,6 +10,11 @@ import {
Checkbox,
Field,
FieldLabel,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemMedia,
+ ItemTitle,
Sheet,
SheetContent,
SheetDescription,
@@ -376,22 +381,28 @@ function ManageChannelsSheet({
channels.map((channel) => {
const checked = publicationsArray.fields.some((f) => f.channel_id === channel.id)
return (
- <button
+ <Item
key={channel.id}
- type="button"
+ variant="outline"
+ size="sm"
+ render={<button type="button" />}
onClick={() => toggle(channel, !checked)}
- className="flex w-full cursor-pointer items-center gap-3 rounded-md border border-border bg-background px-3 py-2 text-left hover:bg-accent"
+ className="cursor-pointer bg-background text-left hover:bg-accent"
>
- <Checkbox checked={checked} tabIndex={-1} />
- <span className="flex-1 text-sm">
- {channel.name ?? channel.code ?? channel.id}
- </span>
+ <ItemMedia>
+ <Checkbox checked={checked} tabIndex={-1} />
+ </ItemMedia>
+ <ItemContent>
+ <ItemTitle className="font-normal">
+ {channel.name ?? channel.code ?? channel.id}
+ </ItemTitle>
+ </ItemContent>
{!channel.active && (
- <span className="text-xs text-muted-foreground">
+ <ItemActions className="text-xs text-muted-foreground">
{t('admin.pages.products.publishing.inactive_marker')}
- </span>
+ </ItemActions>
)}
- </button>
+ </Item>
)
})}
</div>
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 f6a44ad1c8..b6f5138fbb 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -9,8 +9,14 @@ import type {
ResourceTypeDefinition,
} from '@spree/admin-sdk'
import { Can, PageHeader, PreferencesForm, StoreDatePicker } from '@spree/dashboard-core'
-import { DropdownMenuItem, formatCalculatorSummary, useConfirm } from '@spree/dashboard-ui'
-import { PlusIcon, SparklesIcon, TrashIcon } from '@spree/dashboard-ui/icons'
+import {
+ Alert,
+ AlertDescription,
+ DropdownMenuItem,
+ formatCalculatorSummary,
+ useConfirm,
+} from '@spree/dashboard-ui'
+import { CircleAlertIcon, PlusIcon, SparklesIcon, TrashIcon } from '@spree/dashboard-ui/icons'
import i18n from 'i18next'
import { useEffect, useState } from 'react'
import {
@@ -22,6 +28,7 @@ import {
} from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { spreeJsonLinkResolver } from '../../../lib/json-link-resolver'
+import { TypePickerSheet } from '../type-picker-sheet'
import { EditorShell } from './editor-shell'
import './register'
import {
@@ -32,7 +39,6 @@ import {
mapSpreeErrorsToForm,
Slot,
Subject,
- typeDescription,
typeLabel,
useCountryDisplayName,
usePermissions,
@@ -313,12 +319,10 @@ export function PromotionForm({
main={
<>
{form.formState.errors.root?.message && (
- <p
- className="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
- role="alert"
- >
- {form.formState.errors.root.message}
- </p>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertDescription>{form.formState.errors.root.message}</AlertDescription>
+ </Alert>
)}
<RulesCard
form={form}
@@ -755,10 +759,17 @@ function RulesCard({
</div>
{pickerOpen && (
- <RulePickerSheet
+ <TypePickerSheet
+ family="promotion_rule"
+ title={t('admin.promotions.rule_picker.title')}
+ description={t('admin.promotions.rule_picker.description')}
+ emptyMessage={t(
+ types.length === 0
+ ? 'admin.promotions.rule_types_empty'
+ : 'admin.promotions.rule_types_all_used',
+ )}
// One rule type per promotion (backend uniqueness on `type`).
types={types.filter((tt) => !watchedRules.some((r) => r.type === tt.type))}
- registeredCount={types.length}
open
onOpenChange={(o) => !o && setPickerOpen(false)}
onPicked={(type) => {
@@ -969,66 +980,6 @@ function customerLabel(c: Customer): string {
return c.full_name || c.email || ''
}
-function RulePickerSheet({
- types,
- registeredCount,
- open,
- onOpenChange,
- onPicked,
-}: {
- /** Types still selectable — already-added types are filtered out upstream. */
- types: ResourceTypeDefinition[]
- /** Total registered types regardless of selection. */
- registeredCount: number
- open: boolean
- onOpenChange: (open: boolean) => void
- onPicked: (type: ResourceTypeDefinition) => void
-}) {
- const { t } = useTranslation()
- const emptyKey =
- registeredCount === 0
- ? 'admin.promotions.rule_types_empty'
- : 'admin.promotions.rule_types_all_used'
- return (
- <Sheet open={open} onOpenChange={onOpenChange}>
- <SheetContent>
- <SheetHeader>
- <SheetTitle>{t('admin.promotions.rule_picker.title')}</SheetTitle>
- <SheetDescription>{t('admin.promotions.rule_picker.description')}</SheetDescription>
- </SheetHeader>
- <div className="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-4">
- {types.length === 0 ? (
- <p className="text-sm text-muted-foreground">{t(emptyKey)}</p>
- ) : (
- types.map((tt) => (
- <button
- key={tt.type}
- type="button"
- onClick={() => onPicked(tt)}
- className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-accent/50"
- >
- <span className="text-sm font-medium">
- {typeLabel('promotion_rule', tt.type, tt.label)}
- </span>
- {tt.description && (
- <span className="text-xs text-muted-foreground">
- {typeDescription('promotion_rule', tt.type, tt.description)}
- </span>
- )}
- </button>
- ))
- )}
- </div>
- <SheetFooter>
- <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
- {t('admin.actions.cancel')}
- </Button>
- </SheetFooter>
- </SheetContent>
- </Sheet>
- )
-}
-
function RuleEditSheet({
draft,
types,
@@ -1160,7 +1111,10 @@ function ActionsCard({
</div>
{pickerOpen && (
- <ActionPickerSheet
+ <TypePickerSheet
+ family="promotion_action"
+ title={t('admin.promotions.action_picker.title')}
+ description={t('admin.promotions.action_picker.description')}
types={types}
open
onOpenChange={(o) => !o && setPickerOpen(false)}
@@ -1280,54 +1234,6 @@ function ActionSummary({ draft }: { draft: PromotionActionFormDraft }) {
return <div className="truncate text-xs text-muted-foreground">{parts.join(' · ')}</div>
}
-function ActionPickerSheet({
- types,
- open,
- onOpenChange,
- onPicked,
-}: {
- types: ResourceTypeDefinition[]
- open: boolean
- onOpenChange: (open: boolean) => void
- onPicked: (type: ResourceTypeDefinition) => void
-}) {
- const { t } = useTranslation()
- return (
- <Sheet open={open} onOpenChange={onOpenChange}>
- <SheetContent>
- <SheetHeader>
- <SheetTitle>{t('admin.promotions.action_picker.title')}</SheetTitle>
- <SheetDescription>{t('admin.promotions.action_picker.description')}</SheetDescription>
- </SheetHeader>
- <div className="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-4">
- {types.map((type) => (
- <button
- key={type.type}
- type="button"
- onClick={() => onPicked(type)}
- className="flex flex-col items-start rounded-md border p-3 text-left transition-colors hover:bg-accent/50"
- >
- <span className="text-sm font-medium">
- {typeLabel('promotion_action', type.type, type.label)}
- </span>
- {type.description && (
- <span className="text-xs text-muted-foreground">
- {typeDescription('promotion_action', type.type, type.description)}
- </span>
- )}
- </button>
- ))}
- </div>
- <SheetFooter>
- <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
- {t('admin.actions.cancel')}
- </Button>
- </SheetFooter>
- </SheetContent>
- </Sheet>
- )
-}
-
function ActionEditSheet({
draft,
types,
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 c509f94ad3..21632e892b 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx
+++ b/packages/dashboard/src/components/spree/shipping/delivery-method-form.tsx
@@ -38,6 +38,10 @@ import {
InputGroupAddon,
InputGroupInput,
InputGroupText,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
RadioGroup,
RadioGroupItem,
Select,
@@ -598,24 +602,25 @@ function ProvidersCard({
)}
{connectableIntegrations.map((integrationType) => (
- <div
- key={integrationType.type}
- className="flex items-center justify-between gap-3 rounded-md border border-dashed p-3"
- >
- <span className="text-sm text-muted-foreground">
- {t('admin.delivery_methods.connect_provider_hint', { name: integrationType.name })}
- </span>
+ <Item key={integrationType.type} variant="outline" className="border-dashed">
+ <ItemContent>
+ <ItemDescription>
+ {t('admin.delivery_methods.connect_provider_hint', { name: integrationType.name })}
+ </ItemDescription>
+ </ItemContent>
<Can I="create" a={Subject.Integration}>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() => setConnectingType(integrationType)}
- >
- {t('admin.integrations.connect_cta')}
- </Button>
+ <ItemActions>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => setConnectingType(integrationType)}
+ >
+ {t('admin.integrations.connect_cta')}
+ </Button>
+ </ItemActions>
</Can>
- </div>
+ </Item>
))}
{connectingType && (
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 3f82c12c38..11436e10a1 100644
--- a/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx
+++ b/packages/dashboard/src/components/spree/tax-exemption-certificates-card.tsx
@@ -26,16 +26,19 @@ import {
ComboboxInput,
ComboboxItem,
ComboboxList,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
Field,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
Input,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemGroup,
+ ItemTitle,
+ RowActions,
Sheet,
SheetContent,
SheetDescription,
@@ -49,10 +52,8 @@ import {
BadgeCheckIcon,
BanIcon,
DownloadIcon,
- EllipsisVerticalIcon,
PaperclipIcon,
PlusIcon,
- TrashIcon,
} from '@spree/dashboard-ui/icons'
import { parseISO } from 'date-fns'
import { formatInTimeZone } from 'date-fns-tz'
@@ -178,145 +179,137 @@ export function TaxExemptionCertificatesCard({
</p>
</CardContent>
) : (
- <CardContent className="flex flex-col gap-3">
- {certificates.map((certificate) => (
- <div
- key={certificate.id}
- className="flex items-start justify-between gap-3 rounded-md border p-3"
- >
- <div className="flex min-w-0 flex-col gap-1">
- <div className="flex flex-wrap items-center gap-2">
- <span className="font-medium text-sm">{certificate.certificate_number}</span>
- <StatusBadge
- status={certificate.status}
- label={t(`admin.tax_exemption_certificates.status.${certificate.status}`, {
- defaultValue: certificate.status,
- })}
- />
- {certificate.lapsed && certificate.status !== 'expired' && (
+ <CardContent>
+ <ItemGroup className="gap-3">
+ {certificates.map((certificate) => (
+ <Item key={certificate.id} role="listitem" variant="outline" className="items-start">
+ <ItemContent className="min-w-0">
+ <ItemTitle className="flex-wrap">
+ {certificate.certificate_number}
<StatusBadge
- status="expired"
- label={t('admin.tax_exemption_certificates.lapsed')}
+ status={certificate.status}
+ label={t(`admin.tax_exemption_certificates.status.${certificate.status}`, {
+ defaultValue: certificate.status,
+ })}
/>
- )}
- </div>
- <span className="text-muted-foreground text-xs">
- {certificate.tax_exemption_reason?.name ?? '—'}
- {' · '}
- <JurisdictionLabel
- countryCode={certificate.country_code}
- stateCode={certificate.state_code}
- />
- </span>
-
- <dl className="mt-1 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs">
- {certificate.issuing_authority && (
- <>
- <dt className="text-muted-foreground">
- {t('admin.fields.issuing_authority.label')}
- </dt>
- <dd>{certificate.issuing_authority}</dd>
- </>
- )}
- {certificate.issued_at && (
- <>
- <dt className="text-muted-foreground">{t('admin.fields.issued_at.label')}</dt>
- <dd>
- <StoreDate iso={certificate.issued_at} />
- </dd>
- </>
- )}
- <dt className="text-muted-foreground">{t('admin.fields.expires_at.label')}</dt>
- <dd>
- {certificate.expires_at ? (
- <StoreDate iso={certificate.expires_at} />
- ) : (
- t('admin.tax_exemption_certificates.never_expires')
+ {certificate.lapsed && certificate.status !== 'expired' && (
+ <StatusBadge
+ status="expired"
+ label={t('admin.tax_exemption_certificates.lapsed')}
+ />
)}
- </dd>
- {certificate.verified_at && (
- <>
- <dt className="text-muted-foreground">
- {t('admin.tax_exemption_certificates.verified_at')}
- </dt>
- <dd>
- <StoreDate iso={certificate.verified_at} />
- </dd>
- </>
- )}
- </dl>
+ </ItemTitle>
+ <ItemDescription className="text-xs">
+ {certificate.tax_exemption_reason?.name ?? '—'}
+ {' · '}
+ <JurisdictionLabel
+ countryCode={certificate.country_code}
+ stateCode={certificate.state_code}
+ />
+ </ItemDescription>
- {certificate.document_filename ? (
- <Button
- type="button"
- variant="link"
- size="sm"
- className="h-auto justify-start p-0 text-xs"
- onClick={() => handleDownload(certificate)}
- >
- <PaperclipIcon className="size-3" />
- {certificate.document_filename}
- {certificate.document_byte_size ? (
- <span className="text-muted-foreground">
- ({formatFileSize(certificate.document_byte_size)})
- </span>
- ) : null}
- </Button>
- ) : (
- <span className="text-muted-foreground text-xs">
- {t('admin.tax_exemption_certificates.no_document')}
- </span>
- )}
- </div>
+ <dl className="mt-1 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs">
+ {certificate.issuing_authority && (
+ <>
+ <dt className="text-muted-foreground">
+ {t('admin.fields.issuing_authority.label')}
+ </dt>
+ <dd>{certificate.issuing_authority}</dd>
+ </>
+ )}
+ {certificate.issued_at && (
+ <>
+ <dt className="text-muted-foreground">
+ {t('admin.fields.issued_at.label')}
+ </dt>
+ <dd>
+ <StoreDate iso={certificate.issued_at} />
+ </dd>
+ </>
+ )}
+ <dt className="text-muted-foreground">{t('admin.fields.expires_at.label')}</dt>
+ <dd>
+ {certificate.expires_at ? (
+ <StoreDate iso={certificate.expires_at} />
+ ) : (
+ t('admin.tax_exemption_certificates.never_expires')
+ )}
+ </dd>
+ {certificate.verified_at && (
+ <>
+ <dt className="text-muted-foreground">
+ {t('admin.tax_exemption_certificates.verified_at')}
+ </dt>
+ <dd>
+ <StoreDate iso={certificate.verified_at} />
+ </dd>
+ </>
+ )}
+ </dl>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="ghost" size="icon-xs">
- <EllipsisVerticalIcon className="size-4" />
- <span className="sr-only">{t('admin.actions.actions_menu')}</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- {certificate.document_url && (
- <DropdownMenuItem onClick={() => handleDownload(certificate)}>
- <DownloadIcon className="size-4" />
- {t('admin.tax_exemption_certificates.download_action')}
- </DropdownMenuItem>
- )}
- {canEdit && certificate.status === 'pending' && (
- <DropdownMenuItem
- disabled={verifyMutation.isPending}
- onClick={() =>
- verifyMutation.mutateAsync(certificate.id).catch(() => undefined)
- }
- >
- <BadgeCheckIcon className="size-4" />
- {t('admin.tax_exemption_certificates.verify_action')}
- </DropdownMenuItem>
- )}
- {canEdit && certificate.status !== 'revoked' && (
- <DropdownMenuItem
- variant="destructive"
- disabled={revokeMutation.isPending}
- onClick={() => handleRevoke(certificate)}
- >
- <BanIcon className="size-4" />
- {t('admin.tax_exemption_certificates.revoke_action')}
- </DropdownMenuItem>
- )}
- {canEdit && certificate.can_be_deleted && (
- <DropdownMenuItem
- variant="destructive"
- onClick={() => handleDelete(certificate)}
+ {certificate.document_filename ? (
+ <Button
+ type="button"
+ variant="link"
+ size="sm"
+ className="h-auto justify-start p-0 text-xs"
+ onClick={() => handleDownload(certificate)}
>
- <TrashIcon className="size-4" />
- {t('admin.actions.delete')}
- </DropdownMenuItem>
+ <PaperclipIcon className="size-3" />
+ {certificate.document_filename}
+ {certificate.document_byte_size ? (
+ <span className="text-muted-foreground">
+ ({formatFileSize(certificate.document_byte_size)})
+ </span>
+ ) : null}
+ </Button>
+ ) : (
+ <span className="text-muted-foreground text-xs">
+ {t('admin.tax_exemption_certificates.no_document')}
+ </span>
)}
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- ))}
+ </ItemContent>
+
+ <ItemActions>
+ <RowActions
+ actions={[
+ {
+ key: 'download',
+ label: t('admin.tax_exemption_certificates.download_action'),
+ icon: <DownloadIcon className="size-4" />,
+ visible: !!certificate.document_url,
+ onSelect: () => handleDownload(certificate),
+ },
+ {
+ key: 'verify',
+ label: t('admin.tax_exemption_certificates.verify_action'),
+ icon: <BadgeCheckIcon className="size-4" />,
+ visible: canEdit && certificate.status === 'pending',
+ disabled: verifyMutation.isPending,
+ onSelect: () =>
+ verifyMutation.mutateAsync(certificate.id).catch(() => undefined),
+ },
+ {
+ key: 'revoke',
+ label: t('admin.tax_exemption_certificates.revoke_action'),
+ icon: <BanIcon className="size-4" />,
+ visible: canEdit && certificate.status !== 'revoked',
+ disabled: revokeMutation.isPending,
+ destructive: true,
+ onSelect: () => handleRevoke(certificate),
+ },
+ {
+ key: 'delete',
+ visible: canEdit && !!certificate.can_be_deleted,
+ destructive: true,
+ onSelect: () => handleDelete(certificate),
+ },
+ ]}
+ />
+ </ItemActions>
+ </Item>
+ ))}
+ </ItemGroup>
</CardContent>
)}
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 5e28d49850..cbc54da47e 100644
--- a/packages/dashboard/src/components/spree/translations/resource-translations-dialog.tsx
+++ b/packages/dashboard/src/components/spree/translations/resource-translations-dialog.tsx
@@ -185,11 +185,7 @@ export function ResourceTranslationsDialog({
return (
<Dialog open={open} onOpenChange={handleOpenChange} modal>
- <DialogContent
- className="!inset-3 !w-auto !max-w-none !translate-x-0 !translate-y-0 flex flex-col p-0"
- style={{ maxHeight: 'none' }}
- showCloseButton={false}
- >
+ <DialogContent fullScreen showCloseButton={false}>
<DialogHeader className="flex flex-row items-center justify-between gap-3 space-y-0 border-b p-3">
<div className="flex min-w-0 items-center gap-3">
<Button
diff --git a/packages/dashboard/src/components/spree/type-picker-sheet.tsx b/packages/dashboard/src/components/spree/type-picker-sheet.tsx
new file mode 100644
index 0000000000..55fb9044e2
--- /dev/null
+++ b/packages/dashboard/src/components/spree/type-picker-sheet.tsx
@@ -0,0 +1,82 @@
+import type { ResourceTypeDefinition } from '@spree/admin-sdk'
+import { type TypeFamily, typeDescription, typeLabel } from '@spree/dashboard-core'
+import {
+ Button,
+ Item,
+ ItemContent,
+ ItemDescription,
+ ItemTitle,
+ Sheet,
+ SheetContent,
+ SheetDescription,
+ SheetFooter,
+ SheetHeader,
+ SheetTitle,
+} from '@spree/dashboard-ui'
+import { useTranslation } from 'react-i18next'
+
+/** A sheet listing a type catalog's entries; picking one hands it back to the caller. */
+export function TypePickerSheet({
+ family,
+ types,
+ title,
+ description,
+ emptyMessage,
+ open,
+ onOpenChange,
+ onPicked,
+}: {
+ family: TypeFamily
+ types: ResourceTypeDefinition[]
+ title: string
+ description: string
+ emptyMessage?: string
+ open: boolean
+ onOpenChange: (open: boolean) => void
+ onPicked: (type: ResourceTypeDefinition) => void
+}) {
+ const { t } = useTranslation()
+
+ return (
+ <Sheet open={open} onOpenChange={onOpenChange}>
+ <SheetContent>
+ <SheetHeader>
+ <SheetTitle>{title}</SheetTitle>
+ <SheetDescription>{description}</SheetDescription>
+ </SheetHeader>
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto p-4">
+ {types.length === 0 ? (
+ <p className="text-sm text-muted-foreground">{emptyMessage}</p>
+ ) : (
+ <div className="flex flex-col gap-2">
+ {types.map((type) => {
+ const typeHelp = typeDescription(family, type.type, type.description)
+ return (
+ <Item
+ key={type.type}
+ variant="outline"
+ render={<button type="button" />}
+ onClick={() => onPicked(type)}
+ className="cursor-pointer text-left hover:bg-accent/50"
+ >
+ <ItemContent>
+ <ItemTitle>{typeLabel(family, type.type, type.label)}</ItemTitle>
+ {typeHelp && (
+ <ItemDescription className="text-xs">{typeHelp}</ItemDescription>
+ )}
+ </ItemContent>
+ </Item>
+ )
+ })}
+ </div>
+ )}
+ </div>
+ <SheetFooter>
+ <Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
+ {t('admin.actions.cancel')}
+ </Button>
+ </SheetFooter>
+ </SheetContent>
+ </Sheet>
+ )
+}
diff --git a/packages/dashboard/src/components/spree/webhook-endpoint-form.tsx b/packages/dashboard/src/components/spree/webhook-endpoint-form.tsx
index fcbc7d3000..ef5d70f53d 100644
--- a/packages/dashboard/src/components/spree/webhook-endpoint-form.tsx
+++ b/packages/dashboard/src/components/spree/webhook-endpoint-form.tsx
@@ -1,4 +1,7 @@
import {
+ Alert,
+ AlertAction,
+ AlertDescription,
Badge,
Button,
Checkbox,
@@ -9,6 +12,7 @@ import {
Input,
Switch,
} from '@spree/dashboard-ui'
+import { CircleAlertIcon } from '@spree/dashboard-ui/icons'
import { useState } from 'react'
import { Controller, type UseFormReturn } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
@@ -139,14 +143,17 @@ function EventPicker({ value, onChange }: { value: string[]; onChange: (next: st
<div className="flex max-h-72 flex-col gap-4 overflow-y-auto p-3">
{isPending && <p className="text-xs text-muted-foreground">{t('admin.common.loading')}</p>}
{isError && (
- <div className="flex items-center justify-between gap-2" role="alert">
- <p className="text-xs text-destructive">
+ <Alert variant="destructive" className="has-data-[slot=alert-action]:pr-28">
+ <CircleAlertIcon />
+ <AlertDescription>
{t('admin.pages.settings.webhooks.events_load_failed')}
- </p>
- <Button type="button" variant="outline" size="sm" onClick={() => refetch()}>
- {t('admin.common.retry')}
- </Button>
- </div>
+ </AlertDescription>
+ <AlertAction>
+ <Button type="button" variant="outline" size="sm" onClick={() => refetch()}>
+ {t('admin.common.retry')}
+ </Button>
+ </AlertAction>
+ </Alert>
)}
{[...groups].map(([group, groupEvents]) => (
<div key={group} className="flex flex-col gap-1">
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
index 5246481e61..e1840d5f04 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/customers/groups.tsx
@@ -15,6 +15,11 @@ import {
FieldGroup,
FieldLabel,
Input,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemMedia,
+ ItemTitle,
RowActions,
Sheet,
SheetContent,
@@ -333,14 +338,20 @@ function NameDescriptionFields({ form }: { form: UseFormReturn<CustomerGroupForm
function MembersSummary({ count, href }: { count: number; href: string }) {
const { t } = useTranslation()
return (
- <div className="flex items-center justify-between rounded-md border bg-muted/40 px-3 py-2">
- <div className="flex items-center gap-2 text-sm">
- <UsersIcon className="size-4 text-muted-foreground" />
- <span>{t('admin.customers.groups.count', { count })}</span>
- </div>
- <Link to={href as never} className="text-sm font-medium text-primary hover:underline">
- {t('admin.customers.groups.view_members')}
- </Link>
- </div>
+ <Item variant="muted" size="sm">
+ <ItemMedia variant="icon">
+ <UsersIcon className="text-muted-foreground" />
+ </ItemMedia>
+ <ItemContent>
+ <ItemTitle className="font-normal">
+ {t('admin.customers.groups.count', { count })}
+ </ItemTitle>
+ </ItemContent>
+ <ItemActions>
+ <Link to={href as never} className="text-sm font-medium text-primary hover:underline">
+ {t('admin.customers.groups.view_members')}
+ </Link>
+ </ItemActions>
+ </Item>
)
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
index d001d06c3d..526e9b6b77 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
@@ -24,6 +24,12 @@ import {
EmptyHeader,
EmptyMedia,
EmptyTitle,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemMedia,
+ ItemTitle,
Progress,
ScrollArea,
Skeleton,
@@ -246,7 +252,7 @@ function DashboardPage() {
}
const OPERATIONS_ROW_CLASS =
- 'flex items-center gap-3 border-b border-border-subtle px-4 py-3 last:border-0'
+ 'flex flex-nowrap items-center gap-3 rounded-none border-0 border-b border-border-subtle px-4 py-3 last:border-0'
/** `orders_to_fulfill` reads as "Orders to fulfill" when nobody has translated
* it — better than a raw key for an extension's own counter. */
@@ -396,41 +402,41 @@ function CounterRow({
})
const content = (
<>
- <span className="flex size-8 shrink-0 items-center justify-center rounded-md border">
- <Icon className="size-4 text-muted-foreground" />
- </span>
- <span className="flex min-w-0 flex-1 flex-col">
- <span className="text-sm">{label}</span>
+ <ItemMedia variant="icon" className="size-8 rounded-md border">
+ <Icon className="text-muted-foreground" />
+ </ItemMedia>
+ <ItemContent className="min-w-0">
+ <ItemTitle className="font-normal">{label}</ItemTitle>
{description && (
- <span className="truncate text-xs text-muted-foreground">{description}</span>
+ <ItemDescription className="line-clamp-1 text-xs">{description}</ItemDescription>
)}
- </span>
- <span
- className={cn(
- 'text-sm font-semibold tabular-nums',
- counter.value === 0 && 'text-muted-foreground',
- )}
- >
- {counter.value.toLocaleString()}
- </span>
- {link && <ChevronRightIcon className="size-4 text-muted-foreground" />}
+ </ItemContent>
+ <ItemActions>
+ <span
+ className={cn(
+ 'text-sm font-semibold tabular-nums',
+ counter.value === 0 && 'text-muted-foreground',
+ )}
+ >
+ {counter.value.toLocaleString()}
+ </span>
+ {link && <ChevronRightIcon className="size-4 text-muted-foreground" />}
+ </ItemActions>
</>
)
if (link) {
return (
- <Link
- to={link.to}
- params={{ storeId }}
- search={{ filters: link.filters }}
+ <Item
+ render={<Link to={link.to} params={{ storeId }} search={{ filters: link.filters }} />}
className={cn(OPERATIONS_ROW_CLASS, 'hover:bg-accent/50')}
>
{content}
- </Link>
+ </Item>
)
}
- return <div className={OPERATIONS_ROW_CLASS}>{content}</div>
+ return <Item className={OPERATIONS_ROW_CLASS}>{content}</Item>
}
type RankingTab = 'customers' | 'categories' | 'companies' | 'sellers'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/store-credits.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/store-credits.tsx
index 08828b72f6..cc2be68ace 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/store-credits.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/store-credits.tsx
@@ -17,6 +17,10 @@ import {
Card,
CardContent,
cn,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemTitle,
Pagination,
RelativeTime,
RowActions,
@@ -386,20 +390,25 @@ function StoreCreditSheet({
<>
<ul className="flex flex-col divide-y rounded-md border">
{events.data.map((event) => (
- <li
+ <Item
key={event.id}
- className="flex items-baseline justify-between gap-3 p-3"
+ render={<li />}
+ className="flex-nowrap items-baseline gap-3 rounded-none border-0 p-3"
>
- <span className="text-sm">{event.display_action ?? event.action}</span>
- <span className="flex items-baseline gap-3">
+ <ItemContent>
+ <ItemTitle className="font-normal">
+ {event.display_action ?? event.action}
+ </ItemTitle>
+ </ItemContent>
+ <ItemActions className="items-baseline gap-3">
<span className="text-sm tabular-nums">
<Money amount={event.amount} currency={credit.currency} />
</span>
<span className="whitespace-nowrap text-muted-foreground text-xs">
<RelativeTime iso={event.created_at} />
</span>
- </span>
- </li>
+ </ItemActions>
+ </Item>
))}
</ul>
{events.meta && <Pagination meta={events.meta} onPageChange={setLedgerPage} />}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/oauth/authorize.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/oauth/authorize.tsx
index 5ed0a5c196..2bcdf9fe2e 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/oauth/authorize.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/oauth/authorize.tsx
@@ -12,6 +12,7 @@ import {
ScrollArea,
Skeleton,
} from '@spree/dashboard-ui'
+import { CircleAlertIcon, InfoIcon } from '@spree/dashboard-ui/icons'
import { createFileRoute } from '@tanstack/react-router'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -122,6 +123,7 @@ function OauthAuthorizePage() {
below would skeleton forever behind it. */}
{error ? (
<Alert variant="destructive">
+ <CircleAlertIcon />
<AlertDescription>
{t('admin.pages.oauth.authorize.invalid_request')}
{errorDetail ? (
@@ -184,6 +186,7 @@ function OauthAuthorizePage() {
</div>
<Alert variant="info">
+ <InfoIcon />
<AlertDescription>
{t('admin.pages.oauth.authorize.revoke_hint')}
</AlertDescription>
@@ -191,6 +194,7 @@ function OauthAuthorizePage() {
{decisionError ? (
<Alert variant="destructive">
+ <CircleAlertIcon />
<AlertDescription>{decisionError}</AlertDescription>
</Alert>
) : null}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/catalogs/$catalogId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/catalogs/$catalogId.tsx
index 4d0ab2d3eb..750d7165c6 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/catalogs/$catalogId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/catalogs/$catalogId.tsx
@@ -13,6 +13,8 @@ import {
} from '@spree/dashboard-core'
import {
ActiveBadge,
+ Alert,
+ AlertDescription,
Button,
Card,
CardContent,
@@ -30,7 +32,7 @@ import {
Textarea,
useConfirm,
} from '@spree/dashboard-ui'
-import { PauseIcon, PlayIcon, TableIcon } from '@spree/dashboard-ui/icons'
+import { CircleAlertIcon, PauseIcon, PlayIcon, TableIcon } from '@spree/dashboard-ui/icons'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { useEffect, useState } from 'react'
import { FormProvider, type UseFormReturn, useForm } from 'react-hook-form'
@@ -321,12 +323,10 @@ function CatalogBody({ catalog }: { catalog: Catalog }) {
main={
<>
{form.formState.errors.root?.message && (
- <p
- className="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive"
- role="alert"
- >
- {form.formState.errors.root.message}
- </p>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertDescription>{form.formState.errors.root.message}</AlertDescription>
+ </Alert>
)}
<DeferredProductMembershipCard
parentId={catalog.id}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/purchase-orders/$purchaseOrderId/edit.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/purchase-orders/$purchaseOrderId/edit.tsx
index 090b8c3e55..20c708af39 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/purchase-orders/$purchaseOrderId/edit.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/purchase-orders/$purchaseOrderId/edit.tsx
@@ -1,5 +1,6 @@
import { PageHeader } from '@spree/dashboard-core'
import { Alert, AlertDescription } from '@spree/dashboard-ui'
+import { InfoIcon } from '@spree/dashboard-ui/icons'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { useTranslation } from 'react-i18next'
import {
@@ -42,6 +43,7 @@ function EditPurchaseOrderPage() {
backTo={`purchase-orders/${purchaseOrderId}`}
/>
<Alert>
+ <InfoIcon />
<AlertDescription>{t('admin.purchase_orders.errors.not_editable')}</AlertDescription>
</Alert>
</div>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/$templateId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/$templateId.tsx
index 2fcf4f8405..48b8b9a361 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/$templateId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/$templateId.tsx
@@ -32,7 +32,14 @@ import {
toastManager,
useConfirm,
} from '@spree/dashboard-ui'
-import { HistoryIcon, RotateCcwIcon, SendIcon, Trash2Icon } from '@spree/dashboard-ui/icons'
+import {
+ HistoryIcon,
+ InfoIcon,
+ RotateCcwIcon,
+ SendIcon,
+ Trash2Icon,
+ TriangleAlertIcon,
+} from '@spree/dashboard-ui/icons'
import {
CodeEditor,
type CodeEditorCompletion,
@@ -449,6 +456,7 @@ function EmailTemplateEditor({
<div className="flex flex-col gap-4">
{template.default_changed && template.base_body !== null && (
<Alert variant="warning">
+ <TriangleAlertIcon />
<AlertTitle>{t('admin.email_templates.default_update.title')}</AlertTitle>
<AlertDescription>
{t('admin.email_templates.default_update.description')}
@@ -608,6 +616,7 @@ function EveryLanguageNotice({ language }: { language: string }) {
return (
<Alert variant="info">
+ <InfoIcon />
<AlertDescription>
{t('admin.email_templates.every_language.notice', {
language: languageName(language) ?? language,
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/index.tsx
index e2aff10aae..9b14b70ff7 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/emails/templates/index.tsx
@@ -14,6 +14,11 @@ import {
CardHeader,
CardTitle,
ErrorState,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemTitle,
ResourceLayout,
Skeleton,
} from '@spree/dashboard-ui'
@@ -104,22 +109,26 @@ function TemplateGroup({
<ul className="divide-y divide-border">
{templates.map((template) => (
<li key={template.id}>
- <Link
- to="/$storeId/settings/emails/templates/$templateId"
- params={{ storeId, templateId: template.id }}
- className="flex items-center gap-3 px-4 py-3 hover:bg-accent"
+ <Item
+ render={
+ <Link
+ to="/$storeId/settings/emails/templates/$templateId"
+ params={{ storeId, templateId: template.id }}
+ />
+ }
+ className="flex-nowrap gap-3 rounded-none px-4 py-3 hover:bg-accent"
>
- <div className="flex min-w-0 flex-1 flex-col">
- <span className="font-medium">{emailTemplateName(t, template.key)}</span>
+ <ItemContent className="min-w-0 gap-0">
+ <ItemTitle>{emailTemplateName(t, template.key)}</ItemTitle>
{template.subject && template.kind === 'email' && (
- <span className="truncate text-sm text-muted-foreground">
- {template.subject}
- </span>
+ <ItemDescription className="line-clamp-1">{template.subject}</ItemDescription>
)}
- </div>
- <TemplateBadges template={template} />
- <ChevronRightIcon className="size-4 text-muted-foreground" aria-hidden />
- </Link>
+ </ItemContent>
+ <ItemActions>
+ <TemplateBadges template={template} />
+ <ChevronRightIcon className="size-4 text-muted-foreground" aria-hidden />
+ </ItemActions>
+ </Item>
</li>
))}
</ul>
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 dc7b086368..8ff85558a2 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/$webhookEndpointId.tsx
@@ -16,6 +16,9 @@ import {
Subject,
} from '@spree/dashboard-core'
import {
+ Alert,
+ AlertAction,
+ AlertDescription,
Badge,
Button,
Card,
@@ -37,7 +40,7 @@ import {
useFormSubmitShortcut,
useRowClickBridge,
} from '@spree/dashboard-ui'
-import { AlertTriangleIcon, PencilIcon, PlayIcon, RotateCcwIcon } from '@spree/dashboard-ui/icons'
+import { CircleAlertIcon, PencilIcon, PlayIcon, RotateCcwIcon } from '@spree/dashboard-ui/icons'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { lazy, Suspense } from 'react'
import { type UseFormReturn, useForm } from 'react-hook-form'
@@ -317,15 +320,23 @@ function AutoDisabledAlert({
}) {
const { t } = useTranslation()
return (
- <div className="flex flex-col gap-2 rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive sm:flex-row sm:items-center sm:justify-between">
- <span className="flex items-start gap-2">
- <AlertTriangleIcon className="size-4 shrink-0" />
+ <Alert variant="destructive" className="has-data-[slot=alert-action]:pr-28">
+ <CircleAlertIcon />
+ <AlertDescription>
{endpoint.disabled_reason || t('admin.pages.settings.webhooks.health.auto_disabled_alert')}
- </span>
- <Button type="button" size="sm" variant="outline" onClick={onReEnable} disabled={reEnabling}>
- {t('admin.pages.settings.webhooks.health.re_enable_cta')}
- </Button>
- </div>
+ </AlertDescription>
+ <AlertAction>
+ <Button
+ type="button"
+ size="sm"
+ variant="outline"
+ onClick={onReEnable}
+ disabled={reEnabling}
+ >
+ {t('admin.pages.settings.webhooks.health.re_enable_cta')}
+ </Button>
+ </AlertAction>
+ </Alert>
)
}
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 a0ab39e424..3533dc0041 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/webhooks/index.tsx
@@ -10,6 +10,8 @@ import {
usePermissions,
} from '@spree/dashboard-core'
import {
+ Alert,
+ AlertDescription,
Button,
Dialog,
DialogBody,
@@ -325,10 +327,10 @@ function SecretRevealDialog({
</DialogDescription>
</DialogHeader>
<DialogBody className="flex flex-col gap-3">
- <div className="flex items-start gap-2 rounded-md border border-yellow-200 bg-yellow-50 p-3 text-sm text-yellow-900 dark:border-yellow-900/40 dark:bg-yellow-950/40 dark:text-yellow-200">
- <AlertTriangleIcon className="size-4 shrink-0" />
- <span>{t('admin.api_keys.warning_treat_like_password')}</span>
- </div>
+ <Alert variant="warning">
+ <AlertTriangleIcon />
+ <AlertDescription>{t('admin.api_keys.warning_treat_like_password')}</AlertDescription>
+ </Alert>
{endpoint?.secret_key && (
<div className="flex items-center gap-2 rounded-md border border-border bg-muted/40 p-3">
<code className="flex-1 truncate font-mono text-sm">{endpoint.secret_key}</code>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/transfers/$transferId/edit.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/transfers/$transferId/edit.tsx
index 73eaa3d7df..c5da38e5fe 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/transfers/$transferId/edit.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/transfers/$transferId/edit.tsx
@@ -1,5 +1,6 @@
import { PageHeader } from '@spree/dashboard-core'
import { Alert, AlertDescription } from '@spree/dashboard-ui'
+import { InfoIcon } from '@spree/dashboard-ui/icons'
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { useTranslation } from 'react-i18next'
import {
@@ -37,6 +38,7 @@ function EditStockTransferPage() {
backTo={`transfers/${transferId}`}
/>
<Alert>
+ <InfoIcon />
<AlertDescription>{t('admin.stock_transfers.errors.not_editable')}</AlertDescription>
</Alert>
</div>
diff --git a/packages/dashboard/src/routes/login.tsx b/packages/dashboard/src/routes/login.tsx
index 969cd1d346..3281f4b491 100644
--- a/packages/dashboard/src/routes/login.tsx
+++ b/packages/dashboard/src/routes/login.tsx
@@ -2,7 +2,16 @@ import { zodResolver } from '@hookform/resolvers/zod'
import type { AuthProvider } from '@spree/admin-sdk'
import { SpreeError } from '@spree/admin-sdk'
import { adminClient, Slot, useAuth } from '@spree/dashboard-core'
-import { Button, Input, Label, Skeleton } from '@spree/dashboard-ui'
+import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
+ Button,
+ Input,
+ Label,
+ Skeleton,
+} from '@spree/dashboard-ui'
+import { CircleAlertIcon } from '@spree/dashboard-ui/icons'
import { useQuery } from '@tanstack/react-query'
import { createFileRoute, Link, Navigate } from '@tanstack/react-router'
import { useForm } from 'react-hook-form'
@@ -233,12 +242,11 @@ function ProvidersUnavailable() {
const { t } = useTranslation()
return (
- <div className="grid gap-2 rounded-md border border-destructive/50 p-4">
- <p className="font-medium text-sm">{t('admin.auth.login.providers_error_title')}</p>
- <p className="text-sm text-muted-foreground">
- {t('admin.auth.login.providers_error_message')}
- </p>
- </div>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertTitle>{t('admin.auth.login.providers_error_title')}</AlertTitle>
+ <AlertDescription>{t('admin.auth.login.providers_error_message')}</AlertDescription>
+ </Alert>
)
}
diff --git a/packages/dashboard/src/routes/setup.tsx b/packages/dashboard/src/routes/setup.tsx
index 3b39f1fc6f..1fad86cb8a 100644
--- a/packages/dashboard/src/routes/setup.tsx
+++ b/packages/dashboard/src/routes/setup.tsx
@@ -1,7 +1,17 @@
import { zodResolver } from '@hookform/resolvers/zod'
import type { SpreeError } from '@spree/admin-sdk'
import { adminClient, mapSpreeErrorsToForm, useAuth } from '@spree/dashboard-core'
-import { Button, Checkbox, Input, Label, toastManager } from '@spree/dashboard-ui'
+import {
+ Alert,
+ AlertAction,
+ AlertDescription,
+ Button,
+ Checkbox,
+ Input,
+ Label,
+ toastManager,
+} from '@spree/dashboard-ui'
+import { CircleAlertIcon } from '@spree/dashboard-ui/icons'
import { useQuery } from '@tanstack/react-query'
import { createFileRoute, Link, Navigate } from '@tanstack/react-router'
import { useState } from 'react'
@@ -193,18 +203,21 @@ function SetupForm({
needs saying out loud and a way back — otherwise the country box
is simply empty and the merchant is stuck with no explanation. */}
{countriesQuery.isError && (
- <div className="flex items-center justify-between gap-3 rounded-lg border border-destructive/50 px-3 py-2">
- <p className="text-sm text-destructive">{t('admin.setup.countries_failed')}</p>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() => countriesQuery.refetch()}
- disabled={countriesQuery.isFetching}
- >
- {t('admin.common.retry')}
- </Button>
- </div>
+ <Alert variant="destructive" className="has-data-[slot=alert-action]:pr-28">
+ <CircleAlertIcon />
+ <AlertDescription>{t('admin.setup.countries_failed')}</AlertDescription>
+ <AlertAction>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => countriesQuery.refetch()}
+ disabled={countriesQuery.isFetching}
+ >
+ {t('admin.common.retry')}
+ </Button>
+ </AlertAction>
+ </Alert>
)}
<StoreSetupFields
form={form}
diff --git a/packages/seller-dashboard/src/pages/onboarding.tsx b/packages/seller-dashboard/src/pages/onboarding.tsx
index 467bc924aa..6307bddff7 100644
--- a/packages/seller-dashboard/src/pages/onboarding.tsx
+++ b/packages/seller-dashboard/src/pages/onboarding.tsx
@@ -10,6 +10,8 @@ import {
AccordionContent,
AccordionItem,
AccordionTrigger,
+ Alert,
+ AlertDescription,
Badge,
Button,
Card,
@@ -28,6 +30,7 @@ import {
import {
CheckCircle2Icon,
ChevronRightIcon,
+ CircleAlertIcon,
CircleIcon,
ClockIcon,
ExternalLinkIcon,
@@ -284,9 +287,10 @@ function RequirementAction({ requirement }: { requirement: RequirementStatus })
// A rejection the seller cannot read is a rejection they cannot act on.
const rejection = submission?.status === 'rejected' && submission.review_note && (
- <p className="rounded-md bg-destructive/10 p-3 text-destructive text-sm">
- {submission.review_note}
- </p>
+ <Alert variant="destructive">
+ <CircleAlertIcon />
+ <AlertDescription>{submission.review_note}</AlertDescription>
+ </Alert>
)
// Nothing to do on a finished line. The header already carries the tick and
diff --git a/packages/seller-dashboard/src/pages/policies.tsx b/packages/seller-dashboard/src/pages/policies.tsx
index 5af79d944c..1ac4365753 100644
--- a/packages/seller-dashboard/src/pages/policies.tsx
+++ b/packages/seller-dashboard/src/pages/policies.tsx
@@ -15,6 +15,11 @@ import {
FieldError,
FieldLabel,
Input,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemGroup,
+ ItemTitle,
RichTextEditor,
RowActions,
Sheet,
@@ -128,19 +133,26 @@ export function PoliciesPage({ search }: { search: ResourceSearch }) {
</CardHeader>
<CardContent className="flex flex-col gap-3">
<p className="text-muted-foreground text-sm">{t('policies.required.description')}</p>
- <ul className="flex flex-col gap-2">
+ <ItemGroup className="gap-2">
{outstanding.map((name) => (
- <li
+ <Item
key={name}
- className="flex items-center justify-between gap-4 rounded-lg border border-border-subtle px-3 py-2"
+ role="listitem"
+ variant="outline"
+ size="sm"
+ className="border-border-subtle"
>
- <span className="font-medium text-sm">{name}</span>
- <Button size="sm" variant="outline" onClick={() => setCreatingName(name)}>
- {t('policies.required.write')}
- </Button>
- </li>
+ <ItemContent>
+ <ItemTitle>{name}</ItemTitle>
+ </ItemContent>
+ <ItemActions>
+ <Button size="sm" variant="outline" onClick={() => setCreatingName(name)}>
+ {t('policies.required.write')}
+ </Button>
+ </ItemActions>
+ </Item>
))}
- </ul>
+ </ItemGroup>
</CardContent>
</Card>
)}