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 />)}
|
||||
</TableCell>
|
||||
<TableCell className={classes.colMinSpent}>
|
||||
{hasChannelsLoaded ? (
|
||||
<Money money={channel?.minSpent} />
|
||||
{voucher?.code ? (
|
||||
hasChannelsLoaded ? (
|
||||
<Money money={channel?.minSpent} />
|
||||
) : (
|
||||
"-"
|
||||
)
|
||||
) : (
|
||||
<Skeleton />
|
||||
)}
|
||||
|
@ -269,19 +273,23 @@ const VoucherList: React.FC<VoucherListProps> = props => {
|
|||
className={classes.colValue}
|
||||
onClick={voucher ? onRowClick(voucher.id) : undefined}
|
||||
>
|
||||
{hasChannelsLoaded ? (
|
||||
voucher.discountValueType ===
|
||||
DiscountValueTypeEnum.FIXED ? (
|
||||
<Money
|
||||
money={
|
||||
channel?.discountValue && {
|
||||
amount: channel?.discountValue,
|
||||
currency: channel?.currency
|
||||
{voucher?.code ? (
|
||||
hasChannelsLoaded ? (
|
||||
voucher.discountValueType ===
|
||||
DiscountValueTypeEnum.FIXED ? (
|
||||
<Money
|
||||
money={
|
||||
channel?.discountValue && {
|
||||
amount: channel?.discountValue,
|
||||
currency: channel?.currency
|
||||
}
|
||||
}
|
||||
}
|
||||
/>
|
||||
/>
|
||||
) : (
|
||||
<Percent amount={channel?.discountValue} />
|
||||
)
|
||||
) : (
|
||||
<Percent amount={channel?.discountValue} />
|
||||
"-"
|
||||
)
|
||||
) : (
|
||||
<Skeleton />
|
||||
|
|
|
@ -87873,11 +87873,7 @@ exports[`Storyshots Views / Discounts / Voucher list no channels 1`] = `
|
|||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colMinSpent-id"
|
||||
>
|
||||
<span
|
||||
class="Skeleton-skeleton-id"
|
||||
>
|
||||
|
||||
</span>
|
||||
-
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colStart-id"
|
||||
|
@ -87898,11 +87894,7 @@ exports[`Storyshots Views / Discounts / Voucher list no channels 1`] = `
|
|||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colValue-id"
|
||||
>
|
||||
<span
|
||||
class="Skeleton-skeleton-id"
|
||||
>
|
||||
|
||||
</span>
|
||||
-
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colUses-id"
|
||||
|
@ -87955,11 +87947,7 @@ exports[`Storyshots Views / Discounts / Voucher list no channels 1`] = `
|
|||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colMinSpent-id"
|
||||
>
|
||||
<span
|
||||
class="Skeleton-skeleton-id"
|
||||
>
|
||||
|
||||
</span>
|
||||
-
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colStart-id"
|
||||
|
@ -87980,11 +87968,7 @@ exports[`Storyshots Views / Discounts / Voucher list no channels 1`] = `
|
|||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colValue-id"
|
||||
>
|
||||
<span
|
||||
class="Skeleton-skeleton-id"
|
||||
>
|
||||
|
||||
</span>
|
||||
-
|
||||
</td>
|
||||
<td
|
||||
class="MuiTableCell-root-id MuiTableCell-body-id VoucherList-colUses-id"
|
||||
|
|
|
@ -346,7 +346,7 @@ const TranslationsEntities: React.FC<TranslationsEntitiesProps> = ({
|
|||
max: 1
|
||||
},
|
||||
id: node.voucher?.id,
|
||||
name: node.voucher?.name
|
||||
name: node.voucher?.name || "-"
|
||||
}
|
||||
)}
|
||||
onRowClick={id =>
|
||||
|
|
Loading…
Reference in a new issue