feat(dashboard): Setup V2 collections (#6935)
This commit is contained in:
1 parent
06b2f0a8dc
commit
6c6e5307cf
28 files changed
+58
-50
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import type {
|
||||
AdminCollectionsRes,
|
||||
AdminCustomerGroupsRes,
|
||||
AdminCustomersRes,
|
||||
AdminDiscountsRes,
|
||||
@@ -264,47 +263,6 @@ export const v1Routes: RouteObject[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/collections",
|
||||
handle: {
|
||||
crumb: () => "Collections",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
lazy: () => import("../../routes/collections/collection-list"),
|
||||
children: [
|
||||
{
|
||||
path: "create",
|
||||
lazy: () =>
|
||||
import("../../routes/collections/collection-create"),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: ":id",
|
||||
handle: {
|
||||
crumb: (data: AdminCollectionsRes) => data.collection.title,
|
||||
},
|
||||
lazy: () =>
|
||||
import("../../routes/collections/collection-detail"),
|
||||
children: [
|
||||
{
|
||||
path: "edit",
|
||||
lazy: () =>
|
||||
import("../../routes/collections/collection-edit"),
|
||||
},
|
||||
{
|
||||
path: "add-products",
|
||||
lazy: () =>
|
||||
import(
|
||||
"../../routes/collections/collection-add-products"
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/inventory",
|
||||
handle: {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { SettingsLayout } from "../../components/layout/settings-layout"
|
||||
import { Outlet } from "react-router-dom"
|
||||
|
||||
import { Spinner } from "@medusajs/icons"
|
||||
import { AdminCollectionsRes } from "@medusajs/medusa"
|
||||
import { SalesChannelDTO, UserDTO } from "@medusajs/types"
|
||||
import { ErrorBoundary } from "../../components/error/error-boundary"
|
||||
import { useV2Session } from "../../lib/api-v2"
|
||||
@@ -90,6 +91,48 @@ export const v2Routes: RouteObject[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/collections",
|
||||
handle: {
|
||||
crumb: () => "Collections",
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
lazy: () =>
|
||||
import("../../v2-routes/collections/collection-list"),
|
||||
children: [
|
||||
{
|
||||
path: "create",
|
||||
lazy: () =>
|
||||
import("../../v2-routes/collections/collection-create"),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: ":id",
|
||||
lazy: () =>
|
||||
import("../../v2-routes/collections/collection-detail"),
|
||||
handle: {
|
||||
crumb: (data: AdminCollectionsRes) => data.collection.title,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "edit",
|
||||
lazy: () =>
|
||||
import("../../v2-routes/collections/collection-edit"),
|
||||
},
|
||||
{
|
||||
path: "products",
|
||||
lazy: () =>
|
||||
import(
|
||||
"../../v2-routes/collections/collection-add-products"
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+15
-8
@@ -1,6 +1,6 @@
|
||||
import { PencilSquare, Trash } from "@medusajs/icons"
|
||||
import { PencilSquare, Plus, Trash } from "@medusajs/icons"
|
||||
import type { Product, ProductCollection } from "@medusajs/medusa"
|
||||
import { Button, Checkbox, Container, Heading, usePrompt } from "@medusajs/ui"
|
||||
import { Checkbox, Container, Heading, usePrompt } from "@medusajs/ui"
|
||||
import { createColumnHelper } from "@tanstack/react-table"
|
||||
import {
|
||||
adminProductKeys,
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
} from "medusa-react"
|
||||
import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Link } from "react-router-dom"
|
||||
import { ActionMenu } from "../../../../../components/common/action-menu"
|
||||
import { DataTable } from "../../../../../components/table/data-table"
|
||||
import { useProductTableColumns } from "../../../../../hooks/table/columns/use-product-table-columns"
|
||||
@@ -96,11 +95,19 @@ export const CollectionProductSection = ({
|
||||
<Container className="divide-y p-0">
|
||||
<div className="flex items-center justify-between px-6 py-4">
|
||||
<Heading level="h2">{t("products.domain")}</Heading>
|
||||
<Link to={`/collections/${collection.id}/add-products`}>
|
||||
<Button size="small" variant="secondary">
|
||||
{t("general.add")}
|
||||
</Button>
|
||||
</Link>
|
||||
<ActionMenu
|
||||
groups={[
|
||||
{
|
||||
actions: [
|
||||
{
|
||||
icon: <Plus />,
|
||||
label: t("actions.add"),
|
||||
to: "products",
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<DataTable
|
||||
table={table}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user