mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Notify on saved options
This commit is contained in:
@@ -119,7 +119,10 @@
|
||||
, "optionsReset": {
|
||||
"message": "Restore Defaults"
|
||||
}
|
||||
, "optionsSubmit": {
|
||||
"message": "Submit"
|
||||
, "optionsSave": {
|
||||
"message": "Save"
|
||||
}
|
||||
, "optionsSaved": {
|
||||
"message": "Saved!"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ class App extends Component {
|
||||
, bridgeInfo: null
|
||||
, bridgeLoading: true
|
||||
, isFormValid: true
|
||||
, hasSaved: false
|
||||
};
|
||||
|
||||
this.handleReset = this.handleReset.bind(this);
|
||||
@@ -104,6 +105,16 @@ class App extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
hasSaved: true
|
||||
}, () => {
|
||||
window.setTimeout(() => {
|
||||
this.setState({
|
||||
hasSaved: false
|
||||
});
|
||||
}, 1000)
|
||||
});
|
||||
|
||||
// Send update message / event
|
||||
browser.runtime.sendMessage({
|
||||
subject: "optionsUpdated"
|
||||
@@ -270,13 +281,20 @@ class App extends Component {
|
||||
</fieldset>
|
||||
|
||||
<div id="buttons">
|
||||
<div id="status-line">
|
||||
{ do {
|
||||
if (this.state.hasSaved) {
|
||||
_("optionsSaved")
|
||||
}
|
||||
}}
|
||||
</div>
|
||||
<button onClick={ this.handleReset }>
|
||||
{ _("optionsReset") }
|
||||
</button>
|
||||
<button type="submit"
|
||||
default
|
||||
disabled={ !this.state.isFormValid }>
|
||||
{ _("optionsSubmit") }
|
||||
{ _("optionsSave") }
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
}
|
||||
|
||||
#buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-self: flex-end;
|
||||
margin-block-start: 5px;
|
||||
}
|
||||
@@ -20,6 +22,10 @@
|
||||
margin-inline-end: 5px;
|
||||
}
|
||||
|
||||
#status-line {
|
||||
color: graytext;
|
||||
}
|
||||
|
||||
|
||||
.bridge {
|
||||
margin-top: 20px;
|
||||
|
||||
Reference in New Issue
Block a user