0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Updated save state handling for button

closes https://github.com/TryGhost/members.js/issues/34

- Updates save state handling for button to show intermediary Saved state before resetting
- Updates labels based on action running state
This commit is contained in:
Rish 2020-06-03 10:50:14 +05:30
parent 9387cf2131
commit e8a7f6aec9
2 changed files with 17 additions and 1 deletions

View file

@ -203,10 +203,20 @@ export default class ParentContainer extends React.Component {
});
}
}
setTimeout(() => {
this.setState({
action: ''
});
}, 5000);
} catch (e) {
this.setState({
action: `${action}:failed`
});
setTimeout(() => {
this.setState({
action: ''
});
}, 5000);
}
}

View file

@ -38,7 +38,13 @@ export default class AccountProfilePage extends React.Component {
renderSaveButton() {
const isRunning = (this.context.action === 'updateMember:running');
const label = isRunning ? 'Saving' : 'Save';
const isSaved = (this.context.action === 'updateMember:success');
let label = 'Save';
if (isRunning) {
label = 'Saving';
} else if (isSaved) {
label = 'Saved';
}
const disabled = isRunning ? true : false;
return (
<ActionButton