import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import Typography from "@material-ui/core/Typography"; import React from "react"; import CardSpacer from "@saleor/components/CardSpacer"; import CardTitle from "@saleor/components/CardTitle"; import Date from "@saleor/components/Date"; import FormSpacer from "@saleor/components/FormSpacer"; import Hr from "@saleor/components/Hr"; import Money from "@saleor/components/Money"; import Percent from "@saleor/components/Percent"; import Skeleton from "@saleor/components/Skeleton"; import i18n from "../../../i18n"; import { maybe } from "../../../misc"; import { DiscountValueTypeEnum } from "../../../types/globalTypes"; import { translateVoucherTypes } from "../../translations"; import { VoucherDetails_voucher } from "../../types/VoucherDetails"; export interface VoucherSummaryProps { defaultCurrency: string; voucher: VoucherDetails_voucher; } const VoucherSummary: React.StatelessComponent = ({ defaultCurrency, voucher }) => { const translatedVoucherTypes = translateVoucherTypes(); return ( {i18n.t("Code")} {maybe(() => voucher.code, )} {i18n.t("Applies to")} {maybe( () => translatedVoucherTypes[voucher.type], )} {i18n.t("Value")} {maybe( () => voucher.discountValueType === DiscountValueTypeEnum.FIXED ? ( ) : ( ), )}
{i18n.t("Start Date")} {maybe( () => ( ), )} {i18n.t("End Date")} {maybe( () => voucher.endDate === null ? ( "-" ) : ( ), )}
{i18n.t("Min. Order Value")} {maybe( () => voucher.minAmountSpent ? ( ) : ( "-" ), )} {i18n.t("Usage Limit")} {maybe( () => (voucher.usageLimit === null ? "-" : voucher.usageLimit), )}
); }; VoucherSummary.displayName = "VoucherSummary"; export default VoucherSummary;