Migrate voucher channel listings to new inputs (#3742)

This commit is contained in:
Michał Droń 2023-06-29 10:03:36 +02:00 committed by GitHub
parent 6640294078
commit d3791b6a23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 14 deletions

View file

@ -7,7 +7,6 @@ import ResponsiveTable from "@dashboard/components/ResponsiveTable";
import Skeleton from "@dashboard/components/Skeleton";
import TableHead from "@dashboard/components/TableHead";
import TableRowLink from "@dashboard/components/TableRowLink";
import TextFieldWithChoice from "@dashboard/components/TextFieldWithChoice";
import { ChannelInput } from "@dashboard/discounts/handlers";
import { DiscountTypeEnum } from "@dashboard/discounts/types";
import { DiscountErrorFragment } from "@dashboard/graphql";
@ -21,6 +20,7 @@ import {
TableCell,
Typography,
} from "@material-ui/core";
import { Input, Text } from "@saleor/macaw-ui/next";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
@ -100,22 +100,21 @@ const VoucherValue: React.FC<VoucherValueProps> = props => {
return (
<TableRowLink key={listing?.id || `skeleton-${index}`}>
<TableCell>
<Typography>{listing?.name || <Skeleton />}</Typography>
<Text>{listing?.name || <Skeleton />}</Text>
</TableCell>
<TableCell className={classes.colPrice}>
{listing ? (
<TextFieldWithChoice
<Input
disabled={disabled}
error={!!error?.length}
ChoiceProps={{
label:
data.discountType ===
endAdornment={
<Text variant="caption">
{data.discountType ===
DiscountTypeEnum.VALUE_FIXED
? listing.currency
: "%",
name: "discountType" as keyof FormData,
values: null,
}}
: "%"}
</Text>
}
helperText={
error
? getDiscountErrorMessage(
@ -136,10 +135,6 @@ const VoucherValue: React.FC<VoucherValueProps> = props => {
})}
value={listing.discountValue || ""}
type="number"
fullWidth
inputProps={{
min: 0,
}}
/>
) : (
<Skeleton />

View file

@ -9,6 +9,8 @@ export const useStyles = makeStyles(
},
colPrice: {
minWidth: 300,
paddingTop: 12,
paddingBottom: 12,
},
colType: {
fontSize: 14,