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.

Added seller panel settings overview page (#14635)

Damian Legawiec496431d8e902
diff --git a/.changeset/seller-settings-overview.md b/.changeset/seller-settings-overview.md
new file mode 100644
index 0000000000..aa9d47ac0b
--- /dev/null
+++ b/.changeset/seller-settings-overview.md
@@ -0,0 +1,6 @@
+---
+"@spree/dashboard-core": patch
+"@spree/seller-dashboard": patch
+---
+
+Added a settings overview page to the seller panel, matching the operator dashboard's card grid of reachable settings areas.
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.ts
index afa47966ea..85e9312fa7 100644
--- a/packages/dashboard-core/src/index.ts
+++ b/packages/dashboard-core/src/index.ts
@@ -112,6 +112,7 @@ export * from './lib/table-registry'
export { ensureTimestampColumns } from './lib/timestamp-columns'
export * from './lib/type-labels'
export * from './pages/package-types'
+export * from './pages/settings-index'
export * from './pages/stock-locations'
// ---------------------------------------------------------------------------
// Plugin facade — re-exported for convenience; same API as `/plugin` subpath
diff --git a/packages/dashboard-core/src/pages/settings-index.tsx b/packages/dashboard-core/src/pages/settings-index.tsx
new file mode 100644
index 0000000000..2f76b89271
--- /dev/null
+++ b/packages/dashboard-core/src/pages/settings-index.tsx
@@ -0,0 +1,112 @@
+import { Card, SearchInput } from '@spree/dashboard-ui'
+import { PackageIcon } from '@spree/dashboard-ui/icons'
+import { Link } from '@tanstack/react-router'
+import { useMemo, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import { PageHeader } from '../components/page-header'
+import { resolveNavDescription, resolveNavLabel } from '../lib/nav-registry'
+import {
+ filterSettingsByPermissions,
+ filterSettingsByQuery,
+ type SettingsNavEntry,
+ useSettingsNav,
+} from '../lib/settings-nav-registry'
+import { usePermissions } from '../providers/permission-provider'
+
+/**
+ * Settings landing page — a card grid of every settings area the current
+ * member can reach, grouped the same way the sidebar groups them.
+ *
+ * Shared by the operator dashboard and the marketplace seller panel. Each
+ * host passes its tenant id so the cards link under that panel's prefix
+ * (`/$storeId/settings/…` or `/$sellerId/settings/…`).
+ *
+ * It doubles as the settings navigation below `lg`, where `SettingsSidebar` is
+ * hidden: on a narrow viewport this grid is the only way into the area, so it
+ * must never be replaced by a redirect to a specific page.
+ */
+export function SettingsIndexPage({ tenantId }: { tenantId: string }) {
+ const { t } = useTranslation()
+ const snapshot = useSettingsNav()
+ const { permissions } = usePermissions()
+ const [query, setQuery] = useState('')
+
+ // Permission filtering depends only on the snapshot, so it survives typing.
+ const allowed = useMemo(
+ () => filterSettingsByPermissions(snapshot, permissions),
+ [snapshot, permissions],
+ )
+ const groups = useMemo(() => filterSettingsByQuery(allowed, query, t).groups, [allowed, query, t])
+
+ return (
+ <div className="flex flex-col gap-6">
+ <PageHeader
+ title={t('admin.settings_page.title')}
+ subtitle={t('admin.settings_page.description')}
+ />
+
+ {/* Hidden from `lg`, where the settings sidebar is on screen listing the
+ same entries and carrying the same search. Below that the sidebar is
+ gone, so this is the only way to filter — and the only navigation. */}
+ <div className="lg:hidden">
+ <SearchInput
+ value={query}
+ onValueChange={setQuery}
+ placeholder={t('admin.settings_page.search_placeholder')}
+ aria-label={t('admin.settings_page.search_placeholder')}
+ clearLabel={t('admin.common.clear')}
+ className="h-11 max-w-md"
+ />
+ </div>
+
+ {groups.length === 0 ? (
+ <p className="text-sm text-muted-foreground">
+ {t('admin.settings_page.no_results', { query: query.trim() })}
+ </p>
+ ) : (
+ groups.map(({ group, entries }) => (
+ <section key={group.key} className="flex flex-col gap-3">
+ <h2 className="text-sm font-medium text-muted-foreground">
+ {resolveNavLabel(group, t)}
+ </h2>
+ <div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
+ {entries.map((entry) => (
+ <SettingsCard key={entry.key} entry={entry} tenantId={tenantId} />
+ ))}
+ </div>
+ </section>
+ ))
+ )}
+ </div>
+ )
+}
+
+function SettingsCard({ entry, tenantId }: { entry: SettingsNavEntry; tenantId: string }) {
+ const { t } = useTranslation()
+ const Icon = entry.icon ?? PackageIcon
+ const label = resolveNavLabel(entry, t)
+ const description = resolveNavDescription(entry, t)
+
+ return (
+ <Card className="p-0 transition-colors hover:bg-accent/80 hover:border-border">
+ {/* The whole card is the target — a small title-only link would fail the
+ 44px minimum on touch and leaves most of the card dead to a click. */}
+ {/* Paths come from a runtime registry plugins extend, so they can't be
+ checked against the generated route tree. */}
+ <Link
+ to={`/${tenantId}/settings${entry.path}` as never}
+ // The whole card is the target, so without a replacement for the
+ // suppressed outline a keyboard user tabbing the grid cannot tell which
+ // card they are on. A solid ring rather than the border pair buttons
+ // use: this link draws no border of its own to recolour.
+ className="flex h-full items-start gap-3 rounded-xl p-4 outline-none focus-visible:shadow-[0_0_0_2px_var(--ring)]"
+ >
+ <Icon className="mt-0.5 size-6 shrink-0 text-muted-foreground opacity-80 hover:opacity-100" />
+ <span className="flex min-w-0 flex-col gap-1">
+ <span className="text-sm font-medium leading-none">{label}</span>
+ {description && <span className="text-sm text-muted-foreground">{description}</span>}
+ </span>
+ </Link>
+ </Card>
+ )
+}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/index.tsx
index 1b95d9fd2b..69d91f7493 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/index.tsx
@@ -1,114 +1,17 @@
-import {
- filterSettingsByPermissions,
- filterSettingsByQuery,
- PageHeader,
- resolveNavDescription,
- resolveNavLabel,
- type SettingsNavEntry,
- usePermissions,
- useSettingsNav,
-} from '@spree/dashboard-core'
-import { Card, SearchInput } from '@spree/dashboard-ui'
-import { PackageIcon } from '@spree/dashboard-ui/icons'
-import { createFileRoute, Link } from '@tanstack/react-router'
-import { useMemo, useState } from 'react'
-import { useTranslation } from 'react-i18next'
+import { SettingsIndexPage } from '@spree/dashboard-core'
+import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/_authenticated/$storeId/settings/')({
- component: SettingsIndexPage,
+ component: SettingsIndexRoute,
})
/**
- * Settings landing page — a card grid of every settings area the current staff
- * member can reach, grouped the same way the sidebar groups them.
- *
- * It doubles as the settings navigation below `lg`, where `SettingsSidebar` is
- * hidden: on a narrow viewport this grid is the only way into the area, so it
- * must never be replaced by a redirect to a specific page.
+ * The page itself lives in `@spree/dashboard-core` so the marketplace seller
+ * panel renders the same one. What stays here is the route — paths differ per
+ * panel, and file routes are generated per app.
*/
-function SettingsIndexPage() {
- const { t } = useTranslation()
- const snapshot = useSettingsNav()
- const { permissions } = usePermissions()
- const [query, setQuery] = useState('')
-
- // Permission filtering depends only on the snapshot, so it survives typing.
- const allowed = useMemo(
- () => filterSettingsByPermissions(snapshot, permissions),
- [snapshot, permissions],
- )
- const groups = useMemo(() => filterSettingsByQuery(allowed, query, t).groups, [allowed, query, t])
-
- return (
- <div className="flex flex-col gap-6">
- <PageHeader
- title={t('admin.settings_page.title')}
- subtitle={t('admin.settings_page.description')}
- />
-
- {/* Hidden from `lg`, where the settings sidebar is on screen listing the
- same entries and carrying the same search. Below that the sidebar is
- gone, so this is the only way to filter — and the only navigation. */}
- <div className="lg:hidden">
- <SearchInput
- value={query}
- onValueChange={setQuery}
- placeholder={t('admin.settings_page.search_placeholder')}
- aria-label={t('admin.settings_page.search_placeholder')}
- clearLabel={t('admin.common.clear')}
- className="h-11 max-w-md"
- />
- </div>
-
- {groups.length === 0 ? (
- <p className="text-sm text-muted-foreground">
- {t('admin.settings_page.no_results', { query: query.trim() })}
- </p>
- ) : (
- groups.map(({ group, entries }) => (
- <section key={group.key} className="flex flex-col gap-3">
- <h2 className="text-sm font-medium text-muted-foreground">
- {resolveNavLabel(group, t)}
- </h2>
- <div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
- {entries.map((entry) => (
- <SettingsCard key={entry.key} entry={entry} />
- ))}
- </div>
- </section>
- ))
- )}
- </div>
- )
-}
-
-function SettingsCard({ entry }: { entry: SettingsNavEntry }) {
- const { t } = useTranslation()
+function SettingsIndexRoute() {
const { storeId } = Route.useParams()
- const Icon = entry.icon ?? PackageIcon
- const label = resolveNavLabel(entry, t)
- const description = resolveNavDescription(entry, t)
- return (
- <Card className="p-0 transition-colors hover:bg-accent/80 hover:border-border">
- {/* The whole card is the target — a small title-only link would fail the
- 44px minimum on touch and leaves most of the card dead to a click. */}
- {/* Paths come from a runtime registry plugins extend, so they can't be
- checked against the generated route tree. */}
- <Link
- to={`/${storeId}/settings${entry.path}` as never}
- // The whole card is the target, so without a replacement for the
- // suppressed outline a keyboard user tabbing the grid cannot tell which
- // card they are on. A solid ring rather than the border pair buttons
- // use: this link draws no border of its own to recolour.
- className="flex h-full items-start gap-3 rounded-xl p-4 outline-none focus-visible:shadow-[0_0_0_2px_var(--ring)]"
- >
- <Icon className="mt-0.5 size-6 shrink-0 text-muted-foreground opacity-80 hover:opacity-100" />
- <span className="flex min-w-0 flex-col gap-1">
- <span className="text-sm font-medium leading-none">{label}</span>
- {description && <span className="text-sm text-muted-foreground">{description}</span>}
- </span>
- </Link>
- </Card>
- )
+ return <SettingsIndexPage tenantId={storeId} />
}
diff --git a/packages/seller-dashboard/src/locales/en.json b/packages/seller-dashboard/src/locales/en.json
index 9e9f913a15..d92d8fbc6c 100644
--- a/packages/seller-dashboard/src/locales/en.json
+++ b/packages/seller-dashboard/src/locales/en.json
@@ -181,6 +181,18 @@
}
}
}
+ },
+ "settings_nav": {
+ "descriptions": {
+ "delivery_methods": "How your goods ship to customers",
+ "package_types": "Boxes, cartons and containers you pack orders in",
+ "policies": "Terms, privacy, returns and shipping documents",
+ "stock_locations": "Warehouses and pickup points that hold stock",
+ "team": "People with access to this seller"
+ }
+ },
+ "settings_page": {
+ "description": "Manage fulfillment, legal documents and your team."
}
},
"app": {
diff --git a/packages/seller-dashboard/src/nav/default.ts b/packages/seller-dashboard/src/nav/default.ts
index 1410861760..828da23459 100644
--- a/packages/seller-dashboard/src/nav/default.ts
+++ b/packages/seller-dashboard/src/nav/default.ts
@@ -93,10 +93,10 @@ nav.add({
subject: 'seller_profile',
})
-// Settings is a launcher for the secondary rail, not a page: the entries
-// inside it live in `nav/settings.ts`. Bottom section and gated on there
-// being something to see, exactly as the operator's dashboard does it — a
-// member with no settings authority never opens an empty shell.
+// Settings opens the landing page (and the secondary rail on wide viewports).
+// The entries inside it live in `nav/settings.ts`. Bottom section and gated
+// on there being something to see, exactly as the operator's dashboard does
+// it — a member with no settings authority never opens an empty shell.
nav.add({
key: 'settings',
label: i18n.t('nav.settings'),
diff --git a/packages/seller-dashboard/src/nav/settings.ts b/packages/seller-dashboard/src/nav/settings.ts
index dc20481a8a..353757097f 100644
--- a/packages/seller-dashboard/src/nav/settings.ts
+++ b/packages/seller-dashboard/src/nav/settings.ts
@@ -36,6 +36,8 @@ settingsNav.addGroup({
settingsNav.add({
key: 'settings.stock-locations',
labelKey: 'admin.settings_nav.items.stock_locations',
+ descriptionKey: 'admin.settings_nav.descriptions.stock_locations',
+ keywords: ['warehouse', 'inventory', 'fulfillment', 'pickup'],
path: '/stock-locations',
icon: WarehouseIcon,
group: 'fulfillment',
@@ -50,6 +52,8 @@ settingsNav.add({
settingsNav.add({
key: 'settings.delivery-methods',
label: i18n.t('nav.delivery_methods'),
+ descriptionKey: 'admin.settings_nav.descriptions.delivery_methods',
+ keywords: ['shipping', 'rates', 'carriers', 'delivery'],
path: '/delivery-methods',
icon: TruckIcon,
group: 'fulfillment',
@@ -65,6 +69,8 @@ settingsNav.add({
settingsNav.add({
key: 'settings.package-types',
label: i18n.t('nav.package_types'),
+ descriptionKey: 'admin.settings_nav.descriptions.package_types',
+ keywords: ['box', 'carton', 'pallet', 'container', 'packaging', 'parcel'],
path: '/package-types',
icon: PackageIcon,
group: 'fulfillment',
@@ -80,6 +86,8 @@ settingsNav.add({
settingsNav.add({
key: 'settings.team',
label: i18n.t('nav.team'),
+ descriptionKey: 'admin.settings_nav.descriptions.team',
+ keywords: ['users', 'staff', 'invite', 'members'],
path: '/team',
icon: UsersRoundIcon,
group: 'team',
@@ -95,6 +103,8 @@ settingsNav.add({
settingsNav.add({
key: 'settings.policies',
label: i18n.t('nav.policies'),
+ descriptionKey: 'admin.settings_nav.descriptions.policies',
+ keywords: ['legal', 'terms', 'privacy', 'returns', 'refund'],
path: '/policies',
icon: ScrollTextIcon,
group: 'legal',
diff --git a/packages/seller-dashboard/src/routes/_authenticated/$sellerId/settings/index.tsx b/packages/seller-dashboard/src/routes/_authenticated/$sellerId/settings/index.tsx
index 98abb7d8de..41e69c3470 100644
--- a/packages/seller-dashboard/src/routes/_authenticated/$sellerId/settings/index.tsx
+++ b/packages/seller-dashboard/src/routes/_authenticated/$sellerId/settings/index.tsx
@@ -1,16 +1,18 @@
-import { createFileRoute, redirect } from '@tanstack/react-router'
+import { SettingsIndexPage } from '@spree/dashboard-core'
+import { createFileRoute } from '@tanstack/react-router'
-/**
- * Settings is a launcher, not a page — landing on it bare would show the rail
- * beside an empty pane, so it opens the first entry, as the operator's
- * dashboard does.
- */
export const Route = createFileRoute('/_authenticated/$sellerId/settings/')({
- beforeLoad: ({ params }) => {
- throw redirect({
- to: '/$sellerId/settings/stock-locations',
- params: { sellerId: params.sellerId },
- replace: true,
- })
- },
+ component: SettingsIndexRoute,
})
+
+/**
+ * The same landing page the operator's dashboard renders: a card grid of every
+ * settings area this member can reach. On a narrow viewport the settings rail
+ * is hidden, so this grid is the only way into the area — it must not redirect
+ * to a specific page.
+ */
+function SettingsIndexRoute() {
+ const { sellerId } = Route.useParams()
+
+ return <SettingsIndexPage tenantId={sellerId} />
+}