mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 03:08:29 +08: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,
|
||||
|
||||
html() {
|
||||
if (this.currentUser.isInDoNotDisturb()) {
|
||||
return [
|
||||
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")),
|
||||
]),
|
||||
];
|
||||
}
|
||||
const isOn = this.currentUser.isInDoNotDisturb();
|
||||
return [this._menuButton(isOn)];
|
||||
},
|
||||
|
||||
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 until = this.currentUser.do_not_disturb_until;
|
||||
|
|
Loading…
Reference in New Issue
Block a user