Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(layout): button to toggle right pane on horizontal layout
Elian Doran9acef4d502d6
diff --git a/apps/client/src/layouts/desktop_layout.tsx b/apps/client/src/layouts/desktop_layout.tsxindex af47fd4788..a4f60aa05a 100644--- a/apps/client/src/layouts/desktop_layout.tsx+++ b/apps/client/src/layouts/desktop_layout.tsx@@ -9,6 +9,7 @@ import CreatePaneButton from "../widgets/buttons/create_pane_button.js";import GlobalMenu from "../widgets/buttons/global_menu.jsx";import LeftPaneToggle from "../widgets/buttons/left_pane_toggle.js";import MovePaneButton from "../widgets/buttons/move_pane_button.js";+import RightPaneToggle from "../widgets/buttons/right_pane_toggle.jsx";import CloseZenModeButton from "../widgets/close_zen_button.jsx";import NoteList from "../widgets/collections/NoteList.jsx";import ContentHeader from "../widgets/containers/content_header.js";@@ -91,6 +92,7 @@ export default class DesktopLayout {.optChild(launcherPaneIsHorizontal, <LeftPaneToggle isHorizontalLayout={true} />).child(<TabHistoryNavigationButtons />).child(new TabRowWidget().class("full-width"))+ .optChild(launcherPaneIsHorizontal && isNewLayout, <RightPaneToggle />).optChild(customTitleBarButtons, <TitleBarButtons />).css("height", "40px").css("background-color", "var(--launcher-pane-background-color)")diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex c7aeaf50c4..077d24fac5 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -2199,6 +2199,7 @@},"right_pane": {"empty_message": "Nothing to show for this note",- "empty_button": "Hide the panel"+ "empty_button": "Hide the panel",+ "toggle": "Toggle right panel"}}diff --git a/apps/client/src/widgets/buttons/right_pane_toggle.tsx b/apps/client/src/widgets/buttons/right_pane_toggle.tsxnew file mode 100644index 0000000000..53bf67ae20--- /dev/null+++ b/apps/client/src/widgets/buttons/right_pane_toggle.tsx@@ -0,0 +1,21 @@+import clsx from "clsx";++import { t } from "../../services/i18n";+import ActionButton from "../react/ActionButton";+import { useTriliumOptionBool } from "../react/hooks";++export default function RightPaneToggle() {+ const [ rightPaneVisible, setRightPaneVisible ] = useTriliumOptionBool("rightPaneVisible");++ return (+ <ActionButton+ className={clsx(+ `toggle-button right-pane-toggle-button bx-flip-horizontal`,+ rightPaneVisible ? "action-collapse" : "action-expand"+ )}+ text={t("right_pane.toggle")}+ icon="bx bx-sidebar"+ onClick={() => setRightPaneVisible(!rightPaneVisible)}+ />+ );+}