feat(layout): move revisions button to note actions

This commit is contained in:
Elian Doran 2025-12-09 20:48:54 +02:00
parent 1184a95697
commit 1e72ebd104
No known key found for this signature in database
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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")} destructive
disabled={isInOptionsOrHelp}