This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/plugins/chat/assets/javascripts/discourse/templates/components/topic-chat-float.hbs
Joffrey JAFFEUX 66130dc8c1
REFACTOR: handles every chat resource as an URL (#18961)
- Note this is also tweaking the UI a little bit as we are now using links/buttons in the header as needed
- It disables the find ideal channel in drawer mode, if loading `/chat` in drawer mode it will either reopen at the last position or just stay on index
2022-11-11 06:39:15 +01:00

87 lines
3.6 KiB
Handlebars

<div class="chat-drawer">
<div
class={{this.containerClassNames}}
data-chat-channel-id={{this.chat.activeChannel.id}}
>
<div
role="region"
aria-label={{i18n "chat.aria_roles.header"}}
class="topic-chat-drawer-header"
>
{{#if (and this.draftChannelView this.expanded)}}
<div class="topic-chat-drawer-header__left-actions">
<div class="topic-chat-drawer-header__top-line">
<LinkTo title={{i18n "chat.return_to_list"}} class="topic-chat-drawer-header__return-to-channels-btn" @route="chat">
{{d-icon "chevron-left"}}
</LinkTo>
</div>
</div>
<span class="topic-chat-drawer-header__title">
<div class="topic-chat-drawer-header__top-line">
{{i18n "chat.direct_message_creator.title"}}
</div>
</span>
{{else if this.chatView}}
{{#if this.expanded}}
<LinkTo title={{i18n "chat.return_to_list"}} class="topic-chat-drawer-header__return-to-channels-btn" @route="chat">
{{d-icon "chevron-left"}}
</LinkTo>
{{/if}}
{{#if this.chat.activeChannel}}
{{#if this.expanded}}
<LinkTo @route={{this.infoTabRoute}} @models={{array this.chat.activeChannel.id (slugify-channel this.chat.activeChannel)}} class="topic-chat-drawer-header__title">
<div class="topic-chat-drawer-header__top-line">
<ChatChannelTitle @channel={{this.chat.activeChannel}} />
</div>
</LinkTo>
{{else}}
<div role="button" {{on "click" (action "toggleExpand")}} class="topic-chat-drawer-header__title">
<div class="topic-chat-drawer-header__top-line">
<ChatChannelTitle @channel={{this.chat.activeChannel}}>
{{#if this.unreadCount}}
<span class="chat-unread-count">{{this.unreadCount}}</span>
{{/if}}
</ChatChannelTitle>
</div>
</div>
{{/if}}
{{/if}}
{{else}}
<span class="topic-chat-drawer-header__title">
<div class="topic-chat-drawer-header__top-line">
{{i18n "chat.heading"}}
</div>
</span>
{{/if}}
<div class="topic-chat-drawer-header__right-actions">
<div class="topic-chat-drawer-header__top-line {{this.topLineClass}}">
{{#if this.expanded}}
<DButton @icon="discourse-expand" class="btn-flat btn-link topic-chat-drawer-header__full-screen-btn" @title={{"chat.open_full_page"}} @action={{this.openInFullPage}} />
{{/if}}
<FlatButton @icon={{this.expandIcon}} @class="topic-chat-drawer-header__expand-btn" @action={{action "toggleExpand"}} @title="chat.collapse" />
{{#if this.showClose}}
<FlatButton @icon="times" @action={{action "close"}} @title="chat.close" @class="topic-chat-drawer-header__close-btn" />
{{/if}}
</div>
</div>
</div>
{{#if this.expanded}}
<div class="topic-chat-drawer-content">
{{#if (and this.chatView this.chat.activeChannel)}}
<ChatLivePane @chatChannel={{this.chat.activeChannel}} @expanded={{this.expanded}} @floatHidden={{this.hidden}} @onSwitchChannel={{action "switchChannel"}} />
{{else if this.draftChannelView}}
<ChatDraftChannelScreen @onSwitchChannel={{action "switchChannel"}} />
{{else}}
<ChannelsList @floatHidden={{this.hidden}} @onOpenView={{action "openURL"}} @onSelect={{action "switchChannel"}} />
{{/if}}
</div>
{{/if}}
</div>
</div>