mirror of
https://github.com/discourse/discourse.git
synced 2026-08-15 17:24:47 +08:00
* DEV: rename chat preferred mobile index to chat preferred index
* UX: change routing to be consistent with mobile
* DEV: change migration file to use script
* UX: show footer only if more than one option is available
* UX: Remove desktopView only checks for chat
* DEV: Remove unused imports
* UX: Update chat footer checks and Add rerouting to chat drawer
* UX: Add margin to chat row in desktop and update chat drawer logic
* UX: Change chat in desktop to use flexbox
* UX: Add drawer actions to chat navbar
* DEV: Update page object with new chat css classes
removed `.open-browse-page-btn` usage in 7bd65006d7
* DEV: rename `browse/open` in chat url to `channels`
* UX: Adjust css for when in threads mode
* DEV: change css class name in no_sidebar_spec.rb
* DEV: rename tests to be more descriptive with the action they are testing
update chat template to not rely on `:has`
* DEV: update test and add method to chat page object
* DEV: update no_sidebar_spec for chat changes
* DEV: remove tests from navigation_spec that no longer apply
* DEV: revert typo in test
* DEV: change url path for mobile chat in test specs
* DEV: Add check for when is desktop in rerouting
* UX: Removed footer from desktop.
Made `hasThreads` and `hasDirectMessages` methods in chat-drawer public
* UX: remove sidebar on desktop full page if dm list is empty
* DEV: Address review comments
* DEV: Adjust reroute logic for chat browse
remove unused code
* UX: Adjust rerouting to go to browse.open
* UX: Change rerouting to be more consistent
Add chat_default_channel_id routing
* UX: Update rerouting configuration for chat routes
* DEV: Update tests with the new chat behavior
* DEV: revert changes made in tests and bring back toggle for drawer
* DEV: revert classes in page objects
* DEV: Add tests to new chat navigation behavior
remove unused stylesheets
revert deleted lines in tests
update concat class logic in chat dm template
* DEV: update css on test
108 lines
3.2 KiB
Text
Vendored
108 lines
3.2 KiB
Text
Vendored
import Component from "@glimmer/component";
|
|
import { service } from "@ember/service";
|
|
import { eq } from "truth-helpers";
|
|
import DButton from "discourse/components/d-button";
|
|
import concatClass from "discourse/helpers/concat-class";
|
|
import i18n from "discourse-common/helpers/i18n";
|
|
import {
|
|
UnreadChannelsIndicator,
|
|
UnreadDirectMessagesIndicator,
|
|
UnreadThreadsIndicator,
|
|
} from "discourse/plugins/chat/discourse/components/chat/footer/unread-indicator";
|
|
|
|
export default class ChatFooter extends Component {
|
|
@service router;
|
|
@service chat;
|
|
@service chatHistory;
|
|
@service siteSettings;
|
|
@service site;
|
|
@service currentUser;
|
|
@service chatChannelsManager;
|
|
@service chatStateManager;
|
|
|
|
get includeThreads() {
|
|
if (!this.siteSettings.chat_threads_enabled) {
|
|
return false;
|
|
}
|
|
return this.chatChannelsManager.hasThreadedChannels;
|
|
}
|
|
|
|
get directMessagesEnabled() {
|
|
return this.chat.userCanAccessDirectMessages;
|
|
}
|
|
|
|
get currentRouteName() {
|
|
const routeName = this.chatHistory.currentRoute?.name;
|
|
return routeName === "chat" ? "chat.channels" : routeName;
|
|
}
|
|
|
|
get enabledRouteCount() {
|
|
return [
|
|
this.includeThreads,
|
|
this.directMessagesEnabled,
|
|
this.siteSettings.enable_public_channels,
|
|
].filter(Boolean).length;
|
|
}
|
|
get shouldRenderFooter() {
|
|
return (
|
|
(this.site.mobileView || this.chatStateManager.isDrawerExpanded) &&
|
|
this.chatStateManager.hasPreloadedChannels &&
|
|
this.enabledRouteCount > 1
|
|
);
|
|
}
|
|
|
|
<template>
|
|
{{#if this.shouldRenderFooter}}
|
|
<nav class="c-footer">
|
|
<DButton
|
|
@route="chat.channels"
|
|
@icon="comments"
|
|
@translatedLabel={{i18n "chat.channel_list.title"}}
|
|
aria-label={{i18n "chat.channel_list.aria_label"}}
|
|
id="c-footer-channels"
|
|
class={{concatClass
|
|
"btn-transparent"
|
|
"c-footer__item"
|
|
(if (eq this.currentRouteName "chat.channels") "--active")
|
|
}}
|
|
>
|
|
<UnreadChannelsIndicator />
|
|
</DButton>
|
|
|
|
{{#if this.directMessagesEnabled}}
|
|
<DButton
|
|
@route="chat.direct-messages"
|
|
@icon="users"
|
|
@translatedLabel={{i18n "chat.direct_messages.title"}}
|
|
aria-label={{i18n "chat.direct_messages.aria_label"}}
|
|
id="c-footer-direct-messages"
|
|
class={{concatClass
|
|
"btn-transparent"
|
|
"c-footer__item"
|
|
(if (eq this.currentRouteName "chat.direct-messages") "--active")
|
|
}}
|
|
>
|
|
<UnreadDirectMessagesIndicator />
|
|
</DButton>
|
|
{{/if}}
|
|
|
|
{{#if this.includeThreads}}
|
|
<DButton
|
|
@route="chat.threads"
|
|
@icon="discourse-threads"
|
|
@translatedLabel={{i18n "chat.my_threads.title"}}
|
|
aria-label={{i18n "chat.my_threads.aria_label"}}
|
|
id="c-footer-threads"
|
|
class={{concatClass
|
|
"btn-transparent"
|
|
"c-footer__item"
|
|
(if (eq this.currentRouteName "chat.threads") "--active")
|
|
}}
|
|
>
|
|
<UnreadThreadsIndicator />
|
|
</DButton>
|
|
{{/if}}
|
|
</nav>
|
|
{{/if}}
|
|
</template>
|
|
}
|