-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transaction Details → Show steps to resolve for inquiries (#7292)
Co-authored-by: Rua Haszard <[email protected]>
- Loading branch information
Showing
7 changed files
with
206 additions
and
98 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
changelog/add-7245-transaction-details-inquiry-steps-to-resolve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: add | ||
Comment: Behind feature flag: add steps to resolve section to the transaction dispute details | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
client/payment-details/dispute-details/dispute-due-by-date.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React from 'react'; | ||
import { dateI18n } from '@wordpress/date'; | ||
import { __, _n, sprintf } from '@wordpress/i18n'; | ||
import classNames from 'classnames'; | ||
import moment from 'moment'; | ||
|
||
const DisputeDueByDate: React.FC< { | ||
dueBy: number; | ||
} > = ( { dueBy } ) => { | ||
const daysRemaining = Math.floor( | ||
moment.unix( dueBy ).diff( moment(), 'days', true ) | ||
); | ||
const respondByDate = dateI18n( | ||
'M j, Y, g:ia', | ||
moment( dueBy * 1000 ).toISOString() | ||
); | ||
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 | ||
) } | ||
|
||
{ daysRemaining === 0 && | ||
__( '(Last day today)', 'woocommerce-payments' ) } | ||
{ daysRemaining < 0 && | ||
__( '(Past due)', 'woocommerce-payments' ) } | ||
</span> | ||
</span> | ||
); | ||
}; | ||
|
||
export default DisputeDueByDate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.