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