Skip to content

Build your personal knowledge base with Trilium Notes

feat(transcription): mark transcription as beta

Elian Doran0e2db8150997
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index c6a9de193c..573e1858fe 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -4230,7 +4230,8 @@
"fullscreen": "Fullscreen",
"exit_fullscreen": "Exit fullscreen",
"open_in_new_tab": "Open in new tab",
- "more_actions": "More actions"
+ "more_actions": "More actions",
+ "beta": "Beta"
},
"spreadsheet": {
"read-only": "This note is read-only.",
diff --git a/apps/client/src/widgets/dialogs/OptionsDialog.tsx b/apps/client/src/widgets/dialogs/OptionsDialog.tsx
index 04b81874c3..7c735f41c7 100644
--- a/apps/client/src/widgets/dialogs/OptionsDialog.tsx
+++ b/apps/client/src/widgets/dialogs/OptionsDialog.tsx
@@ -284,6 +284,7 @@ function MobileSettingsList({ onSelect }: { onSelect: (noteId: string) => void }
icon={page.getIcon()}
value={page.noteId}
active={page.noteId === activeNoteId}
+ badges={page.hasLabel("beta") ? [ { text: t("common.beta") } ] : undefined}
>
{page.title}
</FormListItem>
diff --git a/apps/client/src/widgets/launch_bar/RecordMeetingButton.css b/apps/client/src/widgets/launch_bar/RecordMeetingButton.css
index c2deb6e5c9..1b4b7d9c2c 100644
--- a/apps/client/src/widgets/launch_bar/RecordMeetingButton.css
+++ b/apps/client/src/widgets/launch_bar/RecordMeetingButton.css
@@ -1,3 +1,20 @@
.launcher-button.record-meeting-active {
color: var(--danger-color, #dc3545);
}
+
+.record-meeting-launcher {
+ position: relative;
+
+ .record-meeting-beta-badge {
+ --color: var(--link-color, var(--main-text-color));
+ --badge-radius: 4px;
+ position: absolute;
+ inset-inline-end: var(--launcher-pane-button-margin, 0);
+ bottom: var(--launcher-pane-button-gap, 0);
+ height: auto;
+ padding-inline: 3px;
+ font-size: 0.55rem;
+ line-height: 1.4;
+ pointer-events: none;
+ }
+}
diff --git a/apps/client/src/widgets/launch_bar/RecordMeetingButton.spec.tsx b/apps/client/src/widgets/launch_bar/RecordMeetingButton.spec.tsx
index 693b2b9575..cb6f513962 100644
--- a/apps/client/src/widgets/launch_bar/RecordMeetingButton.spec.tsx
+++ b/apps/client/src/widgets/launch_bar/RecordMeetingButton.spec.tsx
@@ -149,6 +149,12 @@ describe("toggleRecording", () => {
});
describe("RecordMeetingButton", () => {
+ it("marks the launcher as beta", () => {
+ const container = renderInto(<RecordMeetingButton launcherNote={{} as FNote} />);
+ expect(container.querySelector(".record-meeting-launcher .record-meeting-beta-badge")?.textContent)
+ .toContain("common.beta");
+ });
+
it("says once why a recording stopped by itself", async () => {
let onStateChanged: (state: TranscriptionState) => void = () => {};
const report = (state: Partial<TranscriptionState>) => act(() => onStateChanged({
diff --git a/apps/client/src/widgets/launch_bar/RecordMeetingButton.tsx b/apps/client/src/widgets/launch_bar/RecordMeetingButton.tsx
index 83866bfc80..08ea00fe58 100644
--- a/apps/client/src/widgets/launch_bar/RecordMeetingButton.tsx
+++ b/apps/client/src/widgets/launch_bar/RecordMeetingButton.tsx
@@ -12,6 +12,7 @@ import { t } from "../../services/i18n";
import noteCreateService from "../../services/note_create";
import options from "../../services/options";
import toast from "../../services/toast";
+import { Badge } from "../react/Badge";
import {
LaunchBarActionButton,
LauncherNoteProps,
@@ -36,11 +37,14 @@ export default function RecordMeetingButton({ launcherNote }: LauncherNoteProps)
}, [ error ]);
return (
- <LaunchBarActionButton
- launcherNote={launcherNote}
- onClick={handleClick}
- {...getAppearance(status, icon, title)}
- />
+ <div className="record-meeting-launcher">
+ <LaunchBarActionButton
+ launcherNote={launcherNote}
+ onClick={handleClick}
+ {...getAppearance(status, icon, title)}
+ />
+ <Badge text={t("common.beta")} className="record-meeting-beta-badge" />
+ </div>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.spec.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.spec.tsx
index 23895c6f6b..51dc98de6d 100644
--- a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.spec.tsx
@@ -25,6 +25,14 @@ describe("OptionsPageHeader", () => {
expect(container.querySelector(".options-page-header-icon")?.className).toContain("bx-palette");
});
+ it("shows a badge beside the page's name, as part of the name", () => {
+ mocks.note = NOTE;
+ const container = renderInto(<OptionsPageHeader badge={<span className="beta">Beta</span>} />);
+
+ expect(container.querySelector(".options-page-header-titles .beta")?.textContent).toBe("Beta");
+ expect(container.querySelector(".options-page-header")?.className).toContain("options-page-header-title-only");
+ });
+
it("marks itself as carrying nothing but the name, which a phone shows elsewhere", () => {
mocks.note = NOTE;
const bare = renderInto(<OptionsPageHeader />);
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx
index 13fd230182..80ba306a22 100644
--- a/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsPageHeader.tsx
@@ -30,6 +30,11 @@ interface OptionsPageHeaderProps {
* where the help is page-level rather than scoped to one card.
*/
helpUrl?: string;
+ /**
+ * Shown beside the title as part of it, such as a "Beta" `Badge`: unlike {@link actions}, it does
+ * not keep a phone from showing the title in the back bar instead.
+ */
+ badge?: ComponentChildren;
/** Title of a page that is not a note of its own, such as the options search. */
title?: string;
/** Icon to go with {@link OptionsPageHeaderProps.title}, in `bx bx-…` form. */
@@ -47,7 +52,7 @@ interface OptionsPageHeaderProps {
* header the same way in all of them.
*/
export default function OptionsPageHeader({
- actions, below, helpUrl, title, icon
+ actions, below, badge, helpUrl, title, icon
}: OptionsPageHeaderProps) {
const { note } = useNoteContext();
const shownTitle = title ?? note?.title;
@@ -76,6 +81,7 @@ export default function OptionsPageHeader({
<div className="options-page-header-titles">
<span className={`options-page-header-icon ${shownIcon}`} aria-hidden="true" />
<h2 className="options-page-header-title">{shownTitle}</h2>
+ {badge}
{helpUrl && !liftHelp &&
<HelpButton className="options-page-header-help" helpPage={helpUrl} />}
</div>
diff --git a/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.css b/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.css
index f9c65bacda..e00c03bf17 100644
--- a/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.css
+++ b/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.css
@@ -39,3 +39,8 @@
white-space: nowrap;
text-overflow: ellipsis;
}
+
+.settings-navigation .settings-navigation-beta-badge {
+ --color: var(--link-color, var(--main-text-color));
+ flex-shrink: 0;
+}
diff --git a/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.spec.tsx b/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.spec.tsx
index d4c135279c..7a762afaa0 100644
--- a/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.spec.tsx
@@ -3,9 +3,16 @@ import { describe, expect, it, vi } from "vitest";
import { renderInto } from "../../../../test/render";
const mocks = vi.hoisted(() => ({
- pages: [] as { noteId: string; title: string; getIcon: () => string }[]
+ pages: [] as {
+ noteId: string;
+ title: string;
+ getIcon: () => string;
+ hasLabel: (name: string) => boolean;
+ }[]
}));
+vi.mock("../../../../services/i18n", () => ({ t: (key: string) => key }));
+
// The list is read straight from the `_options` subtree, so titles, icons and ordering stay in step
// with the note tree rather than being restated here.
vi.mock("../../../dialogs/OptionsDialog", () => ({ useOptionPages: () => mocks.pages }));
@@ -13,8 +20,8 @@ vi.mock("../../../dialogs/OptionsDialog", () => ({ useOptionPages: () => mocks.p
import SettingsNavigation from "./SettingsNavigation";
const PAGES = [
- { noteId: "_optionsAppearance", title: "Appearance", getIcon: () => "bx bx-palette" },
- { noteId: "_optionsShortcuts", title: "Shortcuts", getIcon: () => "bx bx-keyboard" }
+ { noteId: "_optionsAppearance", title: "Appearance", getIcon: () => "bx bx-palette", hasLabel: () => false },
+ { noteId: "_optionsShortcuts", title: "Shortcuts", getIcon: () => "bx bx-keyboard", hasLabel: () => false }
];
describe("SettingsNavigation", () => {
@@ -47,6 +54,20 @@ describe("SettingsNavigation", () => {
expect(links[1].getAttribute("aria-current")).toBe("page");
});
+ it("marks a page labeled #beta as beta", () => {
+ mocks.pages = [
+ ...PAGES,
+ {
+ noteId: "_optionsTranscription", title: "Transcription", getIcon: () => "bx bx-microphone",
+ hasLabel: (name) => name === "beta"
+ }
+ ];
+ const links = [ ...renderInto(<SettingsNavigation activeNoteId="_optionsAppearance" />).querySelectorAll("a") ];
+
+ expect(links.map((link) => link.querySelector(".ext-badge")?.textContent ?? null))
+ .toEqual([ null, null, "common.beta" ]);
+ });
+
it("draws an empty list rather than failing when the subtree has nothing to show", () => {
mocks.pages = [];
const container = renderInto(<SettingsNavigation activeNoteId="_optionsAppearance" />);
diff --git a/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.tsx b/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.tsx
index 3e993eb5b5..4bb79e8c53 100644
--- a/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.tsx
@@ -2,7 +2,9 @@ import "./SettingsNavigation.css";
import clsx from "clsx";
+import { t } from "../../../../services/i18n";
import { useOptionPages } from "../../../dialogs/OptionsDialog";
+import { Badge } from "../../../react/Badge";
interface SettingsNavigationProps {
/** Note ID of the settings page currently being displayed (e.g. `_optionsAppearance`). */
@@ -10,7 +12,8 @@ interface SettingsNavigationProps {
}
/**
- * In-content selector for the settings pages, rendered alongside the active options page.
+ * In-content selector for the settings pages, rendered alongside the active options page. A page
+ * labeled `#beta` in the hidden subtree carries a "Beta" badge.
*
* It mirrors the list of pages otherwise reached through the note tree, reading them straight from
* the `_options` subtree so titles, icons and ordering stay in sync. Each entry is a plain internal
@@ -33,6 +36,9 @@ export default function SettingsNavigation({ activeNoteId }: SettingsNavigationP
>
<span className={page.getIcon()} />
<span className="settings-navigation-title">{page.title}</span>
+ {page.hasLabel("beta") && (
+ <Badge text={t("common.beta")} className="settings-navigation-beta-badge" outline />
+ )}
</a>
);
})}
diff --git a/apps/client/src/widgets/type_widgets/options/transcription.css b/apps/client/src/widgets/type_widgets/options/transcription.css
index b1699f0f1f..2eaa8c7823 100644
--- a/apps/client/src/widgets/type_widgets/options/transcription.css
+++ b/apps/client/src/widgets/type_widgets/options/transcription.css
@@ -1,3 +1,7 @@
.transcription-keep-recordings .switch-widget {
--switch-on-track-background: var(--dropdown-item-icon-destructive-color);
}
+
+.transcription-beta-badge {
+ --color: var(--link-color, var(--main-text-color));
+}
diff --git a/apps/client/src/widgets/type_widgets/options/transcription.spec.tsx b/apps/client/src/widgets/type_widgets/options/transcription.spec.tsx
index 1733881034..3ed09e95ea 100644
--- a/apps/client/src/widgets/type_widgets/options/transcription.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/options/transcription.spec.tsx
@@ -1,4 +1,4 @@
-import { render } from "preact";
+import { type ComponentChildren, render } from "preact";
import { act } from "preact/test-utils";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -31,7 +31,9 @@ vi.mock("../../react/hooks", async (importOriginal) => ({
}));
-vi.mock("./components/OptionsPageHeader", () => ({ default: () => <div className="header-stub" /> }));
+vi.mock("./components/OptionsPageHeader", () => ({
+ default: ({ badge }: { badge?: ComponentChildren }) => <div className="header-stub">{badge}</div>
+}));
import TranscriptionSettings from "./transcription";
@@ -121,6 +123,11 @@ describe("TranscriptionSettings", () => {
expect(host.querySelector(".directory-location-path")?.textContent).toBe("/data/transcription-recordings");
});
+ it("marks the page as beta", () => {
+ open();
+ expect(host.querySelector(".header-stub .ext-badge")?.textContent).toBe("common.beta");
+ });
+
it("shows the default model for a value it does not know", () => {
mocks.stored = "whisper";
expect(open()?.value).toBe("parakeet-int8");
diff --git a/apps/client/src/widgets/type_widgets/options/transcription.tsx b/apps/client/src/widgets/type_widgets/options/transcription.tsx
index 1dded592bf..3118e41676 100644
--- a/apps/client/src/widgets/type_widgets/options/transcription.tsx
+++ b/apps/client/src/widgets/type_widgets/options/transcription.tsx
@@ -5,6 +5,7 @@ import { useEffect, useState } from "preact/hooks";
import { t } from "../../../services/i18n";
import { isElectron } from "../../../services/utils";
+import { Badge } from "../../react/Badge";
import { Card, OptionCardSection } from "../../react/Card";
import { DirectoryLocation } from "../../react/DirectoryLink";
import FormSelect from "../../react/FormSelect";
@@ -25,7 +26,9 @@ export default function TranscriptionSettings() {
return (
<>
- <OptionsPageHeader />
+ <OptionsPageHeader
+ badge={<Badge text={t("common.beta")} className="transcription-beta-badge" outline />}
+ />
<RecognitionSettings />
<TroubleshootingSettings />
</>
diff --git a/packages/trilium-core/src/services/hidden_subtree.ts b/packages/trilium-core/src/services/hidden_subtree.ts
index 59e430651a..b48fb2fa12 100644
--- a/packages/trilium-core/src/services/hidden_subtree.ts
+++ b/packages/trilium-core/src/services/hidden_subtree.ts
@@ -325,7 +325,7 @@ function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenS
{ id: "_optionsMedia", title: t("hidden-subtree.images-title"), type: "contentWidget", icon: "bx-image" },
{ id: "_optionsContentManager", title: t("hidden-subtree.content-manager-title"), type: "contentWidget", icon: "bx-package" },
{ id: "_optionsSpellcheck", title: t("hidden-subtree.spellcheck-title"), type: "contentWidget", icon: "bx-check-double", attributes: [{ type: "label", name: "electronOnly" }] },
- { id: "_optionsTranscription", title: t("hidden-subtree.transcription-title"), type: "contentWidget", icon: "bx-microphone", attributes: [{ type: "label", name: "electronOnly" }] },
+ { id: "_optionsTranscription", title: t("hidden-subtree.transcription-title"), type: "contentWidget", icon: "bx-microphone", attributes: [{ type: "label", name: "electronOnly" }, { type: "label", name: "beta" }] },
// Integrations
{ id: "_optionsAi", title: "AI Chat", type: "contentWidget", enforceDeleted: true },