DEV: Update chat `addToHeaderIcons` to pass component (#25885)
This commit is contained in:
parent
a85e4adc85
commit
b5d4e06de7
|
@ -80,20 +80,22 @@ export default class ChatHeaderIcon extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a
|
<li class="header-dropdown-toggle chat-header-icon">
|
||||||
href={{this.href}}
|
<a
|
||||||
tabindex="0"
|
href={{this.href}}
|
||||||
class={{concatClass "icon" "btn-flat" (if this.isActive "active")}}
|
tabindex="0"
|
||||||
title={{this.title}}
|
class={{concatClass "icon" "btn-flat" (if this.isActive "active")}}
|
||||||
>
|
title={{this.title}}
|
||||||
{{~icon this.icon~}}
|
>
|
||||||
{{#if this.showUnreadIndicator}}
|
{{~icon this.icon~}}
|
||||||
<ChatHeaderIconUnreadIndicator
|
{{#if this.showUnreadIndicator}}
|
||||||
@urgentCount={{@urgentCount}}
|
<ChatHeaderIconUnreadIndicator
|
||||||
@unreadCount={{@unreadCount}}
|
@urgentCount={{@urgentCount}}
|
||||||
@indicatorPreference={{@indicatorPreference}}
|
@unreadCount={{@unreadCount}}
|
||||||
/>
|
@indicatorPreference={{@indicatorPreference}}
|
||||||
{{/if}}
|
/>
|
||||||
</a>
|
{{/if}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</template>
|
</template>
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import I18n from "discourse-i18n";
|
||||||
import { MENTION_KEYWORDS } from "discourse/plugins/chat/discourse/components/chat-message";
|
import { MENTION_KEYWORDS } from "discourse/plugins/chat/discourse/components/chat-message";
|
||||||
import { clearChatComposerButtons } from "discourse/plugins/chat/discourse/lib/chat-composer-buttons";
|
import { clearChatComposerButtons } from "discourse/plugins/chat/discourse/lib/chat-composer-buttons";
|
||||||
import ChannelHashtagType from "discourse/plugins/chat/discourse/lib/hashtag-types/channel";
|
import ChannelHashtagType from "discourse/plugins/chat/discourse/lib/hashtag-types/channel";
|
||||||
|
import ChatHeaderIcon from "../components/chat/header/icon";
|
||||||
import chatStyleguide from "../components/styleguide/organisms/chat";
|
import chatStyleguide from "../components/styleguide/organisms/chat";
|
||||||
|
|
||||||
let _lastForcedRefreshAt;
|
let _lastForcedRefreshAt;
|
||||||
|
@ -167,7 +168,9 @@ export default {
|
||||||
|
|
||||||
api.addCardClickListenerSelector(".chat-drawer-outlet");
|
api.addCardClickListenerSelector(".chat-drawer-outlet");
|
||||||
|
|
||||||
api.addToHeaderIcons("chat-header-icon");
|
if (this.chatService.userCanChat) {
|
||||||
|
api.addToHeaderIcons(ChatHeaderIcon);
|
||||||
|
}
|
||||||
|
|
||||||
api.addStyleguideSection?.({
|
api.addStyleguideSection?.({
|
||||||
component: chatStyleguide,
|
component: chatStyleguide,
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
import { hbs } from "ember-cli-htmlbars";
|
|
||||||
import RenderGlimmer from "discourse/widgets/render-glimmer";
|
|
||||||
import { createWidget } from "discourse/widgets/widget";
|
|
||||||
|
|
||||||
export default createWidget("chat-header-icon", {
|
|
||||||
tagName: "li.header-dropdown-toggle.chat-header-icon",
|
|
||||||
|
|
||||||
services: ["chat"],
|
|
||||||
|
|
||||||
html() {
|
|
||||||
if (!this.chat.userCanChat) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
new RenderGlimmer(
|
|
||||||
this,
|
|
||||||
"div.widget-component-connector",
|
|
||||||
hbs`<Chat::Header::Icon />`
|
|
||||||
),
|
|
||||||
];
|
|
||||||
},
|
|
||||||
});
|
|
Loading…
Reference in New Issue