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): move revisions button to note actions
Elian Doran1e72ebd1041f
diff --git a/apps/client/src/services/experimental_features.ts b/apps/client/src/services/experimental_features.tsindex f01b5ab02e..7daf3c210d 100644--- a/apps/client/src/services/experimental_features.ts+++ b/apps/client/src/services/experimental_features.ts@@ -6,13 +6,13 @@ interface ExperimentalFeature {description: string;}-export const experimentalFeatures: ExperimentalFeature[] = [+export const experimentalFeatures = [{id: "new-layout",name: "New Layout",description: "Try out the new layout for a more modern look and improved usability.",}-];+] as const satisfies ExperimentalFeature[];type ExperimentalFeatureId = typeof experimentalFeatures[number]["id"];@@ -28,7 +28,7 @@ export function getEnabledExperimentalFeatureIds() {function getEnabledFeatures() {if (!enabledFeatures) {- const features = JSON.parse(options.get("experimentalFeatures")) as string[];+ const features = JSON.parse(options.get("experimentalFeatures")) as ExperimentalFeatureId[];enabledFeatures = new Set(features);}return enabledFeatures;diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsxindex be2b792515..f5a69df2ac 100644--- a/apps/client/src/widgets/ribbon/NoteActions.tsx+++ b/apps/client/src/widgets/ribbon/NoteActions.tsx@@ -16,12 +16,15 @@ import Dropdown from "../react/Dropdown";import { FormDropdownDivider, FormListHeader, FormListItem } from "../react/FormList";import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useNoteProperty, useTriliumOption } from "../react/hooks";import { ParentComponent } from "../react/react_utils";+import { isExperimentalFeatureEnabled } from "../../services/experimental_features";++const isNewLayout = isExperimentalFeatureEnabled("new-layout");export default function NoteActions() {const { note, noteContext } = useNoteContext();return (<div className="ribbon-button-container" style={{ contain: "none" }}>- {note && <RevisionsButton note={note} />}+ {note && !isNewLayout && <RevisionsButton note={note} />}{note && note.type !== "launcher" && <NoteContextMenu note={note as FNote} noteContext={noteContext} />}</div>);@@ -95,6 +98,7 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not}<FormDropdownDivider />+ <CommandItem command="showRevisions" icon="bx bx-history" text={t("revisions_button.note_revisions")} /><CommandItem command="forceSaveRevision" icon="bx bx-save" disabled={isInOptionsOrHelp} text={t("note_actions.save_revision")} /><CommandItem icon="bx bx-trash destructive-action-icon" text={t("note_actions.delete_note")} destructivedisabled={isInOptionsOrHelp}