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/controllers/chat.js
2023-02-10 12:31:29 +07:00

42 lines
916 B
JavaScript

import Controller from "@ember/controller";
import { inject as service } from "@ember/service";
export default class ChatController extends Controller {
@service chat;
@service chatStateManager;
@service router;
get shouldUseChatSidebar() {
if (this.site.mobileView) {
return false;
}
if (this.shouldUseCoreSidebar) {
return false;
}
return true;
}
get shouldUseCoreSidebar() {
return this.siteSettings.navigation_menu === "sidebar";
}
get mainOutletModifierClasses() {
let modifierClasses = [];
if (this.chatStateManager.isSidePanelExpanded) {
modifierClasses.push("has-side-panel-expanded");
}
if (
!this.router.currentRouteName.startsWith("chat.channel.info") &&
!this.router.currentRouteName.startsWith("chat.browse")
) {
modifierClasses.push("chat-view");
}
return modifierClasses.join(" ");
}
}