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:
parent
3e69f31e0b
commit
e7b7886d83
|
@ -2,9 +2,10 @@ import Component from "@glimmer/component";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DButton from "discourse/components/d-button";
|
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 SidebarSectionForm from "discourse/components/modal/sidebar-section-form";
|
||||||
import PluginOutlet from "discourse/components/plugin-outlet";
|
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";
|
import { MAIN_PANEL } from "discourse/lib/sidebar/panels";
|
||||||
|
|
||||||
export default class SidebarFooter extends Component {
|
export default class SidebarFooter extends Component {
|
||||||
|
@ -26,15 +27,21 @@ export default class SidebarFooter extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get showKeyboardShortcutsButton() {
|
|
||||||
return this.site.desktopView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
manageSections() {
|
manageSections() {
|
||||||
this.modal.show(SidebarSectionForm);
|
this.modal.show(SidebarSectionForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
showKeyboardShortcuts() {
|
||||||
|
this.modal.show(KeyboardShortcutsHelp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
toggleMobileView() {
|
||||||
|
mobile.toggleMobileView();
|
||||||
|
}
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="sidebar-footer-wrapper">
|
<div class="sidebar-footer-wrapper">
|
||||||
<div class="sidebar-footer-container">
|
<div class="sidebar-footer-container">
|
||||||
|
@ -52,16 +59,16 @@ export default class SidebarFooter extends Component {
|
||||||
|
|
||||||
{{#if this.showToggleMobileButton}}
|
{{#if this.showToggleMobileButton}}
|
||||||
<DButton
|
<DButton
|
||||||
@action={{routeAction "toggleMobileView"}}
|
@action={{this.toggleMobileView}}
|
||||||
@title={{if this.site.mobileView "desktop_view" "mobile_view"}}
|
@title={{if this.site.mobileView "desktop_view" "mobile_view"}}
|
||||||
@icon={{if this.site.mobileView "desktop" "mobile-alt"}}
|
@icon={{if this.site.mobileView "desktop" "mobile-alt"}}
|
||||||
class="btn-flat sidebar-footer-actions-button sidebar-footer-actions-toggle-mobile-view"
|
class="btn-flat sidebar-footer-actions-button sidebar-footer-actions-toggle-mobile-view"
|
||||||
/>
|
/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if this.showKeyboardShortcutsButton}}
|
{{#if this.site.desktopView}}
|
||||||
<DButton
|
<DButton
|
||||||
@action={{routeAction "showKeyboardShortcutsHelp"}}
|
@action={{this.showKeyboardShortcuts}}
|
||||||
@title="keyboard_shortcuts_help.title"
|
@title="keyboard_shortcuts_help.title"
|
||||||
@icon="keyboard"
|
@icon="keyboard"
|
||||||
class="btn-flat sidebar-footer-actions-button sidebar-footer-actions-keyboard-shortcuts"
|
class="btn-flat sidebar-footer-actions-button sidebar-footer-actions-keyboard-shortcuts"
|
||||||
|
|
Loading…
Reference in New Issue