mirror of
https://github.com/zadam/trilium.git
synced 2025-12-13 02:44:24 +01:00
feat(client/server): basic support for experimental features
This commit is contained in:
parent
1ceed1b47b
commit
ae154212fe
13
apps/client/src/services/experimental_features.ts
Normal file
13
apps/client/src/services/experimental_features.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
interface ExperimentalFeature {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const experimentalFeatures: ExperimentalFeature[] = [
|
||||||
|
{
|
||||||
|
id: "newLayout",
|
||||||
|
name: "New Layout",
|
||||||
|
description: "Try out the new layout for a more modern look and improved usability.",
|
||||||
|
}
|
||||||
|
];
|
||||||
@ -7,6 +7,9 @@ import FormText from "../../react/FormText";
|
|||||||
import OptionsSection from "./components/OptionsSection"
|
import OptionsSection from "./components/OptionsSection"
|
||||||
import Column from "../../react/Column";
|
import Column from "../../react/Column";
|
||||||
import { useEffect, useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
|
import CheckboxList from "./components/CheckboxList";
|
||||||
|
import { experimentalFeatures } from "../../../services/experimental_features";
|
||||||
|
import { useTriliumOptionJson } from "../../react/hooks";
|
||||||
|
|
||||||
export default function AdvancedSettings() {
|
export default function AdvancedSettings() {
|
||||||
return <>
|
return <>
|
||||||
@ -14,6 +17,7 @@ export default function AdvancedSettings() {
|
|||||||
<DatabaseIntegrityOptions />
|
<DatabaseIntegrityOptions />
|
||||||
<DatabaseAnonymizationOptions />
|
<DatabaseAnonymizationOptions />
|
||||||
<VacuumDatabaseOptions />
|
<VacuumDatabaseOptions />
|
||||||
|
<ExperimentalOptions />
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,3 +177,20 @@ function VacuumDatabaseOptions() {
|
|||||||
</OptionsSection>
|
</OptionsSection>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ExperimentalOptions() {
|
||||||
|
const [ enabledExperimentalFeatures, setEnabledExperimentalFeatures ] = useTriliumOptionJson<string[]>("experimentalFeatures");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<OptionsSection title="Experimental Options">
|
||||||
|
<FormText>These options are experimental and may cause instability. Use with caution.</FormText>
|
||||||
|
|
||||||
|
<CheckboxList
|
||||||
|
values={experimentalFeatures}
|
||||||
|
keyProperty="id"
|
||||||
|
titleProperty="name"
|
||||||
|
currentValue={enabledExperimentalFeatures} onChange={setEnabledExperimentalFeatures}
|
||||||
|
/>
|
||||||
|
</OptionsSection>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@ -99,6 +99,7 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([
|
|||||||
"showLoginInShareTheme",
|
"showLoginInShareTheme",
|
||||||
"splitEditorOrientation",
|
"splitEditorOrientation",
|
||||||
"seenCallToActions",
|
"seenCallToActions",
|
||||||
|
"experimentalFeatures",
|
||||||
|
|
||||||
// AI/LLM integration options
|
// AI/LLM integration options
|
||||||
"aiEnabled",
|
"aiEnabled",
|
||||||
|
|||||||
@ -215,7 +215,8 @@ const defaultOptions: DefaultOption[] = [
|
|||||||
{ name: "aiSystemPrompt", value: "", isSynced: true },
|
{ name: "aiSystemPrompt", value: "", isSynced: true },
|
||||||
{ name: "aiSelectedProvider", value: "openai", isSynced: true },
|
{ name: "aiSelectedProvider", value: "openai", isSynced: true },
|
||||||
|
|
||||||
{ name: "seenCallToActions", value: "[]", isSynced: true }
|
{ name: "seenCallToActions", value: "[]", isSynced: true },
|
||||||
|
{ name: "experimentalFeatures", value: "[]", isSynced: true }
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -155,6 +155,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi
|
|||||||
codeOpenAiModel: string;
|
codeOpenAiModel: string;
|
||||||
aiSelectedProvider: string;
|
aiSelectedProvider: string;
|
||||||
seenCallToActions: string;
|
seenCallToActions: string;
|
||||||
|
experimentalFeatures: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OptionNames = keyof OptionDefinitions;
|
export type OptionNames = keyof OptionDefinitions;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user