From 55d5a5f447f89fbd54dc9a671b6f564a260c6fe1 Mon Sep 17 00:00:00 2001 From: Wojciech Mista Date: Wed, 11 Sep 2024 15:55:01 +0200 Subject: [PATCH] Fix link in shipping destination alert box (#5148) * fix shipping alert box link * fix url * fix link * remove urljoin * fix test --------- Co-authored-by: Patryk Andrzejewski --- .changeset/olive-spies-camp.md | 5 +++++ .../OrderDraftPage/OrderDraftAlert.test.tsx | 4 ++++ .../components/OrderDraftPage/OrderDraftAlert.tsx | 15 ++++++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .changeset/olive-spies-camp.md diff --git a/.changeset/olive-spies-camp.md b/.changeset/olive-spies-camp.md new file mode 100644 index 00000000000..f2e4f95b25c --- /dev/null +++ b/.changeset/olive-spies-camp.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Shipping destination alert when creating a new order now has a correct link to shipping settings. diff --git a/src/orders/components/OrderDraftPage/OrderDraftAlert.test.tsx b/src/orders/components/OrderDraftPage/OrderDraftAlert.test.tsx index 58bdb81d4d9..c257460943b 100644 --- a/src/orders/components/OrderDraftPage/OrderDraftAlert.test.tsx +++ b/src/orders/components/OrderDraftPage/OrderDraftAlert.test.tsx @@ -6,6 +6,10 @@ import * as React from "react"; import OrderDraftAlert, { OrderDraftAlertProps } from "./OrderDraftAlert"; +jest.mock("react-router-dom", () => ({ + Link: jest.fn(({ to, ...props }) => ), +})); + describe("OrderDraftAlert", () => { const alertProps: OrderDraftAlertProps = { order: order("--url--"), diff --git a/src/orders/components/OrderDraftPage/OrderDraftAlert.tsx b/src/orders/components/OrderDraftPage/OrderDraftAlert.tsx index 55009ae68ba..e11cdfd959d 100644 --- a/src/orders/components/OrderDraftPage/OrderDraftAlert.tsx +++ b/src/orders/components/OrderDraftPage/OrderDraftAlert.tsx @@ -1,9 +1,11 @@ import { ChannelUsabilityDataQuery, OrderDetailsFragment } from "@dashboard/graphql"; +import { shippingZonesListPath } from "@dashboard/shipping/urls"; import { Alert, AlertProps } from "@saleor/macaw-ui"; -import { Box } from "@saleor/macaw-ui-next"; +import { sprinkles } from "@saleor/macaw-ui-next"; import clsx from "clsx"; import React from "react"; import { FormattedMessage, MessageDescriptor, useIntl } from "react-intl"; +import { Link } from "react-router-dom"; import OrderAlerts from "../OrderAlerts"; import { alertMessages } from "./messages"; @@ -65,13 +67,20 @@ const OrderDraftAlert: React.FC = props => { values={{ country: order?.shippingAddress?.country.country, configLink: ( - + - + ), }} />