feat(note_actions): integrate template switch into new layout

This commit is contained in:
Elian Doran 2025-12-10 18:43:34 +02:00
parent b36a0bd10b
commit 9262f94190
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View File

@ -33,7 +33,7 @@ export default function BasicPropertiesTab({ note }: TabContext) {
<EditabilitySelect note={note} />
{!isNewLayout && <BookmarkSwitch note={note} />}
{!isNewLayout && <SharedSwitch note={note} />}
<TemplateSwitch note={note} />
{!isNewLayout && <TemplateSwitch note={note} />}
<NoteLanguageSwitch note={note} />
</div>
);
@ -247,7 +247,7 @@ function TemplateSwitch({ note }: { note?: FNote | null }) {
currentValue={isTemplate} onChange={setIsTemplate}
/>
</div>
)
);
}
function SharedSwitch({ note }: { note?: FNote | null }) {

View File

@ -14,7 +14,7 @@ import ws from "../../services/ws";
import ActionButton from "../react/ActionButton";
import Dropdown from "../react/Dropdown";
import { FormDropdownDivider, FormDropdownSubmenu, FormListItem, FormListToggleableItem } from "../react/FormList";
import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useNoteProperty, useTriliumOption } from "../react/hooks";
import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumOption } from "../react/hooks";
import { ParentComponent } from "../react/react_utils";
import { isExperimentalFeatureEnabled } from "../../services/experimental_features";
import { useNoteBookmarkState, useShareState } from "./BasicPropertiesTab";
@ -119,10 +119,12 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not
function NoteBasicProperties({ note }: { note: FNote }) {
const [ isBookmarked, setIsBookmarked ] = useNoteBookmarkState(note);
const [ isShared, switchShareState ] = useShareState(note);
const [ isTemplate, setIsTemplate ] = useNoteLabelBoolean(note, "template");
return <>
<FormListToggleableItem icon="bx bx-bookmark" title={t("bookmark_switch.bookmark")} currentValue={isBookmarked} onChange={setIsBookmarked} />
<FormListToggleableItem icon="bx bx-share-alt" title={t("shared_switch.shared")} currentValue={isShared} onChange={switchShareState} />
<FormListToggleableItem icon="bx bx-copy-alt" title={t("template_switch.template")} currentValue={isTemplate} onChange={setIsTemplate} />
</>;
}