Skip to content

Build your personal knowledge base with Trilium Notes

feat(mobile/split): hide sidebar button for secondary item

Elian Doran309fbab2e621
diff --git a/apps/client/src/widgets/mobile_widgets/toggle_sidebar_button.tsx b/apps/client/src/widgets/mobile_widgets/toggle_sidebar_button.tsx
index d22f3df8c9..8e689954b0 100644
--- a/apps/client/src/widgets/mobile_widgets/toggle_sidebar_button.tsx
+++ b/apps/client/src/widgets/mobile_widgets/toggle_sidebar_button.tsx
@@ -1,18 +1,19 @@
-import { useContext } from "preact/hooks";
import ActionButton from "../react/ActionButton";
-import { ParentComponent } from "../react/react_utils";
import { t } from "../../services/i18n";
+import { useNoteContext } from "../react/hooks";
export default function ToggleSidebarButton() {
- const parentComponent = useContext(ParentComponent);
+ const { noteContext, parentComponent } = useNoteContext();
return (
- <ActionButton
- icon="bx bx-sidebar"
- text={t("note_tree.toggle-sidebar")}
- onClick={() => parentComponent?.triggerCommand("setActiveScreen", {
- screen: "tree"
- })}
- />
+ <div style={{ contain: "none", minWidth: 8 }}>
+ { noteContext?.isMainContext() && <ActionButton
+ icon="bx bx-sidebar"
+ text={t("note_tree.toggle-sidebar")}
+ onClick={() => parentComponent?.triggerCommand("setActiveScreen", {
+ screen: "tree"
+ })}
+ />}
+ </div>
)
}