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:
parent
9387cf2131
commit
e8a7f6aec9
2 changed files with 17 additions and 1 deletions
|
@ -203,10 +203,20 @@ export default class ParentContainer extends React.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
action: ''
|
||||||
|
});
|
||||||
|
}, 5000);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.setState({
|
this.setState({
|
||||||
action: `${action}:failed`
|
action: `${action}:failed`
|
||||||
});
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
action: ''
|
||||||
|
});
|
||||||
|
}, 5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,13 @@ export default class AccountProfilePage extends React.Component {
|
||||||
|
|
||||||
renderSaveButton() {
|
renderSaveButton() {
|
||||||
const isRunning = (this.context.action === 'updateMember:running');
|
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;
|
const disabled = isRunning ? true : false;
|
||||||
return (
|
return (
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
|
Loading…
Add table
Reference in a new issue