Migrate voucher channel listings to new inputs (#3742)
This commit is contained in:
parent
6640294078
commit
d3791b6a23
2 changed files with 11 additions and 14 deletions
|
@ -7,7 +7,6 @@ import ResponsiveTable from "@dashboard/components/ResponsiveTable";
|
||||||
import Skeleton from "@dashboard/components/Skeleton";
|
import Skeleton from "@dashboard/components/Skeleton";
|
||||||
import TableHead from "@dashboard/components/TableHead";
|
import TableHead from "@dashboard/components/TableHead";
|
||||||
import TableRowLink from "@dashboard/components/TableRowLink";
|
import TableRowLink from "@dashboard/components/TableRowLink";
|
||||||
import TextFieldWithChoice from "@dashboard/components/TextFieldWithChoice";
|
|
||||||
import { ChannelInput } from "@dashboard/discounts/handlers";
|
import { ChannelInput } from "@dashboard/discounts/handlers";
|
||||||
import { DiscountTypeEnum } from "@dashboard/discounts/types";
|
import { DiscountTypeEnum } from "@dashboard/discounts/types";
|
||||||
import { DiscountErrorFragment } from "@dashboard/graphql";
|
import { DiscountErrorFragment } from "@dashboard/graphql";
|
||||||
|
@ -21,6 +20,7 @@ import {
|
||||||
TableCell,
|
TableCell,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
|
import { Input, Text } from "@saleor/macaw-ui/next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { FormattedMessage, useIntl } from "react-intl";
|
||||||
|
|
||||||
|
@ -100,22 +100,21 @@ const VoucherValue: React.FC<VoucherValueProps> = props => {
|
||||||
return (
|
return (
|
||||||
<TableRowLink key={listing?.id || `skeleton-${index}`}>
|
<TableRowLink key={listing?.id || `skeleton-${index}`}>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Typography>{listing?.name || <Skeleton />}</Typography>
|
<Text>{listing?.name || <Skeleton />}</Text>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colPrice}>
|
<TableCell className={classes.colPrice}>
|
||||||
{listing ? (
|
{listing ? (
|
||||||
<TextFieldWithChoice
|
<Input
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
error={!!error?.length}
|
error={!!error?.length}
|
||||||
ChoiceProps={{
|
endAdornment={
|
||||||
label:
|
<Text variant="caption">
|
||||||
data.discountType ===
|
{data.discountType ===
|
||||||
DiscountTypeEnum.VALUE_FIXED
|
DiscountTypeEnum.VALUE_FIXED
|
||||||
? listing.currency
|
? listing.currency
|
||||||
: "%",
|
: "%"}
|
||||||
name: "discountType" as keyof FormData,
|
</Text>
|
||||||
values: null,
|
}
|
||||||
}}
|
|
||||||
helperText={
|
helperText={
|
||||||
error
|
error
|
||||||
? getDiscountErrorMessage(
|
? getDiscountErrorMessage(
|
||||||
|
@ -136,10 +135,6 @@ const VoucherValue: React.FC<VoucherValueProps> = props => {
|
||||||
})}
|
})}
|
||||||
value={listing.discountValue || ""}
|
value={listing.discountValue || ""}
|
||||||
type="number"
|
type="number"
|
||||||
fullWidth
|
|
||||||
inputProps={{
|
|
||||||
min: 0,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
|
|
|
@ -9,6 +9,8 @@ export const useStyles = makeStyles(
|
||||||
},
|
},
|
||||||
colPrice: {
|
colPrice: {
|
||||||
minWidth: 300,
|
minWidth: 300,
|
||||||
|
paddingTop: 12,
|
||||||
|
paddingBottom: 12,
|
||||||
},
|
},
|
||||||
colType: {
|
colType: {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
|
Loading…
Reference in a new issue