Skip to content

Commit

Permalink
misc: finalize warning badge icon display ruel
Browse files Browse the repository at this point in the history
  • Loading branch information
ansmonjol committed Aug 26, 2024
1 parent 46ed5d1 commit e02e6d2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
10 changes: 4 additions & 6 deletions src/components/customers/CustomerInvoicesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,20 +203,18 @@ export const CustomerInvoicesList: FC<CustomerInvoicesListProps> = ({
key: 'status',
minWidth: 80,
title: translate('text_63ac86d797f728a87b2f9fa7'),
content: ({ status, errorDetails }) => {
const hasTaxErrors =
!!errorDetails?.length &&
[InvoiceStatusTypeEnum.Draft, InvoiceStatusTypeEnum.Voided].includes(status)
content: ({ status, errorDetails, paymentDisputeLostAt }) => {
const showWarningIcon = !!errorDetails?.length || !!paymentDisputeLostAt

return (
<Tooltip
placement="top-start"
disableHoverListener={!hasTaxErrors}
disableHoverListener={!errorDetails?.length}
title={translate('text_1724674592260h33v56rycaw')}
>
<Status
{...invoiceStatusMapping({ status })}
endIcon={hasTaxErrors ? 'warning-unfilled' : undefined}
endIcon={showWarningIcon ? 'warning-unfilled' : undefined}
/>
</Tooltip>
)
Expand Down
10 changes: 4 additions & 6 deletions src/components/invoices/InvoicesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,20 +272,18 @@ const InvoicesList = ({
key: 'status',
title: translate('text_63ac86d797f728a87b2f9fa7'),
minWidth: 80,
content: ({ status, errorDetails }) => {
const hasTaxErrors =
!!errorDetails?.length &&
[InvoiceStatusTypeEnum.Draft, InvoiceStatusTypeEnum.Voided].includes(status)
content: ({ status, errorDetails, paymentDisputeLostAt }) => {
const showWarningIcon = !!errorDetails?.length || paymentDisputeLostAt

return (
<Tooltip
placement="top-start"
disableHoverListener={!hasTaxErrors}
disableHoverListener={!errorDetails?.length}
title={translate('text_1724674592260h33v56rycaw')}
>
<Status
{...invoiceStatusMapping({ status })}
endIcon={hasTaxErrors ? 'warning-unfilled' : undefined}
endIcon={showWarningIcon ? 'warning-unfilled' : undefined}
/>
</Tooltip>
)
Expand Down
2 changes: 2 additions & 0 deletions src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2554,6 +2554,7 @@ export type Invoice = {
paymentOverdue: Scalars['Boolean']['output'];
paymentStatus: InvoicePaymentStatusTypeEnum;
prepaidCreditAmountCents: Scalars['BigInt']['output'];
progressiveBillingCreditAmountCents: Scalars['BigInt']['output'];
refundableAmountCents: Scalars['BigInt']['output'];
sequentialId: Scalars['ID']['output'];
status: InvoiceStatusTypeEnum;
Expand All @@ -2573,6 +2574,7 @@ export type InvoiceAppliedTax = AppliedTax & {
__typename?: 'InvoiceAppliedTax';
amountCents: Scalars['BigInt']['output'];
amountCurrency: CurrencyEnum;
appliedOnWholeInvoice: Scalars['Boolean']['output'];
createdAt: Scalars['ISO8601DateTime']['output'];
feesAmountCents: Scalars['BigInt']['output'];
id: Scalars['ID']['output'];
Expand Down
6 changes: 1 addition & 5 deletions src/layouts/CustomerInvoiceDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,7 @@ const CustomerInvoiceDetails = () => {
? paymentStatusMapping({ status, paymentStatus })
: invoiceStatusMapping({ status }))}
endIcon={
!!data?.invoice?.paymentDisputeLostAt ||
(!!data?.invoice?.errorDetails?.length &&
[InvoiceStatusTypeEnum.Draft, InvoiceStatusTypeEnum.Voided].includes(
status,
))
!!data?.invoice?.paymentDisputeLostAt || !!data?.invoice?.errorDetails?.length
? 'warning-unfilled'
: undefined
}
Expand Down

0 comments on commit e02e6d2

Please sign in to comment.