mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
Enables our new eslint rules which enforce consistent i18n imports. For more info, see https://github.com/discourse/lint-configs/commit/0d58b40cd7d170a9f70bcef5c173f95eeb498298
51 lines
1.4 KiB
Plaintext
51 lines
1.4 KiB
Plaintext
import Component from "@glimmer/component";
|
|
import { hash } from "@ember/helper";
|
|
import { LinkTo } from "@ember/routing";
|
|
import { service } from "@ember/service";
|
|
import { isEmpty } from "@ember/utils";
|
|
import concatClass from "discourse/helpers/concat-class";
|
|
import { i18n } from "discourse-i18n";
|
|
import ChannelTitle from "./channel-title";
|
|
import ToggleChannelMembershipButton from "./toggle-channel-membership-button";
|
|
|
|
export default class ChatChannelPreviewCard extends Component {
|
|
@service chat;
|
|
|
|
get showJoinButton() {
|
|
return this.args.channel?.isOpen && this.args.channel?.canJoin;
|
|
}
|
|
|
|
get hasDescription() {
|
|
return !isEmpty(this.args.channel?.description);
|
|
}
|
|
|
|
<template>
|
|
<div
|
|
class={{concatClass
|
|
"chat-channel-preview-card"
|
|
(unless this.hasDescription "-no-description")
|
|
(unless this.showJoinButton "-no-button")
|
|
}}
|
|
>
|
|
<ChannelTitle @channel={{@channel}} />
|
|
{{#if this.hasDescription}}
|
|
<p class="chat-channel-preview-card__description">
|
|
{{@channel.description}}
|
|
</p>
|
|
{{/if}}
|
|
{{#if this.showJoinButton}}
|
|
<ToggleChannelMembershipButton
|
|
@channel={{@channel}}
|
|
@options={{hash joinClass="btn-primary"}}
|
|
/>
|
|
{{/if}}
|
|
<LinkTo
|
|
@route="chat.browse"
|
|
class="chat-channel-preview-card__browse-all"
|
|
>
|
|
{{i18n "chat.browse_all_channels"}}
|
|
</LinkTo>
|
|
</div>
|
|
</template>
|
|
}
|