DEV: Use `RenderGlimmer` for experimental user menu (#17597)
`RenderGlimmer` means we can now drop the classic-component wrapper. The old `didInsertElement` hook is reimplemented via the `did-insert` modifier.
This commit is contained in:
parent
6c5efb61c9
commit
98bacbd2c6
|
@ -1,12 +0,0 @@
|
|||
import Component from "@ember/component";
|
||||
import layout from "discourse/templates/components/user-menu-wrapper";
|
||||
|
||||
export default Component.extend({
|
||||
layout,
|
||||
tagName: "",
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
this.appEvents.trigger("user-menu:rendered");
|
||||
},
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
<div class="user-menu revamped menu-panel drop-down" data-max-width="320">
|
||||
<div class="user-menu revamped menu-panel drop-down" data-max-width="320" {{did-insert this.triggerRenderedAppEvent}}>
|
||||
<div class="panel-body">
|
||||
<div class="panel-body-contents">
|
||||
<div
|
||||
|
|
|
@ -52,4 +52,9 @@ export default class UserMenu extends GlimmerComponent {
|
|||
this.currentPanelComponent = tab.panelComponent;
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
triggerRenderedAppEvent() {
|
||||
this.appEvents.trigger("user-menu:rendered");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<UserMenu::Menu/>
|
|
@ -11,7 +11,8 @@ import { schedule } from "@ember/runloop";
|
|||
import { scrollTop } from "discourse/mixins/scroll-top";
|
||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||
import { logSearchLinkClick } from "discourse/lib/search";
|
||||
import ComponentConnector from "discourse/widgets/component-connector";
|
||||
import RenderGlimmer from "discourse/widgets/render-glimmer";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
|
||||
const _extraHeaderIcons = [];
|
||||
|
||||
|
@ -338,9 +339,11 @@ createWidget("revamped-user-menu-wrapper", {
|
|||
|
||||
html() {
|
||||
return [
|
||||
new ComponentConnector(this, "user-menu-wrapper", {}, [], {
|
||||
applyStyle: false,
|
||||
}),
|
||||
new RenderGlimmer(
|
||||
this,
|
||||
"div.widget-component-connector",
|
||||
hbs`<UserMenu::Menu />`
|
||||
),
|
||||
];
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue