-
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.
Apply User-Defined Date Formatting Settings to WP Admin React Compone…
…nts (#9635) Co-authored-by: deepakpathania <68396823+deepakpathania@users.noreply.github.com>
- Loading branch information
1 parent
f0ebc14
commit 3794508
Showing
69 changed files
with
915 additions
and
289 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
changelog/fix-6567-user-set-date-and-time-formatting-arent-respected-in-react-components
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,4 @@ | ||
Significance: minor | ||
Type: update | ||
|
||
Apply User-Defined Date Formatting Settings to WP Admin React Components |
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
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
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
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
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 |
---|---|---|
|
@@ -46,6 +46,7 @@ describe( 'AccountFees', () => { | |
precision: 2, | ||
}, | ||
}, | ||
dateFormat: 'F j, Y', | ||
}; | ||
} ); | ||
|
||
|
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
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
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
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,67 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import React, { useState } from 'react'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { useDispatch } from '@wordpress/data'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BannerNotice from 'components/banner-notice'; | ||
import interpolateComponents from '@automattic/interpolate-components'; | ||
import { Link } from '@woocommerce/components'; | ||
import './style.scss'; | ||
|
||
const optionName = 'wcpay_date_format_notice_dismissed'; | ||
|
||
const DateFormatNotice: React.FC = () => { | ||
const { updateOptions } = useDispatch( 'wc/admin/options' ); | ||
const [ isBannerVisible, setIsBannerVisible ] = useState( | ||
! wcpaySettings.isDateFormatNoticeDismissed | ||
); | ||
|
||
const handleDismiss = () => { | ||
setIsBannerVisible( false ); | ||
wcpaySettings.isDateFormatNoticeDismissed = true; | ||
updateOptions( { | ||
[ optionName ]: true, | ||
} ); | ||
}; | ||
|
||
const handleSettingsClick = () => { | ||
handleDismiss(); | ||
}; | ||
|
||
if ( ! isBannerVisible ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<BannerNotice | ||
status="info" | ||
icon={ true } | ||
isDismissible={ true } | ||
onRemove={ handleDismiss } | ||
className="date-format-notice" | ||
> | ||
{ interpolateComponents( { | ||
components: { | ||
settingsLink: ( | ||
<Link | ||
href={ '/wp-admin/options-general.php' } | ||
onClick={ handleSettingsClick } | ||
type="external" | ||
/> | ||
), | ||
}, | ||
mixedString: __( | ||
'The date and time formats now match your preferences. You can update them anytime in the {{settingsLink}}settings{{/settingsLink}}.', | ||
'woocommerce-payments' | ||
), | ||
} ) } | ||
</BannerNotice> | ||
); | ||
}; | ||
|
||
export default DateFormatNotice; |
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 @@ | ||
.date-format-notice { | ||
.wcpay-banner-notice__content { | ||
align-self: center; // Align the content to the center of the notice and the icon. | ||
} | ||
} |
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
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.