Skip to content

Commit 65dfcf9

Browse files
authored
chore(dashboard): move shipping option type page (#13323)
* chore(dashboard): move shipping option type page * small issue with the toast for edit
1 parent e221344 commit 65dfcf9

File tree

10 files changed

+92
-63
lines changed

10 files changed

+92
-63
lines changed

.changeset/shaggy-gifts-grow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/dashboard": patch
3+
---
4+
5+
chore(dashboard): move shipping option type page

packages/admin/dashboard/src/components/layout/settings-layout/settings-layout.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ const useSettingRoutes = (): INavItem[] => {
4747
label: t("salesChannels.domain"),
4848
to: "/settings/sales-channels",
4949
},
50-
{
51-
label: t("shippingOptionTypes.domain"),
52-
to: "/settings/shipping-option-types",
53-
},
5450
{
5551
label: t("productTypes.domain"),
5652
to: "/settings/product-types",

packages/admin/dashboard/src/dashboard-app/routes/get-route.map.tsx

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,60 @@ export function getRouteMap({
11831183
},
11841184
],
11851185
},
1186+
{
1187+
path: "shipping-option-types",
1188+
errorElement: <ErrorBoundary />,
1189+
element: <Outlet />,
1190+
handle: {
1191+
breadcrumb: () => t("shippingOptionTypes.domain"),
1192+
},
1193+
children: [
1194+
{
1195+
path: "",
1196+
lazy: () =>
1197+
import(
1198+
"../../routes/shipping-option-types/shipping-option-type-list"
1199+
),
1200+
children: [
1201+
{
1202+
path: "create",
1203+
lazy: () =>
1204+
import(
1205+
"../../routes/shipping-option-types/shipping-option-type-create"
1206+
),
1207+
},
1208+
],
1209+
},
1210+
{
1211+
path: ":id",
1212+
lazy: async () => {
1213+
const { Component, Breadcrumb, loader } = await import(
1214+
"../../routes/shipping-option-types/shipping-option-type-detail"
1215+
)
1216+
1217+
return {
1218+
Component,
1219+
loader,
1220+
handle: {
1221+
breadcrumb: (
1222+
// eslint-disable-next-line max-len
1223+
match: UIMatch<HttpTypes.AdminShippingOptionTypeResponse>
1224+
) => <Breadcrumb {...match} />,
1225+
},
1226+
}
1227+
},
1228+
children: [
1229+
{
1230+
path: "edit",
1231+
lazy: () =>
1232+
import(
1233+
"../../routes/shipping-option-types/shipping-option-type-edit"
1234+
),
1235+
},
1236+
],
1237+
},
1238+
],
1239+
},
11861240
{
11871241
path: ":location_id",
11881242
lazy: async () => {
@@ -1376,59 +1430,6 @@ export function getRouteMap({
13761430
},
13771431
],
13781432
},
1379-
{
1380-
path: "shipping-option-types",
1381-
errorElement: <ErrorBoundary />,
1382-
element: <Outlet />,
1383-
handle: {
1384-
breadcrumb: () => t("shippingOptionTypes.domain"),
1385-
},
1386-
children: [
1387-
{
1388-
path: "",
1389-
lazy: () =>
1390-
import(
1391-
"../../routes/shipping-option-types/shipping-option-type-list"
1392-
),
1393-
children: [
1394-
{
1395-
path: "create",
1396-
lazy: () =>
1397-
import(
1398-
"../../routes/shipping-option-types/shipping-option-type-create"
1399-
),
1400-
},
1401-
],
1402-
},
1403-
{
1404-
path: ":id",
1405-
lazy: async () => {
1406-
const { Component, Breadcrumb, loader } = await import(
1407-
"../../routes/shipping-option-types/shipping-option-type-detail"
1408-
)
1409-
1410-
return {
1411-
Component,
1412-
loader,
1413-
handle: {
1414-
breadcrumb: (
1415-
match: UIMatch<HttpTypes.AdminShippingOptionTypeResponse>
1416-
) => <Breadcrumb {...match} />,
1417-
},
1418-
}
1419-
},
1420-
children: [
1421-
{
1422-
path: "edit",
1423-
lazy: () =>
1424-
import(
1425-
"../../routes/shipping-option-types/shipping-option-type-edit"
1426-
),
1427-
},
1428-
],
1429-
},
1430-
],
1431-
},
14321433
{
14331434
path: "product-types",
14341435
errorElement: <ErrorBoundary />,

packages/admin/dashboard/src/i18n/translations/$schema.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5934,9 +5934,22 @@
59345934
},
59355935
"required": ["label", "description"],
59365936
"additionalProperties": false
5937+
},
5938+
"shippingOptionTypes": {
5939+
"type": "object",
5940+
"properties": {
5941+
"label": {
5942+
"type": "string"
5943+
},
5944+
"description": {
5945+
"type": "string"
5946+
}
5947+
},
5948+
"required": ["label", "description"],
5949+
"additionalProperties": false
59375950
}
59385951
},
5939-
"required": ["header", "shippingProfiles"],
5952+
"required": ["header", "shippingProfiles", "shippingOptionTypes"],
59405953
"additionalProperties": false
59415954
},
59425955
"salesChannels": {

packages/admin/dashboard/src/i18n/translations/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,10 @@
15671567
"shippingProfiles": {
15681568
"label": "Shipping Profiles",
15691569
"description": "Group products by shipping requirements"
1570+
},
1571+
"shippingOptionTypes": {
1572+
"label": "Shipping Option Types",
1573+
"description": "Group shipping options by types"
15701574
}
15711575
},
15721576
"salesChannels": {

packages/admin/dashboard/src/routes/locations/location-list/location-list.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ShoppingBag } from "@medusajs/icons"
1+
import { ShoppingBag, TruckFast } from "@medusajs/icons"
22
import { Container, Heading } from "@medusajs/ui"
33
import { useTranslation } from "react-i18next"
44
import { useLoaderData } from "react-router-dom"
@@ -77,6 +77,14 @@ const LinksSection = () => {
7777
)}
7878
icon={<ShoppingBag />}
7979
/>
80+
<SidebarLink
81+
to="/settings/locations/shipping-option-types"
82+
labelKey={t("stockLocations.sidebar.shippingOptionTypes.label")}
83+
descriptionKey={t(
84+
"stockLocations.sidebar.shippingOptionTypes.description"
85+
)}
86+
icon={<TruckFast />}
87+
/>
8088
</Container>
8189
)
8290
}

