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.

Add Stock tabs strip on /products/stock/* pages

Damian Legawiec337fe7fb12ad
diff --git a/packages/admin/src/routes/_authenticated/$storeId/products/stock/-tabs.tsx b/packages/admin/src/routes/_authenticated/$storeId/products/stock/-tabs.tsx
new file mode 100644
index 0000000000..3291902e2c
--- /dev/null
+++ b/packages/admin/src/routes/_authenticated/$storeId/products/stock/-tabs.tsx
@@ -0,0 +1,21 @@
+import { PageTabs } from '@/components/spree/page-tabs'
+
+// `-tabs.tsx` is excluded from TanStack Router's file-based routing
+// (the leading `-` marks it as a sibling utility file). New stock
+// views (items, movements) just append entries to this list.
+export function StockPageTabs({ storeId }: { storeId: string }) {
+ return (
+ <PageTabs
+ tabs={[
+ {
+ key: 'stock.transfers',
+ label: 'Transfers',
+ to: '/$storeId/products/stock/transfers',
+ params: { storeId },
+ match: 'prefix',
+ },
+ ]}
+ slotName="products.stock.tabs"
+ />
+ )
+}
diff --git a/packages/admin/src/routes/_authenticated/$storeId/products/stock/transfers.tsx b/packages/admin/src/routes/_authenticated/$storeId/products/stock/transfers.tsx
index 83aa894db6..8da7eb4e2f 100644
--- a/packages/admin/src/routes/_authenticated/$storeId/products/stock/transfers.tsx
+++ b/packages/admin/src/routes/_authenticated/$storeId/products/stock/transfers.tsx
@@ -38,6 +38,7 @@ import {
} from '@/hooks/use-stock-transfers'
import { Subject } from '@/lib/permissions'
import '@/tables/stock-transfers'
+import { StockPageTabs } from './-tabs'
const stockTransfersSearchSchema = resourceSearchSchema.extend({
view: z.string().optional(),
@@ -52,6 +53,7 @@ export const Route = createFileRoute('/_authenticated/$storeId/products/stock/tr
const SOURCE_NONE = '__external__'
function StockTransfersPage() {
+ const { storeId } = Route.useParams()
const search = Route.useSearch() as z.infer<typeof stockTransfersSearchSchema>
const navigate = useNavigate()
@@ -76,6 +78,7 @@ function StockTransfersPage() {
return (
<>
+ <StockPageTabs storeId={storeId} />
<ResourceTable<StockTransfer>
tableKey="stock-transfers"
queryKey="stock-transfers"