Fix add product to order modal title & subtitle (#3337)
This commit is contained in:
parent
93c2459013
commit
d33db9f2f5
6 changed files with 35 additions and 7 deletions
|
@ -919,6 +919,10 @@
|
||||||
"context": "modal button",
|
"context": "modal button",
|
||||||
"string": "Upload URL"
|
"string": "Upload URL"
|
||||||
},
|
},
|
||||||
|
"4XhJY+": {
|
||||||
|
"context": "dialog header",
|
||||||
|
"string": "Add product from {channelName}"
|
||||||
|
},
|
||||||
"4Z0O2B": {
|
"4Z0O2B": {
|
||||||
"context": "section header title",
|
"context": "section header title",
|
||||||
"string": "Gift Card Timeline"
|
"string": "Gift Card Timeline"
|
||||||
|
@ -1524,10 +1528,6 @@
|
||||||
"context": "number of webhook headers in model",
|
"context": "number of webhook headers in model",
|
||||||
"string": "{number,plural,one{{number} header} other{{number} custom request headers}}"
|
"string": "{number,plural,one{{number} header} other{{number} custom request headers}}"
|
||||||
},
|
},
|
||||||
"9Y6vg+": {
|
|
||||||
"context": "dialog header",
|
|
||||||
"string": "Add product"
|
|
||||||
},
|
|
||||||
"9YazHG": {
|
"9YazHG": {
|
||||||
"string": "Company"
|
"string": "Company"
|
||||||
},
|
},
|
||||||
|
@ -4329,6 +4329,10 @@
|
||||||
"context": "orders section name",
|
"context": "orders section name",
|
||||||
"string": "Orders"
|
"string": "Orders"
|
||||||
},
|
},
|
||||||
|
"Taa5V7": {
|
||||||
|
"context": "dialog subtitle",
|
||||||
|
"string": "You can only add products available for the order's channel"
|
||||||
|
},
|
||||||
"Tenl9A": {
|
"Tenl9A": {
|
||||||
"context": "grant refund, refund card toggle",
|
"context": "grant refund, refund card toggle",
|
||||||
"string": "Refund shipment: {currency} {amount}"
|
"string": "Refund shipment: {currency} {amount}"
|
||||||
|
|
|
@ -29,6 +29,7 @@ import {
|
||||||
Typography,
|
Typography,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import { ConfirmButtonTransitionState } from "@saleor/macaw-ui";
|
import { ConfirmButtonTransitionState } from "@saleor/macaw-ui";
|
||||||
|
import { Text } from "@saleor/macaw-ui/next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import InfiniteScroll from "react-infinite-scroll-component";
|
import InfiniteScroll from "react-infinite-scroll-component";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
@ -53,6 +54,7 @@ export interface OrderProductAddDialogProps extends FetchMoreProps {
|
||||||
onSubmit: (
|
onSubmit: (
|
||||||
data: SearchOrderVariantQuery["search"]["edges"][0]["node"]["variants"],
|
data: SearchOrderVariantQuery["search"]["edges"][0]["node"]["variants"],
|
||||||
) => void;
|
) => void;
|
||||||
|
channelName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollableTargetId = "orderProductAddScrollableDialog";
|
const scrollableTargetId = "orderProductAddScrollableDialog";
|
||||||
|
@ -69,6 +71,7 @@ const OrderProductAddDialog: React.FC<OrderProductAddDialogProps> = props => {
|
||||||
onFetchMore,
|
onFetchMore,
|
||||||
onClose,
|
onClose,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
channelName,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const classes = useStyles(props);
|
const classes = useStyles(props);
|
||||||
|
@ -126,8 +129,18 @@ const OrderProductAddDialog: React.FC<OrderProductAddDialogProps> = props => {
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
>
|
>
|
||||||
<DialogTitle disableTypography>
|
<DialogTitle disableTypography>
|
||||||
<FormattedMessage {...messages.title} />
|
<FormattedMessage
|
||||||
|
{...messages.title}
|
||||||
|
values={{
|
||||||
|
channelName,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
|
<DialogContent className={classes.subtitle}>
|
||||||
|
<Text variant="caption" color="textNeutralSubdued">
|
||||||
|
<FormattedMessage {...messages.subtitle} />
|
||||||
|
</Text>
|
||||||
|
</DialogContent>
|
||||||
<DialogContent data-test-id="search-query">
|
<DialogContent data-test-id="search-query">
|
||||||
<TextField
|
<TextField
|
||||||
name="query"
|
name="query"
|
||||||
|
|
|
@ -2,9 +2,15 @@ import { defineMessages } from "react-intl";
|
||||||
|
|
||||||
export const messages = defineMessages({
|
export const messages = defineMessages({
|
||||||
title: {
|
title: {
|
||||||
defaultMessage: "Add product",
|
defaultMessage: "Add product from {channelName}",
|
||||||
description: "dialog header",
|
description: "dialog header",
|
||||||
id: "9Y6vg+",
|
id: "4XhJY+",
|
||||||
|
},
|
||||||
|
subtitle: {
|
||||||
|
defaultMessage:
|
||||||
|
"You can only add products available for the order's channel",
|
||||||
|
id: "Taa5V7",
|
||||||
|
description: "dialog subtitle",
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
defaultMessage: "Search products",
|
defaultMessage: "Search products",
|
||||||
|
|
|
@ -20,6 +20,9 @@ export const useStyles = makeStyles(
|
||||||
paddingTop: 0,
|
paddingTop: 0,
|
||||||
marginBottom: theme.spacing(3),
|
marginBottom: theme.spacing(3),
|
||||||
},
|
},
|
||||||
|
subtitle: {
|
||||||
|
padding: 0,
|
||||||
|
},
|
||||||
grayText: {
|
grayText: {
|
||||||
color: theme.palette.text.disabled,
|
color: theme.palette.text.disabled,
|
||||||
},
|
},
|
||||||
|
|
|
@ -293,6 +293,7 @@ export const OrderDraftDetails: React.FC<OrderDraftDetailsProps> = ({
|
||||||
onClose={closeModal}
|
onClose={closeModal}
|
||||||
onFetch={variantSearch}
|
onFetch={variantSearch}
|
||||||
onFetchMore={loadMore}
|
onFetchMore={loadMore}
|
||||||
|
channelName={order.channel.name}
|
||||||
onSubmit={variants =>
|
onSubmit={variants =>
|
||||||
extractMutationErrors(
|
extractMutationErrors(
|
||||||
orderLinesAdd.mutate({
|
orderLinesAdd.mutate({
|
||||||
|
|
|
@ -332,6 +332,7 @@ export const OrderUnconfirmedDetails: React.FC<
|
||||||
onClose={closeModal}
|
onClose={closeModal}
|
||||||
onFetch={variantSearch}
|
onFetch={variantSearch}
|
||||||
onFetchMore={loadMore}
|
onFetchMore={loadMore}
|
||||||
|
channelName={order.channel?.name}
|
||||||
onSubmit={variants =>
|
onSubmit={variants =>
|
||||||
orderLinesAdd.mutate({
|
orderLinesAdd.mutate({
|
||||||
id,
|
id,
|
||||||
|
|
Loading…
Reference in a new issue