mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00

Followup to 7d8974d02f7360b324b446868463e950fe92883f Co-authored-by: David Taylor <david@taylorhq.com>
33 lines
789 B
Plaintext
33 lines
789 B
Plaintext
import Component from "@glimmer/component";
|
|
import { service } from "@ember/service";
|
|
import { isPresent } from "@ember/utils";
|
|
import DButton from "discourse/components/d-button";
|
|
|
|
export default class ChatChannelLeaveBtn extends Component {
|
|
@service chat;
|
|
@service site;
|
|
|
|
get shouldRender() {
|
|
return this.site.desktopView && isPresent(this.args.channel);
|
|
}
|
|
|
|
get leaveChatTitleKey() {
|
|
if (this.args.channel.isDirectMessageChannel) {
|
|
return "chat.direct_messages.leave";
|
|
} else {
|
|
return "chat.leave";
|
|
}
|
|
}
|
|
|
|
<template>
|
|
{{#if this.shouldRender}}
|
|
<DButton
|
|
@icon="xmark"
|
|
@action={{@onLeaveChannel}}
|
|
@title={{this.leaveChatTitleKey}}
|
|
class="btn-flat chat-channel-leave-btn"
|
|
/>
|
|
{{/if}}
|
|
</template>
|
|
}
|