chore(dashboard): move shipping option type page (#13323)
* chore(dashboard): move shipping option type page * small issue with the toast for edit
This commit is contained in:
1 parent
e2213448ac
commit
65dfcf9be4
10 files changed
+92
-63
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore(dashboard): move shipping option type page
|
||||||
@@ -47,10 +47,6 @@ const useSettingRoutes = (): INavItem[] => {
|
|||||||
label: t("salesChannels.domain"),
|
label: t("salesChannels.domain"),
|
||||||
to: "/settings/sales-channels",
|
to: "/settings/sales-channels",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: t("shippingOptionTypes.domain"),
|
|
||||||
to: "/settings/shipping-option-types",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: t("productTypes.domain"),
|
label: t("productTypes.domain"),
|
||||||
to: "/settings/product-types",
|
to: "/settings/product-types",
|
||||||
|
|||||||
@@ -1183,6 +1183,60 @@ export function getRouteMap({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "shipping-option-types",
|
||||||
|
errorElement: <ErrorBoundary />,
|
||||||
|
element: <Outlet />,
|
||||||
|
handle: {
|
||||||
|
breadcrumb: () => t("shippingOptionTypes.domain"),
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "",
|
||||||
|
lazy: () =>
|
||||||
|
import(
|
||||||
|
"../../routes/shipping-option-types/shipping-option-type-list"
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "create",
|
||||||
|
lazy: () =>
|
||||||
|
import(
|
||||||
|
"../../routes/shipping-option-types/shipping-option-type-create"
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ":id",
|
||||||
|
lazy: async () => {
|
||||||
|
const { Component, Breadcrumb, loader } = await import(
|
||||||
|
"../../routes/shipping-option-types/shipping-option-type-detail"
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
Component,
|
||||||
|
loader,
|
||||||
|
handle: {
|
||||||
|
breadcrumb: (
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
match: UIMatch<HttpTypes.AdminShippingOptionTypeResponse>
|
||||||
|
) => <Breadcrumb {...match} />,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "edit",
|
||||||
|
lazy: () =>
|
||||||
|
import(
|
||||||
|
"../../routes/shipping-option-types/shipping-option-type-edit"
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: ":location_id",
|
path: ":location_id",
|
||||||
lazy: async () => {
|
lazy: async () => {
|
||||||
@@ -1376,59 +1430,6 @@ export function getRouteMap({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "shipping-option-types",
|
|
||||||
errorElement: <ErrorBoundary />,
|
|
||||||
element: <Outlet />,
|
|
||||||
handle: {
|
|
||||||
breadcrumb: () => t("shippingOptionTypes.domain"),
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "",
|
|
||||||
lazy: () =>
|
|
||||||
import(
|
|
||||||
"../../routes/shipping-option-types/shipping-option-type-list"
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "create",
|
|
||||||
lazy: () =>
|
|
||||||
import(
|
|
||||||
"../../routes/shipping-option-types/shipping-option-type-create"
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: ":id",
|
|
||||||
lazy: async () => {
|
|
||||||
const { Component, Breadcrumb, loader } = await import(
|
|
||||||
"../../routes/shipping-option-types/shipping-option-type-detail"
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
|
||||||
Component,
|
|
||||||
loader,
|
|
||||||
handle: {
|
|
||||||
breadcrumb: (
|
|
||||||
match: UIMatch<HttpTypes.AdminShippingOptionTypeResponse>
|
|
||||||
) => <Breadcrumb {...match} />,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "edit",
|
|
||||||
lazy: () =>
|
|
||||||
import(
|
|
||||||
"../../routes/shipping-option-types/shipping-option-type-edit"
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "product-types",
|
path: "product-types",
|
||||||
errorElement: <ErrorBoundary />,
|
errorElement: <ErrorBoundary />,
|
||||||
|
|||||||
@@ -5934,9 +5934,22 @@
|
|||||||
},
|
},
|
||||||
"required": ["label", "description"],
|
"required": ["label", "description"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"shippingOptionTypes": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"label": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["header", "shippingProfiles"],
|
"required": ["label", "description"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["header", "shippingProfiles", "shippingOptionTypes"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"salesChannels": {
|
"salesChannels": {
|
||||||
|
|||||||
@@ -1567,6 +1567,10 @@
|
|||||||
"shippingProfiles": {
|
"shippingProfiles": {
|
||||||
"label": "Shipping Profiles",
|
"label": "Shipping Profiles",
|
||||||
"description": "Group products by shipping requirements"
|
"description": "Group products by shipping requirements"
|
||||||
|
},
|
||||||
|
"shippingOptionTypes": {
|
||||||
|
"label": "Shipping Option Types",
|
||||||
|
"description": "Group shipping options by types"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"salesChannels": {
|
"salesChannels": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ShoppingBag } from "@medusajs/icons"
|
import { ShoppingBag, TruckFast } from "@medusajs/icons"
|
||||||
import { Container, Heading } from "@medusajs/ui"
|
import { Container, Heading } from "@medusajs/ui"
|
||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import { useLoaderData } from "react-router-dom"
|
import { useLoaderData } from "react-router-dom"
|
||||||
@@ -77,6 +77,14 @@ const LinksSection = () => {
|
|||||||
)}
|
)}
|
||||||
icon={<ShoppingBag />}
|
icon={<ShoppingBag />}
|
||||||
/>
|
/>
|
||||||
|
<SidebarLink
|
||||||
|
to="/settings/locations/shipping-option-types"
|
||||||
|
labelKey={t("stockLocations.sidebar.shippingOptionTypes.label")}
|
||||||
|
descriptionKey={t(
|
||||||
|
"stockLocations.sidebar.shippingOptionTypes.description"
|
||||||
|
)}
|
||||||
|
icon={<TruckFast />}
|
||||||
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+3
-1
@@ -28,7 +28,9 @@ export const useDeleteShippingOptionTypeAction = (
|
|||||||
|
|
||||||
await mutateAsync(undefined, {
|
await mutateAsync(undefined, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
navigate("/settings/shipping-option-types", { replace: true })
|
navigate("/settings/locations/shipping-option-types", {
|
||||||
|
replace: true,
|
||||||
|
})
|
||||||
toast.success(t("shippingOptionTypes.delete.successToast", { label }))
|
toast.success(t("shippingOptionTypes.delete.successToast", { label }))
|
||||||
},
|
},
|
||||||
onError: (e) => {
|
onError: (e) => {
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ export const CreateShippingOptionTypeForm = () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
handleSuccess(
|
handleSuccess(
|
||||||
`/settings/shipping-option-types/${shipping_option_type.id}`
|
`/settings/locations/shipping-option-types/${shipping_option_type.id}`
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onError: (e) => {
|
onError: (e) => {
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ export const EditShippingOptionTypeForm = ({
|
|||||||
onSuccess: ({ shipping_option_type }) => {
|
onSuccess: ({ shipping_option_type }) => {
|
||||||
toast.success(
|
toast.success(
|
||||||
t("shippingOptionTypes.edit.successToast", {
|
t("shippingOptionTypes.edit.successToast", {
|
||||||
value: shipping_option_type.label,
|
label: shipping_option_type.label,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
handleSuccess()
|
handleSuccess()
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ export const ShippingOptionTypeRowActions = ({
|
|||||||
{
|
{
|
||||||
label: t("actions.edit"),
|
label: t("actions.edit"),
|
||||||
icon: <PencilSquare />,
|
icon: <PencilSquare />,
|
||||||
to: `/settings/shipping-option-types/${shippingOptionType.id}/edit`,
|
to: `/settings/locations/shipping-option-types/${shippingOptionType.id}/edit`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user