Drop maybe in favor of optional operator
This commit is contained in:
parent
dd3a000562
commit
49124e2014
1 changed files with 8 additions and 8 deletions
|
@ -19,7 +19,7 @@ import createNonNegativeValueChangeHandler from "@saleor/utils/handlers/nonNegat
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
|
|
||||||
import { maybe, renderCollection } from "../../../misc";
|
import { renderCollection } from "../../../misc";
|
||||||
import { OrderDetails_order_lines } from "../../types/OrderDetails";
|
import { OrderDetails_order_lines } from "../../types/OrderDetails";
|
||||||
|
|
||||||
export interface FormData {
|
export interface FormData {
|
||||||
|
@ -82,7 +82,7 @@ const OrderDraftDetailsProducts: React.FC<OrderDraftDetailsProductsProps> = prop
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ResponsiveTable className={classes.table}>
|
<ResponsiveTable className={classes.table}>
|
||||||
{maybe(() => !!lines.length) && (
|
{!!lines?.length && (
|
||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell className={classes.colName}>
|
<TableCell className={classes.colName}>
|
||||||
|
@ -113,7 +113,7 @@ const OrderDraftDetailsProducts: React.FC<OrderDraftDetailsProductsProps> = prop
|
||||||
</TableHead>
|
</TableHead>
|
||||||
)}
|
)}
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{maybe(() => lines.length) === 0 ? (
|
{lines?.length === 0 ? (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={5}>
|
<TableCell colSpan={5}>
|
||||||
<FormattedMessage defaultMessage="No Products added to Order" />
|
<FormattedMessage defaultMessage="No Products added to Order" />
|
||||||
|
@ -124,9 +124,9 @@ const OrderDraftDetailsProducts: React.FC<OrderDraftDetailsProductsProps> = prop
|
||||||
<TableRow key={line ? line.id : "skeleton"}>
|
<TableRow key={line ? line.id : "skeleton"}>
|
||||||
<TableCellAvatar
|
<TableCellAvatar
|
||||||
className={classes.colName}
|
className={classes.colName}
|
||||||
thumbnail={maybe(() => line.thumbnail.url)}
|
thumbnail={line?.thumbnail?.url}
|
||||||
>
|
>
|
||||||
{maybe(() => line.productName && line.productSku) ? (
|
{line?.productName && line?.productSku ? (
|
||||||
<>
|
<>
|
||||||
<>
|
<>
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
|
@ -142,7 +142,7 @@ const OrderDraftDetailsProducts: React.FC<OrderDraftDetailsProductsProps> = prop
|
||||||
)}
|
)}
|
||||||
</TableCellAvatar>
|
</TableCellAvatar>
|
||||||
<TableCell className={classes.colQuantity}>
|
<TableCell className={classes.colQuantity}>
|
||||||
{maybe(() => line.quantity) ? (
|
{line?.quantity ? (
|
||||||
<Form
|
<Form
|
||||||
initial={{ quantity: line.quantity }}
|
initial={{ quantity: line.quantity }}
|
||||||
onSubmit={data => onOrderLineChange(line.id, data)}
|
onSubmit={data => onOrderLineChange(line.id, data)}
|
||||||
|
@ -181,14 +181,14 @@ const OrderDraftDetailsProducts: React.FC<OrderDraftDetailsProductsProps> = prop
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colPrice}>
|
<TableCell className={classes.colPrice}>
|
||||||
{maybe(() => line.unitPrice.gross) ? (
|
{line?.unitPrice?.gross ? (
|
||||||
<Money money={line.unitPrice.gross} />
|
<Money money={line.unitPrice.gross} />
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colTotal}>
|
<TableCell className={classes.colTotal}>
|
||||||
{maybe(() => line.unitPrice.gross && line.quantity) ? (
|
{line?.unitPrice?.gross && line?.quantity ? (
|
||||||
<Money
|
<Money
|
||||||
money={{
|
money={{
|
||||||
amount: line.unitPrice.gross.amount * line.quantity,
|
amount: line.unitPrice.gross.amount * line.quantity,
|
||||||
|
|
Loading…
Reference in a new issue