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:
William Bouchard
2025-08-28 09:31:51 -04:00
committed by GitHub
parent e2213448ac
commit 65dfcf9be4
10 changed files with 92 additions and 63 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
chore(dashboard): move shipping option type page

View File

@@ -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",

View File

@@ -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 />,

View File

@@ -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": {

View File

@@ -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": {

View File

@@ -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>
)
}

View File

@@ -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) => {

View File

@@ -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) => {

View File

@@ -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()

View File

@@ -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`,
},
],
},