2020-02-03 21:22:14 +08:00
|
|
|
import { computed } from "@ember/object";
|
|
|
|
import { readOnly } from "@ember/object/computed";
|
2024-08-23 19:17:07 +08:00
|
|
|
import { classNames } from "@ember-decorators/component";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { escapeExpression } from "discourse/lib/utilities";
|
2024-11-20 04:45:18 +08:00
|
|
|
import { i18n } from "discourse-i18n";
|
2023-10-11 02:38:59 +08:00
|
|
|
import DropdownSelectBoxRowComponent from "select-kit/components/dropdown-select-box/dropdown-select-box-row";
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@classNames("notifications-button-row")
|
|
|
|
export default class NotificationsButtonRow extends DropdownSelectBoxRowComponent {
|
|
|
|
@readOnly("selectKit.options.i18nPrefix") i18nPrefix;
|
|
|
|
@readOnly("selectKit.options.i18nPostfix") i18nPostfix;
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@computed("_start")
|
|
|
|
get label() {
|
2024-11-20 04:45:18 +08:00
|
|
|
return escapeExpression(i18n(`${this._start}.title`));
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@computed("item.icon")
|
|
|
|
get icons() {
|
2020-02-03 21:22:14 +08:00
|
|
|
return [escapeExpression(this.item.icon)];
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@computed("_start")
|
|
|
|
get description() {
|
2019-01-16 17:27:27 +08:00
|
|
|
if (this.site && this.site.mobileView) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-11-20 04:45:18 +08:00
|
|
|
return escapeExpression(i18n(`${this._start}.description`));
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@computed("i18nPrefix", "i18nPostfix", "rowName")
|
|
|
|
get _start() {
|
2020-02-03 21:22:14 +08:00
|
|
|
return `${this.i18nPrefix}.${this.rowName}${this.i18nPostfix}`;
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
|
|
|
}
|