Skip to content

Commit

Permalink
Reduce multiple urgent dispute signals (#8274)
Browse files Browse the repository at this point in the history
  • Loading branch information
naman03malhotra authored Mar 1, 2024
1 parent c7a133b commit c8fd975
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
53 changes: 28 additions & 25 deletions client/payment-details/dispute-details/dispute-due-by-date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import moment from 'moment';

const DisputeDueByDate: React.FC< {
dueBy: number;
} > = ( { dueBy } ) => {
showRemainingDays?: boolean;
} > = ( { dueBy, showRemainingDays = true } ) => {
const daysRemaining = Math.floor(
moment.unix( dueBy ).diff( moment(), 'days', true )
);
Expand All @@ -20,31 +21,33 @@ const DisputeDueByDate: React.FC< {
return (
<span className="dispute-steps__steps__response-date">
{ respondByDate }
<span
className={ classNames( {
'dispute-steps__steps__response-date--urgent':
daysRemaining < 3,
'dispute-steps__steps__response-date--warning':
daysRemaining < 7 && daysRemaining > 2,
} ) }
>
{ daysRemaining > 0 &&
sprintf(
// Translators: %d is the number of days left to respond to the dispute.
_n(
'(%d day left to respond)',
'(%d days left to respond)',
daysRemaining,
'woocommerce-payments'
),
daysRemaining
) }
{ showRemainingDays && (
<span
className={ classNames( {
'dispute-steps__steps__response-date--urgent':
daysRemaining < 3,
'dispute-steps__steps__response-date--warning':
daysRemaining < 7 && daysRemaining > 2,
} ) }
>
{ daysRemaining > 0 &&
sprintf(
// Translators: %d is the number of days left to respond to the dispute.
_n(
'(%d day left to respond)',
'(%d days left to respond)',
daysRemaining,
'woocommerce-payments'
),
daysRemaining
) }

{ daysRemaining === 0 &&
__( '(Last day today)', 'woocommerce-payments' ) }
{ daysRemaining < 0 &&
__( '(Past due)', 'woocommerce-payments' ) }
</span>
{ daysRemaining === 0 &&
__( '(Last day today)', 'woocommerce-payments' ) }
{ daysRemaining < 0 &&
__( '(Past due)', 'woocommerce-payments' ) }
</span>
) }
</span>
);
};
Expand Down
3 changes: 2 additions & 1 deletion client/payment-details/dispute-details/dispute-steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const DisputeSteps: React.FC< Props > = ( {
<li>
{ createInterpolateElement(
__(
'Challenge <challengeIcon/> or accept <acceptIcon/> the dispute by <dueByDate/>.',
'Challenge <challengeIcon/> or accept <acceptIcon/> the dispute by <dueByDate/>',
'woocommerce-payments'
),
{
Expand Down Expand Up @@ -155,6 +155,7 @@ export const DisputeSteps: React.FC< Props > = ( {
dueByDate: (
<DisputeDueByDate
dueBy={ dispute.evidence_details.due_by }
showRemainingDays={ false }
/>
),
}
Expand Down

0 comments on commit c8fd975

Please sign in to comment.