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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix: make the settings sidebar header sticky (#14653)
Damian Legawiecb640809e7a80
diff --git a/packages/dashboard-core/src/components/settings-sidebar.tsx b/packages/dashboard-core/src/components/settings-sidebar.tsxindex 86177ae8de..08321cd353 100644--- a/packages/dashboard-core/src/components/settings-sidebar.tsx+++ b/packages/dashboard-core/src/components/settings-sidebar.tsx@@ -9,6 +9,7 @@ import {SIDEBAR_WIDTH_MOBILE,SidebarGroup,SidebarGroupLabel,+ SidebarHeader,SidebarMenu,SidebarMenuBadge,SidebarMenuButton,@@ -58,6 +59,9 @@ export function SettingsSidebar({}) {const { t } = useTranslation()const { storeId } = useParams({ strict: false }) as { storeId?: string }+ // Held here rather than in the body: the search box lives in the header,+ // and the list it filters scrolls below it.+ const [query, setQuery] = useState('')// `h-full` fills the content sheet, which is itself exactly viewport-height// and scrolls internally — so the nav stays put as the page scrolls without@@ -81,33 +85,56 @@ export function SettingsSidebar({: 'lg:w-0 border-e-0 border-transparent',)}>- {/* `quiet-scrollbar` rather than the browser default: this nav is an- inset panel beside the primary sidebar, and a full-width native- scrollbar cuts a heavy grey stripe down the middle of the chrome. */}<divclassName={cn(- 'quiet-scrollbar h-full w-(--spacing-sidebar-width) overflow-y-auto transition-opacity duration-200',+ 'flex h-full w-(--spacing-sidebar-width) flex-col transition-opacity duration-200',open ? 'opacity-100 delay-100' : 'pointer-events-none opacity-0',)}>- {/* Names the area and offers the way out. Without it this panel is- visually identical to the primary sidebar, so nothing says the- merchant has entered a different part of the app — and the only- exit is the icon rail beside it. `h-rail-header-height` matches the- store switcher opposite, so the two line up. */}- <div className="flex h-rail-header-height items-center gap-1 px-2">- <Link- to={`/${tenantId ?? storeId}` as never}+ {/* Names the area, offers the way out, and carries the search box —+ the same pairing the primary sidebar's `SidebarHeader` holds, so+ the two rails open to the same silhouette.++ A sibling of the scroll area rather than a sticky child of it: the+ fade below is a `mask-image` on the scrolling element, and a mask+ applies to sticky descendants too — a header inside it would+ dissolve along with the rows it is meant to stay above. */}+ <SidebarHeader className="shrink-0 gap-2 pb-2">+ {/* `h-rail-header-height` matches the store switcher opposite, so the+ two line up. */}+ <div className="flex h-rail-header-height items-center gap-1">+ <Link+ to={`/${tenantId ?? storeId}` as never}+ tabIndex={open ? 0 : -1}+ aria-label={t('admin.settings_page.back_to_dashboard')}+ className="inline-flex size-8 shrink-0 items-center justify-center rounded-lg text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent hover:text-sidebar-foreground"+ >+ <ArrowLeftIcon className="size-4" />+ </Link>+ <span className="truncate font-medium text-sm">{t('admin.settings_page.title')}</span>+ </div>++ <SettingsNavSearch value={query} onValueChange={setQuery} tabIndex={open ? 0 : -1} />+ </SidebarHeader>++ {/* `quiet-scrollbar` rather than the browser default: this nav is an+ inset panel beside the primary sidebar, and a full-width native+ scrollbar cuts a heavy grey stripe down the middle of the chrome.++ `scroll-fade` dissolves the rows into the header above and the+ panel's foot below, and tracks the scroll position — crisp at the+ top until there is something scrolled past, clear again at the+ bottom once the end is reached. Falls back to a static fade on both+ edges where scroll-driven animations are unsupported. */}+ <div className="quiet-scrollbar scroll-fade min-h-0 flex-1 overflow-y-auto">+ <SettingsNavBodytabIndex={open ? 0 : -1}- aria-label={t('admin.settings_page.back_to_dashboard')}- className="inline-flex size-8 shrink-0 items-center justify-center rounded-lg text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent hover:text-sidebar-foreground"- >- <ArrowLeftIcon className="size-4" />- </Link>- <span className="truncate font-medium text-sm">{t('admin.settings_page.title')}</span>+ tenantId={tenantId}+ query={query}+ onQueryChange={setQuery}+ renderSearch={false}+ /></div>-- <SettingsNavBody tabIndex={open ? 0 : -1} tenantId={tenantId} /></div></aside>)@@ -199,24 +226,65 @@ export function SettingsNavSheet({)}+/**+ * The settings search box. Extracted so the desktop rail can render it in its+ * fixed header while the sheet keeps it at the top of its scroll body.+ */+function SettingsNavSearch({+ value,+ onValueChange,+ tabIndex,+}: {+ value: string+ onValueChange: (next: string) => void+ tabIndex: number+}) {+ const { t } = useTranslation()+ return (+ <SearchInput+ value={value}+ onValueChange={onValueChange}+ placeholder={t('admin.settings_page.search_placeholder')}+ aria-label={t('admin.settings_page.search_placeholder')}+ clearLabel={t('admin.common.clear')}+ tabIndex={tabIndex}+ className="h-8 text-sm in-data-[mobile=true]:h-11 in-data-[mobile=true]:text-base"+ />+ )+}+/** Search box plus grouped entries — shared by the desktop aside and the sheet. */function SettingsNavBody({tabIndex,onNavigate,tenantId,+ query: controlledQuery,+ onQueryChange,+ renderSearch = true,}: {tabIndex: number/** Called when an entry is tapped — closes the mobile sheet. */onNavigate?: () => void/** See `SettingsSidebar` — a seller id on the marketplace panel. */tenantId?: string+ /**+ * Controlled query, passed by the desktop rail whose search box sits in the+ * header above this body. The sheet leaves both unset and keeps its own+ * state, since its search scrolls with the list.+ */+ query?: string+ onQueryChange?: (next: string) => void+ /** False when the caller renders the search box itself (the desktop rail). */+ renderSearch?: boolean}) {const { t } = useTranslation()const { storeId } = useParams({ strict: false }) as { storeId?: string }const id = tenantId ?? storeId ?? 'default'const snapshot = useSettingsNav()const { permissions } = usePermissions()- const [query, setQuery] = useState('')+ const [uncontrolledQuery, setUncontrolledQuery] = useState('')+ const query = controlledQuery ?? uncontrolledQuery+ const setQuery = onQueryChange ?? setUncontrolledQuery// Permission filtering depends only on the snapshot, so it survives typing.const allowed = useMemo(() => filterSettingsByPermissions(snapshot, permissions),@@ -230,22 +298,16 @@ function SettingsNavBody({// biome-ignore lint/a11y/noStaticElementInteractions: delegated link taps only// biome-ignore lint/a11y/useKeyWithClickEvents: links keep their own keyboard behaviour<div- className="flex flex-col gap-2 py-2"+ className={cn('flex flex-col gap-2 pb-2', renderSearch && 'pt-2')}onClick={(event) => {if ((event.target as HTMLElement).closest('a')) onNavigate?.()}}>- <div className="px-2">- <SearchInput- value={query}- onValueChange={setQuery}- placeholder={t('admin.settings_page.search_placeholder')}- aria-label={t('admin.settings_page.search_placeholder')}- clearLabel={t('admin.common.clear')}- tabIndex={tabIndex}- className="h-8 text-sm in-data-[mobile=true]:h-11 in-data-[mobile=true]:text-base"- />- </div>+ {renderSearch && (+ <div className="px-2">+ <SettingsNavSearch value={query} onValueChange={setQuery} tabIndex={tabIndex} />+ </div>+ )}{visible.groups.length === 0 && (<p className="px-4 py-2 text-sm text-sidebar-foreground/70">diff --git a/packages/dashboard-ui/package.json b/packages/dashboard-ui/package.jsonindex 8d2d766b73..f08e9c87d9 100644--- a/packages/dashboard-ui/package.json+++ b/packages/dashboard-ui/package.json@@ -77,7 +77,7 @@"react-colorful": "^5.7.0","react-day-picker": "^9.14.0","recharts": "^3.8.1",- "shadcn": "^4.7.0",+ "shadcn": "^4.21.0","tailwind-merge": "^3.5.0","tw-animate-css": "^1.4.0"},diff --git a/packages/dashboard/package.json b/packages/dashboard/package.jsonindex 3317a47de1..1a07aa6549 100644--- a/packages/dashboard/package.json+++ b/packages/dashboard/package.json@@ -102,7 +102,7 @@"@types/react-dom": "^19.2.3","@types/spark-md5": "^3.0.5","@vitejs/plugin-react": "^6.0.1",- "shadcn": "^4.7.0",+ "shadcn": "^4.21.0","tailwindcss": "^4.2.4","tsup": "^8.5.1","typescript": "~6.0.3",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 3fe6d474e5..7d0a025bbe 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -312,8 +312,8 @@ importers:specifier: ^6.0.1version: 6.0.1([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))shadcn:- specifier: ^4.7.0- version: 4.7.0(@types/[email protected])([email protected])+ specifier: ^4.21.0+ version: 4.21.0([email protected])tailwindcss:specifier: ^4.2.4version: 4.2.4@@ -603,8 +603,8 @@ importers:specifier: ^3.8.1version: 3.8.1(@types/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])shadcn:- specifier: ^4.7.0- version: 4.7.0(@types/[email protected])([email protected])+ specifier: ^4.21.0+ version: 4.21.0([email protected])tailwind-merge:specifier: ^3.5.0version: 3.5.0@@ -2563,10 +2563,6 @@ packages:engines: {node: '>=0.4.0'}hasBin: true- resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==}- engines: {node: '>= 14'}-resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}peerDependencies:@@ -2745,6 +2741,11 @@ packages:react: ^18 || ^19 || ^19.0.0-rcreact-dom: ^18 || ^19 || ^19.0.0-rc+ resolution: {integrity: sha512-+i4L0zUGgRcEnhsxueVrP7iBGxBx5iD0WOTYg1MwFEu2ZyCmH5Ov2V1cul2Ht5UchRQQgftCf4be/RxspuW6QQ==}+ engines: {node: '>=20'}+ hasBin: true+resolution: {integrity: sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==}@@ -2876,10 +2877,6 @@ packages:resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==}engines: {node: '>=12'}- resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}- engines: {node: '>= 12'}-resolution: {integrity: sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==}@@ -3116,10 +3113,6 @@ packages:picomatch:optional: true- resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==}- engines: {node: ^12.20 || >= 14.13}-resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==}engines: {node: '>=18'}@@ -3142,10 +3135,6 @@ packages:resolution: {integrity: sha512-kd+MNXviFIg5hijH766tt+3x76ele1AXlo4zDdCxIvqWZhKt4T83bOtxUOOMlTx/EcFdUMH5yvQgYlFh1EqqFg==}- resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==}- engines: {node: '>=12.20.0'}-resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}engines: {node: '>= 0.6'}@@ -3276,10 +3265,6 @@ packages:resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}engines: {node: '>= 0.8'}- resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}- engines: {node: '>= 14'}-resolution: {integrity: sha512-tsYlhAYpjCKa//8rXZ9DqKEawhPoSytweBC2eNvcaDK+57RZLHGqNs3PZTQO6yekLFSuvA6AlnAfrw1uBvtb+Q==}hasBin: true@@ -3329,6 +3314,10 @@ packages:resolution: {integrity: sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==}engines: {node: '>= 12'}+ resolution: {integrity: sha512-BGFsyJd5mpXp3rK6jIdADLNgpJUK1jnjzvYF8lK+VyDab9JAmqN0YOKDdP17HlgKb2+ehPgDc8EtnRLbGCAMhA==}+ engines: {node: '>= 12'}+resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}engines: {node: '>= 0.10'}@@ -3720,11 +3709,6 @@ packages:react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rcreact-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc- resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}- engines: {node: '>=10.5.0'}- deprecated: Use your platform's native DOMException instead-resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==}engines: {node: 4.x || >=6.0.0}@@ -3734,10 +3718,6 @@ packages:encoding:optional: true- resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==}- engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}-resolution: {integrity: sha512-mIrE/Cw9y+9Au6dS5vDKDhQza9YvG6w+ZrS6X+ZzA7yFW/soAeaups4Qzn1bL6g5FVy8WtP79+0j82oPIbqRjQ==}engines: {node: '>=18'}@@ -4241,8 +4221,9 @@ packages:resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}- resolution: {integrity: sha512-70fwnesNrY1GgeD7Kdzn+3SsYeyfibm8immsA5L68+OusoPTvYF01oWExl8/latKpMpvVXcbgdbbE6VFBJQ38w==}+ resolution: {integrity: sha512-UU2mFNusW8C5rvadKdH69vERYZqUlOOlXBcf0MYhYLdTGP6DPti7X4qovCu+RTfCqsAgq/T+YfE0Vnttxh9aiw==}+ engines: {node: '>=20.18.1'}hasBin: true@@ -4289,6 +4270,14 @@ packages:resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}engines: {node: '>=8'}+ resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==}+ engines: {node: '>= 6.0.0', npm: '>= 3.0.0'}++ resolution: {integrity: sha512-e0VyvkVTwVYViNovRkZ9aodhxVlyoMn7eJhVUPxZ+eK9P/7CBkxvvsBOHqFPEH416726W8tLXXXjKwqgTErrCQ==}+ engines: {node: '>= 10.0.0', npm: '>= 3.0.0'}+resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}engines: {node: '>=0.10.0'}@@ -4515,6 +4504,10 @@ packages:resolution: {integrity: sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==}+ resolution: {integrity: sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==}+ engines: {node: '>=20.18.1'}+resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==}engines: {node: '>=18'}@@ -4674,10 +4667,6 @@ packages:resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}- resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}- engines: {node: '>= 8'}-resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}@@ -6406,8 +6395,6 @@ snapshots:- [email protected]: {}-optionalDependencies:ajv: 8.20.0@@ -6588,6 +6575,8 @@ snapshots:- '@types/react'- '@types/react-dom'+ [email protected]: {}+@@ -6688,8 +6677,6 @@ snapshots:- [email protected]: {}-@@ -6940,11 +6927,6 @@ snapshots:optionalDependencies:picomatch: 4.0.4- dependencies:- node-domexception: 1.0.0- web-streams-polyfill: 3.3.3-dependencies:is-unicode-supported: 2.1.0@@ -6977,10 +6959,6 @@ snapshots:- dependencies:- fetch-blob: 3.2.0-@@ -7104,13 +7082,6 @@ snapshots:statuses: 2.0.2toidentifier: 1.0.1- dependencies:- agent-base: 7.1.4- debug: 4.4.3- transitivePeerDependencies:- - supports-color-@@ -7142,6 +7113,8 @@ snapshots:+ [email protected]: {}+@@ -7459,18 +7432,10 @@ snapshots:react: 19.2.6react-dom: 19.2.6([email protected])- [email protected]: {}-dependencies:whatwg-url: 5.0.0- dependencies:- data-uri-to-buffer: 4.0.1- fetch-blob: 3.2.0- formdata-polyfill: 4.0.10-@@ -8008,7 +7973,7 @@ snapshots:dependencies:'@babel/core': 7.29.0'@babel/parser': 7.29.3@@ -8018,6 +7983,7 @@ snapshots:'@modelcontextprotocol/sdk': 1.29.0([email protected])'@types/validate-npm-package-name': 4.0.2browserslist: 4.28.9+ cn: 0.2.6commander: 14.0.3cosmiconfig: 9.0.1([email protected])dedent: 1.7.2@@ -8027,26 +7993,23 @@ snapshots:fast-glob: 3.3.3fs-extra: 11.3.5fuzzysort: 3.1.0- https-proxy-agent: 7.0.6kleur: 4.1.5- msw: 2.14.3(@types/[email protected])([email protected])- node-fetch: 3.3.2open: 11.0.0ora: 8.2.0postcss: 8.5.26postcss-selector-parser: 7.1.6prompts: 2.4.2recast: 0.23.11+ socks: 2.8.10stringify-object: 5.0.0- tailwind-merge: 3.5.0ts-morph: 26.0.0tsconfig-paths: 4.2.0+ undici: 7.29.1validate-npm-package-name: 7.0.2zod: 3.25.76zod-to-json-schema: 3.25.2([email protected])transitivePeerDependencies:- '@cfworker/json-schema'- - '@types/node'- babel-plugin-macros- supports-color- typescript@@ -8097,6 +8060,13 @@ snapshots:+ [email protected]: {}++ dependencies:+ ip-address: 10.7.0+ smart-buffer: 4.2.0+@@ -8311,6 +8281,8 @@ snapshots:+ [email protected]: {}+@@ -8422,8 +8394,6 @@ snapshots:- [email protected]: {}-