packages/admin/dashboard/src/routes/shipping-option-types/common/hooks/use-delete-shipping-option-type-action.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export const useDeleteShippingOptionTypeAction = (
2828

2929
await mutateAsync(undefined, {
3030
onSuccess: () => {
31-
navigate("/settings/shipping-option-types", { replace: true })
31+
navigate("/settings/locations/shipping-option-types", {
32+
replace: true,
33+
})
3234
toast.success(t("shippingOptionTypes.delete.successToast", { label }))
3335
},
3436
onError: (e) => {

packages/admin/dashboard/src/routes/shipping-option-types/shipping-option-type-create/components/create-shipping-option-type-form/create-shipping-option-type-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const CreateShippingOptionTypeForm = () => {
4848
)
4949

5050
handleSuccess(
51-
`/settings/shipping-option-types/${shipping_option_type.id}`
51+
`/settings/locations/shipping-option-types/${shipping_option_type.id}`
5252
)
5353
},
5454
onError: (e) => {

packages/admin/dashboard/src/routes/shipping-option-types/shipping-option-type-edit/components/edit-shipping-option-type-form/edit-shipping-option-type-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const EditShippingOptionTypeForm = ({
4949
onSuccess: ({ shipping_option_type }) => {
5050
toast.success(
5151
t("shippingOptionTypes.edit.successToast", {
52-
value: shipping_option_type.label,
52+
label: shipping_option_type.label,
5353
})
5454
)
5555
handleSuccess()

packages/admin/dashboard/src/routes/shipping-option-types/shipping-option-type-list/components/shipping-option-type-list-table/shipping-option-type-table-row-actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const ShippingOptionTypeRowActions = ({
2525
{
2626
label: t("actions.edit"),
2727
icon: <PencilSquare />,
28-
to: `/settings/shipping-option-types/${shippingOptionType.id}/edit`,
28+
to: `/settings/locations/shipping-option-types/${shippingOptionType.id}/edit`,
2929
},
3030
],
3131
},

0 commit comments

Comments
 (0)