Skip to content

Commit a545976

Browse files
CGastrellsimison
andauthored
Notifications: improve Email Subscriptions button saving state (#103300)
* use wp button component, wee refactor on the click and submit handler * Use same copy while busy --------- Co-authored-by: Mikael Korpela <[email protected]>
1 parent 92f6c81 commit a545976

File tree

1 file changed

+12
-9
lines changed
  • client/me/notification-settings/reader-subscriptions

1 file changed

+12
-9
lines changed

client/me/notification-settings/reader-subscriptions/index.jsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { Card, FormLabel, Dialog } from '@automattic/components';
2-
import { CheckboxControl } from '@wordpress/components';
2+
import { Button, CheckboxControl } from '@wordpress/components';
33
import { localize } from 'i18n-calypso';
44
import { flowRight as compose } from 'lodash';
55
import { Component } from 'react';
66
import { connect } from 'react-redux';
77
import QueryReaderTeams from 'calypso/components/data/query-reader-teams';
8-
import FormButton from 'calypso/components/forms/form-button';
98
import FormFieldset from 'calypso/components/forms/form-fieldset';
109
import FormLegend from 'calypso/components/forms/form-legend';
1110
import FormSectionHeading from 'calypso/components/forms/form-section-heading';
@@ -80,6 +79,11 @@ class NotificationSubscriptions extends Component {
8079
this.props.submitForm( event );
8180
};
8281

82+
handleSubmitButtonClick = ( event ) => {
83+
this.props.recordGoogleEvent( 'Me', 'Clicked on Save Notification Settings Button' );
84+
this.handleSubmit( event );
85+
};
86+
8387
handleModalCancel = () => {
8488
// Create a synthetic event object that matches what updateSetting expects
8589
const syntheticEvent = {
@@ -299,15 +303,14 @@ class NotificationSubscriptions extends Component {
299303
</FormFieldset>
300304
) }
301305

302-
<FormButton
303-
isSubmitting={ this.props.isUpdatingUserSettings }
306+
<Button
307+
variant="primary"
304308
disabled={ this.props.isUpdatingUserSettings || ! this.props.hasUnsavedUserSettings }
305-
onClick={ this.handleClickEvent( 'Save Notification Settings Button' ) }
309+
isBusy={ this.props.isUpdatingUserSettings }
310+
onClick={ this.handleSubmitButtonClick }
306311
>
307-
{ this.props.isUpdatingUserSettings
308-
? this.props.translate( 'Saving…' )
309-
: this.props.translate( 'Save notification settings' ) }
310-
</FormButton>
312+
{ this.props.translate( 'Save notification settings' ) }
313+
</Button>
311314
</form>
312315
</Card>
313316

0 commit comments

Comments
 (0)