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.

Polish dashboard status colours, badges and the fulfillment card

Damian Legawiec85956b0376d7
diff --git a/packages/dashboard-core/src/components/import-button.tsx b/packages/dashboard-core/src/components/import-button.tsx
index 9ca2de79e5..544897597f 100644
--- a/packages/dashboard-core/src/components/import-button.tsx
+++ b/packages/dashboard-core/src/components/import-button.tsx
@@ -55,6 +55,10 @@ interface ImportButtonProps {
onCreated: (imp: Import) => void
/** Label shown on the button. Defaults to the translated "Import" action. */
label?: string
+ /** Optional variant for the button. Defaults to "outline". */
+ variant?: 'default' | 'outline' | 'ghost'
+ /** Optional size for the button. Defaults to "sm". */
+ size?: 'sm' | 'default' | 'lg'
}
/**
@@ -63,7 +67,14 @@ interface ImportButtonProps {
* `FileUploadField`; submitting creates the import from the signed blob id
* and hands it to `onCreated`.
*/
-export function ImportButton({ type, subject, onCreated, label }: ImportButtonProps) {
+export function ImportButton({
+ type,
+ subject,
+ onCreated,
+ label,
+ variant,
+ size,
+}: ImportButtonProps) {
const { t } = useTranslation()
const [open, setOpen] = useState(false)
const [file, setFile] = useState<FileUploadValue>(EMPTY_FILE_UPLOAD_VALUE)
@@ -131,13 +142,13 @@ export function ImportButton({ type, subject, onCreated, label }: ImportButtonPr
return (
<Can I="create" a={subject}>
<Button
- size="sm"
- variant="outline"
+ size={size ?? 'sm'}
+ variant={variant ?? 'outline'}
className="h-[2.125rem]"
onClick={() => setOpen(true)}
disabled={createImport.isPending}
>
- <UploadIcon className="size-4" />
+ <UploadIcon />
{label ?? t('admin.actions.import')}
</Button>
diff --git a/packages/dashboard-ui/src/spree/confirm-dialog.tsx b/packages/dashboard-ui/src/spree/confirm-dialog.tsx
index f403783e6f..2f0d28254e 100644
--- a/packages/dashboard-ui/src/spree/confirm-dialog.tsx
+++ b/packages/dashboard-ui/src/spree/confirm-dialog.tsx
@@ -64,7 +64,7 @@ export function ConfirmProvider({ children }: { children: ReactNode }) {
<DialogTitle>{options.title ?? t('admin.components.confirm_dialog.title')}</DialogTitle>
<DialogDescription>{options.message}</DialogDescription>
</DialogHeader>
- <DialogFooter>
+ <DialogFooter className="border-0">
<Button variant="outline" onClick={() => handleClose(false)}>
{options.cancelLabel ?? t('admin.actions.cancel')}
</Button>
diff --git a/packages/dashboard-ui/src/styles.css b/packages/dashboard-ui/src/styles.css
index 90fe587572..d51cbf1a65 100644
--- a/packages/dashboard-ui/src/styles.css
+++ b/packages/dashboard-ui/src/styles.css
@@ -171,10 +171,10 @@
--color-background: var(--background);
/* Spree status colors — for badges & alerts */
- --color-success: var(--color-green-500);
+ --color-success: var(--color-lime-500);
--color-warning: var(--color-yellow-500);
- --color-info: var(--color-blue-500);
- --color-danger: var(--color-red-500);
+ --color-info: var(--color-sky-500);
+ --color-danger: var(--color-rose-500);
}
@utility focus-ring {
diff --git a/packages/dashboard-ui/src/ui/badge.tsx b/packages/dashboard-ui/src/ui/badge.tsx
index bf5cd10b6e..e060cb0799 100644
--- a/packages/dashboard-ui/src/ui/badge.tsx
+++ b/packages/dashboard-ui/src/ui/badge.tsx
@@ -22,6 +22,8 @@ const badgeVariants = cva(
outline:
'border-border text-foreground/75 [a]:hover:bg-muted [a]:hover:text-muted-foreground',
ghost: 'hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50',
+ info: 'bg-info/10 text-info [a]:hover:bg-info/20',
+ warning: 'bg-yellow-300 text-yellow-900 [a]:hover:bg-warning/20',
link: 'text-primary underline-offset-4 hover:underline',
},
},
@@ -55,29 +57,26 @@ function Badge({
// on the canonical shadcn variants with shape + label carrying meaning.
const statusVariantMap: Record<string, VariantProps<typeof badgeVariants>['variant']> = {
active: 'success',
+ authorized: 'info',
complete: 'success',
completed: 'success',
paid: 'success',
- shipped: 'success',
+ fulfilled: 'success',
published: 'success',
approved: 'success',
- ready: 'success',
+ ready: 'warning',
draft: 'outline',
- pending: 'outline',
- processing: 'outline',
- inactive: 'outline',
- cart: 'outline',
- address: 'outline',
- delivery: 'outline',
- payment: 'outline',
+ pending: 'warning',
+ processing: 'warning',
+ inactive: 'secondary',
confirm: 'outline',
resumed: 'secondary',
- partial: 'secondary',
+ partial: 'info',
archived: 'secondary',
- returned: 'secondary',
- backorder: 'secondary',
- balance_due: 'secondary',
- credit_owed: 'secondary',
+ returned: 'success',
+ backorder: 'warning',
+ balance_due: 'warning',
+ credit_owed: 'warning',
canceled: 'destructive',
failed: 'destructive',
void: 'destructive',
diff --git a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
index 1280a91038..972597ed8c 100644
--- a/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
+++ b/packages/dashboard/src/components/spree/orders/fulfillments-card.tsx
@@ -402,11 +402,26 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
const shippable = CAN_SHIP.includes(fulfillment.status)
return (
- <div className="rounded-lg border p-4 flex flex-col gap-3">
- <div className="flex items-center justify-between">
+ <div className="rounded-lg border flex flex-col">
+ <div className="flex items-center justify-between border-b p-3">
<div className="flex items-center gap-2">
<StatusBadge status={fulfillment.status} />
- <span className="text-sm font-medium">{fulfillment.number}</span>
+ {fulfillment.stock_location && (
+ <div className="flex items-center gap-1.5 text-xs text-muted-foreground">
+ <MapPinIcon className="size-3" />
+ {fulfillment.stock_location.name}
+ </div>
+ )}
+
+ {fulfillment.fulfilled_at && (
+ <span className="text-xs text-muted-foreground">
+ <RelativeTime
+ iso={fulfillment.fulfilled_at}
+ prefix={t('admin.orders.detail.tracking.shipped_prefix')}
+ fallback=""
+ />
+ </span>
+ )}
</div>
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -463,7 +478,7 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
</div>
{(fulfillment.delivery_method || Number.parseFloat(fulfillment.cost) > 0) && (
- <div className="flex items-center justify-between text-sm">
+ <div className="flex items-center justify-between text-sm p-3 border-b">
<span className="text-muted-foreground">
{fulfillment.delivery_method?.name ?? t('admin.pages.orders.detail.no_delivery_method')}
</span>
@@ -471,15 +486,8 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
</div>
)}
- {fulfillment.stock_location && (
- <div className="flex items-center gap-1.5 text-xs text-muted-foreground">
- <MapPinIcon className="size-3" />
- {fulfillment.stock_location.name}
- </div>
- )}
-
{fulfillment.tracking && !fulfilling && (
- <div className="text-sm">
+ <div className="text-sm p-3 border-b">
<span className="text-muted-foreground">
{t('admin.orders.detail.tracking.prefix')}:{' '}
</span>
@@ -498,16 +506,6 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
</div>
)}
- {fulfillment.fulfilled_at && (
- <span className="text-xs text-muted-foreground">
- <RelativeTime
- iso={fulfillment.fulfilled_at}
- prefix={t('admin.orders.detail.tracking.shipped_prefix')}
- fallback=""
- />
- </span>
- )}
-
{fulfilling ? (
<FulfillmentFulfillForm
order={order}
@@ -519,7 +517,7 @@ function FulfillmentRow({ order, fulfillment }: { order: Order; fulfillment: Ful
<FulfillmentItemList rows={fulfillmentItemRows(fulfillment, order.items ?? [])} />
{shippable && (
- <div className="flex justify-end">
+ <div className="flex justify-end p-3 border-t">
<Button type="button" size="sm" onClick={() => setFulfilling(true)}>
<TruckIcon data-icon="inline-start" />
{t('admin.orders.fulfill.action')}
diff --git a/packages/dashboard/src/components/spree/setup-tasks/add-products-task.tsx b/packages/dashboard/src/components/spree/setup-tasks/add-products-task.tsx
index e2890e3eef..6ea980f7c2 100644
--- a/packages/dashboard/src/components/spree/setup-tasks/add-products-task.tsx
+++ b/packages/dashboard/src/components/spree/setup-tasks/add-products-task.tsx
@@ -25,6 +25,7 @@ export function AddProductsTask({ task, storeId }: SetupTaskSlotContext) {
</Button>
<ImportButton
type="products"
+ size="default"
subject={Subject.Product}
label={t('admin.pages.getting_started.tasks.add_products.import_cta')}
onCreated={(imp) =>