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:
5
.changeset/shaggy-gifts-grow.md
Normal file
5
.changeset/shaggy-gifts-grow.md
Normal file
@@ -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"),
|
||||
to: "/settings/sales-channels",
|
||||
},
|
||||
{
|
||||
label: t("shippingOptionTypes.domain"),
|
||||
to: "/settings/shipping-option-types",
|
||||
},
|
||||
{
|
||||
label: t("productTypes.domain"),
|
||||
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",
|
||||
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",
|
||||
errorElement: <ErrorBoundary />,
|
||||
|
||||
@@ -5934,9 +5934,22 @@
|
||||
},
|
||||
"required": ["label", "description"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"shippingOptionTypes": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["label", "description"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": ["header", "shippingProfiles"],
|
||||
"required": ["header", "shippingProfiles", "shippingOptionTypes"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"salesChannels": {
|
||||
|
||||
@@ -1567,6 +1567,10 @@
|
||||
"shippingProfiles": {
|
||||
"label": "Shipping Profiles",
|
||||
"description": "Group products by shipping requirements"
|
||||
},
|
||||
"shippingOptionTypes": {
|
||||
"label": "Shipping Option Types",
|
||||
"description": "Group shipping options by types"
|
||||
}
|
||||
},
|
||||
"salesChannels": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ShoppingBag } from "@medusajs/icons"
|
||||
import { ShoppingBag, TruckFast } from "@medusajs/icons"
|
||||
import { Container, Heading } from "@medusajs/ui"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useLoaderData } from "react-router-dom"
|
||||
@@ -77,6 +77,14 @@ const LinksSection = () => {
|
||||
)}
|
||||
icon={<ShoppingBag />}
|
||||
/>
|
||||
<SidebarLink
|
||||
to="/settings/locations/shipping-option-types"
|
||||
labelKey={t("stockLocations.sidebar.shippingOptionTypes.label")}
|
||||
descriptionKey={t(
|
||||
"stockLocations.sidebar.shippingOptionTypes.description"
|
||||
)}
|
||||
icon={<TruckFast />}
|
||||
/>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,9 @@ export const useDeleteShippingOptionTypeAction = (
|
||||
|
||||
await mutateAsync(undefined, {
|
||||
onSuccess: () => {
|
||||
navigate("/settings/shipping-option-types", { replace: true })
|
||||
navigate("/settings/locations/shipping-option-types", {
|
||||
replace: true,
|
||||
})
|
||||
toast.success(t("shippingOptionTypes.delete.successToast", { label }))
|
||||
},
|
||||
onError: (e) => {
|
||||
|
||||
@@ -48,7 +48,7 @@ export const CreateShippingOptionTypeForm = () => {
|
||||
)
|
||||
|
||||
handleSuccess(
|
||||
`/settings/shipping-option-types/${shipping_option_type.id}`
|
||||
`/settings/locations/shipping-option-types/${shipping_option_type.id}`
|
||||
)
|
||||
},
|
||||
onError: (e) => {
|
||||
|
||||
@@ -49,7 +49,7 @@ export const EditShippingOptionTypeForm = ({
|
||||
onSuccess: ({ shipping_option_type }) => {
|
||||
toast.success(
|
||||
t("shippingOptionTypes.edit.successToast", {
|
||||
value: shipping_option_type.label,
|
||||
label: shipping_option_type.label,
|
||||
})
|
||||
)
|
||||
handleSuccess()
|
||||
|
||||
@@ -25,7 +25,7 @@ export const ShippingOptionTypeRowActions = ({
|
||||
{
|
||||
label: t("actions.edit"),
|
||||
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