feat(right_pane_widget): hide highlights if disabled in settings

This commit is contained in:
Elian Doran 2025-12-19 23:25:58 +02:00
parent e94704ce64
commit c0cd9e36d9
No known key found for this signature in database

View File

@ -8,7 +8,7 @@ import { t } from "../../services/i18n";
import options from "../../services/options";
import { DEFAULT_GUTTER_SIZE } from "../../services/resizer";
import Button from "../react/Button";
import { useActiveNoteContext, useNoteProperty, useTriliumOptionBool } from "../react/hooks";
import { useActiveNoteContext, useNoteProperty, useTriliumOptionBool, useTriliumOptionJson } from "../react/hooks";
import Icon from "../react/Icon";
import HighlightsList from "./HighlightsList";
import TableOfContents from "./TableOfContents";
@ -17,13 +17,14 @@ const MIN_WIDTH_PERCENT = 5;
export default function RightPanelContainer() {
const [ rightPaneVisible, setRightPaneVisible ] = useTriliumOptionBool("rightPaneVisible");
const [ highlightsList ] = useTriliumOptionJson<string[]>("highlightsList");
useSplit(rightPaneVisible);
const { note } = useActiveNoteContext();
const noteType = useNoteProperty(note, "type");
const items = (rightPaneVisible ? [
(noteType === "text" || noteType === "doc") && <TableOfContents />,
noteType === "text" && <HighlightsList />
noteType === "text" && highlightsList.length > 0 && <HighlightsList />
] : []).filter(Boolean);
return (