Skip to content

A platform for community discussion. Free, open, simple.

DEV: removes route action usage from sidebar footer (#28408)

Joffrey JAFFEUXe7b7886d8390
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/footer.gjs b/app/assets/javascripts/discourse/app/components/sidebar/footer.gjs
index 58ddde88fc1..83fc442eba8 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/footer.gjs
+++ b/app/assets/javascripts/discourse/app/components/sidebar/footer.gjs
@@ -2,9 +2,10 @@ import Component from "@glimmer/component";
import { action } from "@ember/object";
import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
+import KeyboardShortcutsHelp from "discourse/components/modal/keyboard-shortcuts-help";
import SidebarSectionForm from "discourse/components/modal/sidebar-section-form";
import PluginOutlet from "discourse/components/plugin-outlet";
-import routeAction from "discourse/helpers/route-action";
+import mobile from "discourse/lib/mobile";
import { MAIN_PANEL } from "discourse/lib/sidebar/panels";
export default class SidebarFooter extends Component {
@@ -26,15 +27,21 @@ export default class SidebarFooter extends Component {
);
}
- get showKeyboardShortcutsButton() {
- return this.site.desktopView;
- }
-
@action
manageSections() {
this.modal.show(SidebarSectionForm);
}
+ @action
+ showKeyboardShortcuts() {
+ this.modal.show(KeyboardShortcutsHelp);
+ }
+
+ @action
+ toggleMobileView() {
+ mobile.toggleMobileView();
+ }
+
<template>
<div class="sidebar-footer-wrapper">
<div class="sidebar-footer-container">
@@ -52,16 +59,16 @@ export default class SidebarFooter extends Component {
{{#if this.showToggleMobileButton}}
<DButton
- @action={{routeAction "toggleMobileView"}}
+ @action={{this.toggleMobileView}}
@title={{if this.site.mobileView "desktop_view" "mobile_view"}}
@icon={{if this.site.mobileView "desktop" "mobile-alt"}}
class="btn-flat sidebar-footer-actions-button sidebar-footer-actions-toggle-mobile-view"
/>
{{/if}}
- {{#if this.showKeyboardShortcutsButton}}
+ {{#if this.site.desktopView}}
<DButton
- @action={{routeAction "showKeyboardShortcutsHelp"}}
+ @action={{this.showKeyboardShortcuts}}
@title="keyboard_shortcuts_help.title"
@icon="keyboard"
class="btn-flat sidebar-footer-actions-button sidebar-footer-actions-keyboard-shortcuts"