mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: dry up the Do Not Disturb widget (#19494)
This commit is contained in:
parent
587e9ed9ba
commit
b334f0070d
@ -11,21 +11,8 @@ export default createWidget("do-not-disturb", {
|
|||||||
saving: false,
|
saving: false,
|
||||||
|
|
||||||
html() {
|
html() {
|
||||||
if (this.currentUser.isInDoNotDisturb()) {
|
const isOn = this.currentUser.isInDoNotDisturb();
|
||||||
return [
|
return [this._menuButton(isOn)];
|
||||||
h("button.btn-flat.do-not-disturb-inner-container", [
|
|
||||||
iconNode("toggle-on"),
|
|
||||||
this.label(),
|
|
||||||
]),
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
return [
|
|
||||||
h("button.btn-flat.do-not-disturb-inner-container", [
|
|
||||||
iconNode("toggle-off"),
|
|
||||||
h("span.do-not-disturb-label", I18n.t("pause_notifications.label")),
|
|
||||||
]),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
click() {
|
click() {
|
||||||
@ -44,7 +31,15 @@ export default createWidget("do-not-disturb", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
label() {
|
_menuButton(isOn) {
|
||||||
|
const icon = iconNode(isOn ? "toggle-on" : "toggle-off");
|
||||||
|
return h("button.btn-flat.do-not-disturb-inner-container", [
|
||||||
|
icon,
|
||||||
|
this._label(),
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
_label() {
|
||||||
const content = [h("span", I18n.t("pause_notifications.label"))];
|
const content = [h("span", I18n.t("pause_notifications.label"))];
|
||||||
|
|
||||||
const until = this.currentUser.do_not_disturb_until;
|
const until = this.currentUser.do_not_disturb_until;
|
||||||
|
Loading…
Reference in New Issue
Block a user