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/components/chat-channel-card.hbs
Joffrey JAFFEUX b89df3ca9d
DEV: refactors routes to simplify using outlet (#20179)
This work will allow us to have an {{outlet}} chat.channel route and use it for threads as a sidepanel.
2023-02-07 13:59:32 +01:00

94 lines
2.6 KiB
Handlebars

{{#if @channel}}
<div
class={{concat-class
"chat-channel-card"
(if @channel.isClosed "-closed")
(if @channel.isArchived "-archived")
}}
style={{border-color @channel.chatable.color}}
data-channel-id={{@channel.id}}
>
<div class="chat-channel-card__header">
<LinkTo
@route="chat.channel"
@models={{@channel.routeModels}}
class="chat-channel-card__name-container"
>
<span class="chat-channel-card__name">
{{replace-emoji @channel.escapedTitle}}
</span>
{{#if @channel.chatable.read_restricted}}
{{d-icon "lock" class="chat-channel-card__read-restricted"}}
{{/if}}
</LinkTo>
<div class="chat-channel-card__header-actions">
{{#if @channel.currentUserMembership.muted}}
<LinkTo
@route="chat.channel.info.settings"
@models={{@channel.routeModels}}
class="chat-channel-card__tag -muted"
tabindex="-1"
>
{{i18n "chat.muted"}}
</LinkTo>
{{/if}}
<LinkTo
@route="chat.channel.info.settings"
@models={{@channel.routeModels}}
class="chat-channel-card__setting"
tabindex="-1"
>
{{d-icon "cog"}}
</LinkTo>
</div>
</div>
{{#if @channel.description}}
<div class="chat-channel-card__description">
{{replace-emoji @channel.escapedDescription}}
</div>
{{/if}}
<div class="chat-channel-card__cta">
{{#if @channel.isFollowing}}
<div class="chat-channel-card__tags">
<span class="chat-channel-card__tag -joined">
{{i18n "chat.joined"}}
</span>
<ToggleChannelMembershipButton
@channel={{@channel}}
@options={{hash
leaveClass="btn-link btn-small chat-channel-card__leave-btn"
labelType="short"
}}
/>
</div>
{{else if @channel.isJoinable}}
<ToggleChannelMembershipButton
@channel={{@channel}}
@options={{hash
joinClass="btn-primary btn-small chat-channel-card__join-btn"
labelType="short"
}}
/>
{{/if}}
{{#if (gt @channel.membershipsCount 0)}}
<LinkTo
@route="chat.channel.info.members"
@models={{@channel.routeModels}}
class="chat-channel-card__members"
tabindex="-1"
>
{{i18n
"chat.channel.memberships_count"
count=@channel.membershipsCount
}}
</LinkTo>
{{/if}}
</div>
</div>
{{/if}}