Skip to content

Build your personal knowledge base with Trilium Notes

feat(transcript): turn "Hide filler words" into an icon toggle

Elian Doran59c1f7775dcd
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index d265ac35c2..b185be1bdd 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -4619,7 +4619,6 @@
"speaking": "Speaking…",
"offset": "{{offset}} into the transcription",
"cleanup": "Hide filler words",
- "cleanup_tooltip": "Hides “uh”, “um” and stuttered words. The transcript itself is not changed.",
"no_audio": "No audio",
"copy": "Copy transcript"
},
diff --git a/apps/client/src/widgets/react/ActionButton.tsx b/apps/client/src/widgets/react/ActionButton.tsx
index c549a2a8cb..5a79e67174 100644
--- a/apps/client/src/widgets/react/ActionButton.tsx
+++ b/apps/client/src/widgets/react/ActionButton.tsx
@@ -12,6 +12,7 @@ import { useCommandTrigger } from "./react_utils";
export interface ActionButtonProps extends Pick<
HTMLAttributes<HTMLButtonElement>,
"onClick" | "onAuxClick" | "onContextMenu" | "onBlur" | "style" | "aria-expanded"
+ | "aria-pressed"
> {
text: string;
titlePosition?: "top" | "right" | "bottom" | "left";
diff --git a/apps/client/src/widgets/type_widgets/transcript/TranscriptView.css b/apps/client/src/widgets/type_widgets/transcript/TranscriptView.css
index ee06e9fea6..ab27dfb8b9 100644
--- a/apps/client/src/widgets/type_widgets/transcript/TranscriptView.css
+++ b/apps/client/src/widgets/type_widgets/transcript/TranscriptView.css
@@ -36,6 +36,12 @@
margin-bottom: 0.5rem;
color: var(--muted-text-color);
font-size: 0.9em;
+
+ .transcript-cleanup.active {
+ --icon-button-color: var(--link-color);
+ --icon-button-hover-color: var(--link-color);
+ color: var(--link-color);
+ }
}
.transcript-turn {
diff --git a/apps/client/src/widgets/type_widgets/transcript/TranscriptView.spec.tsx b/apps/client/src/widgets/type_widgets/transcript/TranscriptView.spec.tsx
index 71d7696dbf..709910e03e 100644
--- a/apps/client/src/widgets/type_widgets/transcript/TranscriptView.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/transcript/TranscriptView.spec.tsx
@@ -601,7 +601,7 @@ describe("TranscriptView", () => {
expect(edges()).toEqual([ "more-above" ]);
});
- it("hides filler words and stutters while the option is on, and saves the switch", async () => {
+ it("hides filler words and stutters while the option is on, and saves the toggle", async () => {
options.set("transcriptCleanupEnabled", "true");
const content = transcript([
{ source: "system", offsetMs: 0, text: "Uh the the data is old." },
@@ -619,12 +619,17 @@ describe("TranscriptView", () => {
await vi.waitFor(() => expect(spans()).toHaveLength(2));
expect(spans()).toEqual([ "The data is old.", " I know, I know." ]);
- const toggle = container.querySelector<HTMLInputElement>(".transcript-options .switch-toggle");
- expect(toggle?.checked).toBe(true);
+ const toggle = container.querySelector<HTMLButtonElement>(
+ ".transcript-options button.transcript-cleanup");
+ expect(toggle?.classList.contains("bx-eraser")).toBe(true);
+ expect(toggle?.classList.contains("active")).toBe(true);
+ expect(toggle?.getAttribute("aria-pressed")).toBe("true");
+ expect(container.querySelector(".transcript-options .switch-toggle")).toBeNull();
await act(async () => {
- toggle?.dispatchEvent(new Event("input", { bubbles: true }));
+ toggle?.click();
});
expect(h.put).toHaveBeenCalledWith("options", { transcriptCleanupEnabled: "false" });
+ expect(toggle?.getAttribute("aria-pressed")).toBe("false");
expect(spans()).toEqual([ "Uh the the data is old.", " Uh.", " I know, I know." ]);
});
diff --git a/apps/client/src/widgets/type_widgets/transcript/TranscriptView.tsx b/apps/client/src/widgets/type_widgets/transcript/TranscriptView.tsx
index 62173bc2ab..051d021a3f 100644
--- a/apps/client/src/widgets/type_widgets/transcript/TranscriptView.tsx
+++ b/apps/client/src/widgets/type_widgets/transcript/TranscriptView.tsx
@@ -16,7 +16,6 @@ import utils from "../../../services/utils";
import { useTranscriptionState } from "../../launch_bar/RecordMeetingButton";
import ActionButton from "../../react/ActionButton";
import FormTextBox from "../../react/FormTextBox";
-import FormToggle from "../../react/FormToggle";
import { useStaticTooltip, useTriliumEvent, useTriliumOptionBool } from "../../react/hooks";
import LinkButton from "../../react/LinkButton";
import NoItems from "../../react/NoItems";
@@ -137,13 +136,13 @@ export default function TranscriptView({ attachment }: { attachment: FAttachment
turns, transcript.startedAt, names,
(utterance) => shownTexts.get(utterance) ?? utterance.text))}
/>
- <FormToggle
- switchOnName={t("transcript.cleanup")}
- switchOffName={t("transcript.cleanup")}
- switchOnTooltip={t("transcript.cleanup_tooltip")}
- switchOffTooltip={t("transcript.cleanup_tooltip")}
- currentValue={isCleanedUp}
- onChange={setCleanedUp}
+ <ActionButton
+ className="transcript-cleanup"
+ icon="bx bx-eraser"
+ text={t("transcript.cleanup")}
+ active={isCleanedUp}
+ aria-pressed={isCleanedUp}
+ onClick={() => setCleanedUp(!isCleanedUp)}
/>
</div>
)}
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Meeting transcription.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Meeting transcription.html
index 24474596b0..917dabd294 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Meeting transcription.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Meeting transcription.html
@@ -74,12 +74,12 @@
The name changes on every turn of that speaker. Press <kbd>Esc</kbd> to cancel,
or clear the name to restore the default one.</li>
<li>To show the transcript with or without hesitations such as "uh", "um"
- and stuttered words, use the <em>Hide filler words</em> switch above it.
- This affects only what is shown; the stored transcript keeps every word.</li>
+ and stuttered words, press the <span class="tn-icon bx bx-eraser"></span> <em>Hide filler words</em> button
+ above it, which shows as pressed while they are hidden. This affects only
+ what is shown; the stored transcript keeps every word.</li>
<li>To copy the transcript as plain text, press the <span class="tn-icon bx bx-copy"></span> <em>Copy transcript</em> button
above it. Each turn is copied with the speaker's name and the time it started,
- as shown, so the copy leaves out filler words while <em>Hide filler words</em> is
- on.</li>
+ as shown, so the copy leaves out filler words while they are hidden.</li>
</ul>
<p>If the meeting note is <a href="#root/_help_bwg0e8ewQMak">protected</a> and
the protected session is locked during the meeting, the transcript cannot
diff --git a/docs/User Guide/User Guide/Meeting transcription.md b/docs/User Guide/User Guide/Meeting transcription.md
index 646d572391..a98ca68ec2 100644
--- a/docs/User Guide/User Guide/Meeting transcription.md
+++ b/docs/User Guide/User Guide/Meeting transcription.md
@@ -36,8 +36,8 @@ The transcript is stored as an [attachment](Basic%20Concepts%20and%20Features/No
* What you say into your microphone is labeled _Me_.
* What the other participants say is labeled _Speaker 1_, _Speaker 2_ and so on, while _Identify speakers_ is on; otherwise it is labeled _Others_.
* To name a speaker, click their name, type the new name and press <kbd>Enter</kbd>. The name changes on every turn of that speaker. Press <kbd>Esc</kbd> to cancel, or clear the name to restore the default one.
-* To show the transcript with or without hesitations such as "uh", "um" and stuttered words, use the _Hide filler words_ switch above it. This affects only what is shown; the stored transcript keeps every word.
-* To copy the transcript as plain text, press the <span class="tn-icon bx bx-copy"></span> _Copy transcript_ button above it. Each turn is copied with the speaker's name and the time it started, as shown, so the copy leaves out filler words while _Hide filler words_ is on.
+* To show the transcript with or without hesitations such as "uh", "um" and stuttered words, press the <span class="tn-icon bx bx-eraser"></span> _Hide filler words_ button above it, which shows as pressed while they are hidden. This affects only what is shown; the stored transcript keeps every word.
+* To copy the transcript as plain text, press the <span class="tn-icon bx bx-copy"></span> _Copy transcript_ button above it. Each turn is copied with the speaker's name and the time it started, as shown, so the copy leaves out filler words while they are hidden.
If the meeting note is [protected](Basic%20Concepts%20and%20Features/Notes/Protected%20Notes.md) and the protected session is locked during the meeting, the transcript cannot be saved. Trilium keeps it in memory and saves it once you enter the protected session again, as long as Trilium stays open.