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

`routeAction` is an old and bad pattern we don't want to have in the codebase anymore.


Co-authored-by: Jarek Radosz <jarek@cvx.dev>
This commit is contained in:
Joffrey JAFFEUX 2024-08-17 17:45:18 +02:00 committed by GitHub
parent 3e69f31e0b
commit e7b7886d83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 8 deletions

View File

@ -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"