Cleanup interface buttons

This commit is contained in:
Will Hunt 2019-05-14 21:05:22 +01:00
parent 64a384477e
commit 626cb46915
3 changed files with 25 additions and 4 deletions

View file

@ -71,3 +71,11 @@ limitations under the License.
.mx_UserNotifSettings_notifTable .mx_Spinner {
position: absolute;
}
.mx_NotificationSound_soundUpload {
display: none;
}
.mx_NotificationSound_resetSound {
margin-left: 5px;
}

View file

@ -46,6 +46,13 @@ export default class NotificationsSettingsTab extends React.Component {
});
}
async _triggerUploader(e) {
e.stopPropagation();
e.preventDefault();
this.refs.soundUpload.click();
}
async _onSoundUploadChanged(e) {
if (!e.target.files || !e.target.files.length) {
this.setState({
@ -133,10 +140,15 @@ export default class NotificationsSettingsTab extends React.Component {
<div>
<h3>{_t("Set a new custom sound")}</h3>
<form autoComplete={false} noValidate={true}>
<input type="file" onChange={this._onSoundUploadChanged.bind(this)} accept="audio/*" />
<input ref="soundUpload" className="mx_NotificationSound_soundUpload" type="file" onChange={this._onSoundUploadChanged.bind(this)} accept="audio/*" />
</form>
<AccessibleButton onClick={this._clearSound.bind(this)} kind="primary">
{_t("Reset to default sound")}
<AccessibleButton onClick={this._triggerUploader.bind(this)} kind="primary">
{_t("Browse")}
</AccessibleButton>
<AccessibleButton className="mx_NotificationSound_resetSound" onClick={this._clearSound.bind(this)} kind="primary">
{_t("Reset")}
</AccessibleButton>
</div>
</div>

View file

@ -616,7 +616,8 @@
"URL Previews": "URL Previews",
"Sounds": "Sounds",
"Set a new custom sound": "Set a new custom sound",
"Reset to default sound": "Reset to default sound",
"Browse": "Browse",
"Reset": "Reset",
"Change room avatar": "Change room avatar",
"Change room name": "Change room name",
"Change main address for the room": "Change main address for the room",