Fix null voucher name handle (#891)
* Fix null voucher name handle * Fix behavior for optional name * Fix voucher list * Fix loading voucher * Update storybook
This commit is contained in:
parent
82bbb93d94
commit
29a7ef644c
3 changed files with 26 additions and 34 deletions
|
@ -243,8 +243,12 @@ const VoucherList: React.FC<VoucherListProps> = props => {
|
||||||
{maybe<React.ReactNode>(() => voucher.code, <Skeleton />)}
|
{maybe<React.ReactNode>(() => voucher.code, <Skeleton />)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className={classes.colMinSpent}>
|
<TableCell className={classes.colMinSpent}>
|
||||||
{hasChannelsLoaded ? (
|
{voucher?.code ? (
|
||||||
<Money money={channel?.minSpent} />
|
hasChannelsLoaded ? (
|
||||||
|
<Money money={channel?.minSpent} />
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
)}
|
)}
|
||||||
|
@ -269,19 +273,23 @@ const VoucherList: React.FC<VoucherListProps> = props => {
|
||||||
className={classes.colValue}
|
className={classes.colValue}
|
||||||
onClick={voucher ? onRowClick(voucher.id) : undefined}
|
onClick={voucher ? onRowClick(voucher.id) : undefined}
|
||||||
>
|
>
|
||||||
{hasChannelsLoaded ? (
|
{voucher?.code ? (
|
||||||
voucher.discountValueType ===
|
hasChannelsLoaded ? (
|
||||||
DiscountValueTypeEnum.FIXED ? (
|
voucher.discountValueType ===
|
||||||
<Money
|
DiscountValueTypeEnum.FIXED ? (
|
||||||
money={
|
<Money
|
||||||
channel?.discountValue && {
|
money={
|
||||||
amount: channel?.discountValue,
|
channel?.discountValue && {
|
||||||
currency: channel?.currency
|
amount: channel?.discountValue,
|
||||||
|
currency: channel?.currency
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
/>
|
||||||
/>
|
) : (
|
||||||
|
<Percent amount={channel?.discountValue} />
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<Percent amount={channel?.discountValue} />
|
"-"
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<Skeleton />
|
<Skeleton />
|
||||||
|
|
|
@ -87873,11 +87873,7 @@ exports[`Storyshots Views / Discounts / Voucher list no channels 1`] = `
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colMinSpent-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colMinSpent-id"
|
||||||
>
|
>
|
||||||
<span
|
-
|
||||||
class="Skeleton-skeleton-id"
|
|
||||||
>
|
|
||||||
|
|
||||||
</span>
|
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colStart-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colStart-id"
|
||||||
|
@ -87898,11 +87894,7 @@ exports[`Storyshots Views / Discounts / Voucher list no channels 1`] = `
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colValue-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colValue-id"
|
||||||
>
|
>
|
||||||
<span
|
-
|
||||||
class="Skeleton-skeleton-id"
|
|
||||||
>
|
|
||||||
|
|
||||||
</span>
|
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colUses-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colUses-id"
|
||||||
|
@ -87955,11 +87947,7 @@ exports[`Storyshots Views / Discounts / Voucher list no channels 1`] = `
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colMinSpent-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colMinSpent-id"
|
||||||
>
|
>
|
||||||
<span
|
-
|
||||||
class="Skeleton-skeleton-id"
|
|
||||||
>
|
|
||||||
|
|
||||||
</span>
|
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colStart-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colStart-id"
|
||||||
|
@ -87980,11 +87968,7 @@ exports[`Storyshots Views / Discounts / Voucher list no channels 1`] = `
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colValue-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colValue-id"
|
||||||
>
|
>
|
||||||
<span
|
-
|
||||||
class="Skeleton-skeleton-id"
|
|
||||||
>
|
|
||||||
|
|
||||||
</span>
|
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colUses-id"
|
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colUses-id"
|
||||||
|
|
|
@ -346,7 +346,7 @@ const TranslationsEntities: React.FC<TranslationsEntitiesProps> = ({
|
||||||
max: 1
|
max: 1
|
||||||
},
|
},
|
||||||
id: node.voucher?.id,
|
id: node.voucher?.id,
|
||||||
name: node.voucher?.name
|
name: node.voucher?.name || "-"
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
onRowClick={id =>
|
onRowClick={id =>
|
||||||
|
|
Loading…
Reference in a new issue