mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Update user-menu components to use @glimmer/component
(#17869)
Now that all of our singletons have been converted to true Ember Services, we can remove our custom `discourse/component/glimmer` superclass and use explicit injection
This commit is contained in:
parent
3764ebf963
commit
5ee2741a4c
@ -1,7 +1,7 @@
|
|||||||
import GlimmerComponent from "discourse/components/glimmer";
|
import Component from "@glimmer/component";
|
||||||
import Notification from "discourse/models/notification";
|
import Notification from "discourse/models/notification";
|
||||||
|
|
||||||
export default class UserMenuBookmarkNotificationItem extends GlimmerComponent {
|
export default class UserMenuBookmarkNotificationItem extends Component {
|
||||||
get component() {
|
get component() {
|
||||||
if (this.args.item.constructor === Notification) {
|
if (this.args.item.constructor === Notification) {
|
||||||
return "user-menu/notification-item";
|
return "user-menu/notification-item";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import GlimmerComponent from "discourse/components/glimmer";
|
import Component from "@glimmer/component";
|
||||||
import { tracked } from "@glimmer/tracking";
|
import { tracked } from "@glimmer/tracking";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import Session from "discourse/models/session";
|
import Session from "discourse/models/session";
|
||||||
|
|
||||||
export default class UserMenuItemsList extends GlimmerComponent {
|
export default class UserMenuItemsList extends Component {
|
||||||
@tracked loading = false;
|
@tracked loading = false;
|
||||||
@tracked items = [];
|
@tracked items = [];
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import GlimmerComponent from "discourse/components/glimmer";
|
import Component from "@glimmer/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
|
||||||
export default class UserMenuItem extends GlimmerComponent {
|
export default class UserMenuItem extends Component {
|
||||||
get className() {}
|
get className() {}
|
||||||
|
|
||||||
get linkHref() {
|
get linkHref() {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import GlimmerComponent from "discourse/components/glimmer";
|
import Component from "@glimmer/component";
|
||||||
import { tracked } from "@glimmer/tracking";
|
import { tracked } from "@glimmer/tracking";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { NO_REMINDER_ICON } from "discourse/models/bookmark";
|
import { NO_REMINDER_ICON } from "discourse/models/bookmark";
|
||||||
import UserMenuTab, { CUSTOM_TABS_CLASSES } from "discourse/lib/user-menu/tab";
|
import UserMenuTab, { CUSTOM_TABS_CLASSES } from "discourse/lib/user-menu/tab";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
const DEFAULT_TAB_ID = "all-notifications";
|
const DEFAULT_TAB_ID = "all-notifications";
|
||||||
const DEFAULT_PANEL_COMPONENT = "user-menu/notifications-list";
|
const DEFAULT_PANEL_COMPONENT = "user-menu/notifications-list";
|
||||||
@ -135,7 +136,12 @@ const CORE_TOP_TABS = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export default class UserMenu extends GlimmerComponent {
|
export default class UserMenu extends Component {
|
||||||
|
@service currentUser;
|
||||||
|
@service siteSettings;
|
||||||
|
@service site;
|
||||||
|
@service appEvents;
|
||||||
|
|
||||||
@tracked currentTabId = DEFAULT_TAB_ID;
|
@tracked currentTabId = DEFAULT_TAB_ID;
|
||||||
@tracked currentPanelComponent = DEFAULT_PANEL_COMPONENT;
|
@tracked currentPanelComponent = DEFAULT_PANEL_COMPONENT;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import GlimmerComponent from "discourse/components/glimmer";
|
import Component from "@glimmer/component";
|
||||||
import Notification from "discourse/models/notification";
|
import Notification from "discourse/models/notification";
|
||||||
|
|
||||||
export default class UserMenuMessageNotificationItem extends GlimmerComponent {
|
export default class UserMenuMessageNotificationItem extends Component {
|
||||||
get component() {
|
get component() {
|
||||||
if (this.args.item.constructor === Notification) {
|
if (this.args.item.constructor === Notification) {
|
||||||
return "user-menu/notification-item";
|
return "user-menu/notification-item";
|
||||||
|
@ -4,8 +4,13 @@ import { action } from "@ember/object";
|
|||||||
import { getRenderDirector } from "discourse/lib/notification-item";
|
import { getRenderDirector } from "discourse/lib/notification-item";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import cookie from "discourse/lib/cookie";
|
import cookie from "discourse/lib/cookie";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class UserMenuNotificationItem extends UserMenuItem {
|
export default class UserMenuNotificationItem extends UserMenuItem {
|
||||||
|
@service currentUser;
|
||||||
|
@service siteSettings;
|
||||||
|
@service site;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
this.renderDirector = getRenderDirector(
|
this.renderDirector = getRenderDirector(
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import GlimmerComponent from "discourse/components/glimmer";
|
import templateOnly from "@ember/component/template-only";
|
||||||
|
|
||||||
export default class UserMenuNotificationsListEmptyState extends GlimmerComponent {}
|
export default templateOnly();
|
||||||
|
@ -4,8 +4,13 @@ import { action } from "@ember/object";
|
|||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { postRNWebviewMessage } from "discourse/lib/utilities";
|
import { postRNWebviewMessage } from "discourse/lib/utilities";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class UserMenuNotificationsList extends UserMenuItemsList {
|
export default class UserMenuNotificationsList extends UserMenuItemsList {
|
||||||
|
@service currentUser;
|
||||||
|
@service site;
|
||||||
|
@service store;
|
||||||
|
|
||||||
get filterByTypes() {
|
get filterByTypes() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
import UserMenuItem from "discourse/components/user-menu/menu-item";
|
import UserMenuItem from "discourse/components/user-menu/menu-item";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import { getRenderDirector } from "discourse/lib/reviewable-item";
|
import { getRenderDirector } from "discourse/lib/reviewable-item";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class UserMenuReviewableItem extends UserMenuItem {
|
export default class UserMenuReviewableItem extends UserMenuItem {
|
||||||
|
@service currentUser;
|
||||||
|
@service siteSettings;
|
||||||
|
@service site;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
this.reviewable = this.args.item;
|
this.reviewable = this.args.item;
|
||||||
|
Loading…
Reference in New Issue
Block a user