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(notes): give recorded meetings a conversation icon
Elian Doranb5ea27862e0e
diff --git a/apps/client/src/widgets/launch_bar/RecordMeetingButton.tsx b/apps/client/src/widgets/launch_bar/RecordMeetingButton.tsxindex a62a76731b..041f8fec5e 100644--- a/apps/client/src/widgets/launch_bar/RecordMeetingButton.tsx+++ b/apps/client/src/widgets/launch_bar/RecordMeetingButton.tsx@@ -1,6 +1,8 @@import "./RecordMeetingButton.css";-import { dayjs, type TranscriptionState, type TranscriptionStatus } from "@triliumnext/commons";+import {+ dayjs, MEETING_RECORDING_LABEL, type TranscriptionState, type TranscriptionStatus+} from "@triliumnext/commons";import { useCallback, useEffect, useState } from "preact/hooks";import dateNoteService from "../../services/date_notes";@@ -13,9 +15,6 @@ import {useLauncherIconAndTitle} from "./launch_bar_widgets";-/** The label that identifies a note created by this launcher. */-export const MEETING_RECORDING_LABEL = "meetingRecording";-/*** Launcher button that records a meeting: the first click creates the meeting note and starts the* recording, the second stops it. Desktop only, since the main process does the recording.diff --git a/packages/commons/src/lib/notes.spec.ts b/packages/commons/src/lib/notes.spec.tsindex 6fc02cd59d..9769e13068 100644--- a/packages/commons/src/lib/notes.spec.ts+++ b/packages/commons/src/lib/notes.spec.ts@@ -3,8 +3,8 @@ import { describe, expect, it } from "vitest";import {CALENDAR_EVENT_ICON, CANVAS_ATTACHMENT_MIME, GEO_LOCATION_ATTRIBUTE, GEO_SHAPE_ATTRIBUTE, getContentRendererGroup,getImageAttachmentTitle, getMimeIcon, getNoteContentType, getNoteIcon, isFullWidthNoteType,- MAP_POSITION_ATTRIBUTE, MAP_SHAPE_ATTRIBUTE, NOTE_TYPE_ICONS, NOTE_TYPE_IMAGE_ATTACHMENTS,- parseMindMapNoteLink+ MAP_POSITION_ATTRIBUTE, MAP_SHAPE_ATTRIBUTE, MEETING_RECORDING_ICON, MEETING_RECORDING_LABEL,+ NOTE_TYPE_ICONS, NOTE_TYPE_IMAGE_ATTACHMENTS, parseMindMapNoteLink} from "./notes.js";import { NoteType } from "./rows.js";@@ -126,6 +126,20 @@ describe("getNoteIcon", () => {}});+ it("draws a recorded meeting by its label, ahead of a start date and the folder icon", () => {+ const labelled = (labels: Record<string, string>) => (name: string) => labels[name] ?? null;+ const meeting = labelled({ [MEETING_RECORDING_LABEL]: "" });++ expect(getNoteIcon(buildArgs({ getLabelValue: meeting }))).toBe(MEETING_RECORDING_ICON);+ expect(getNoteIcon(buildArgs({ getLabelValue: meeting, isFolder: () => true })))+ .toBe(MEETING_RECORDING_ICON);+ expect(getNoteIcon(buildArgs({+ getLabelValue: labelled({ [MEETING_RECORDING_LABEL]: "", startDate: "2026-10-13" })+ }))).toBe(MEETING_RECORDING_ICON);+ expect(getNoteIcon(buildArgs({ getLabelValue: meeting, iconClass: "bx bx-star" })))+ .toBe("bx bx-star");+ });+it("draws a calendar event by its start date, under its own name where it renames it", () => {const labelled = (labels: Record<string, string>) => (name: string) => labels[name] ?? null;diff --git a/packages/commons/src/lib/notes.ts b/packages/commons/src/lib/notes.tsindex b3a708b1cf..13ad42dd3f 100644--- a/packages/commons/src/lib/notes.ts+++ b/packages/commons/src/lib/notes.ts@@ -145,6 +145,12 @@ export const CLIP_TYPE_ICONS: ReadonlyMap<string, string> = new Map([/** The icon of a calendar event, a text note with a start date (see {@link getEventStartDate}). */export const CALENDAR_EVENT_ICON = "bx bx-calendar-event";+/** The label on a note created by the "Record meeting" launcher. It has no value. */+export const MEETING_RECORDING_LABEL = "meetingRecording";++/** The icon of a note carrying {@link MEETING_RECORDING_LABEL}. */+export const MEETING_RECORDING_ICON = "bx bx-conversation";+/*** The icon a note is drawn under: its own `#iconClass` where it has one, and a default read off* what the note is otherwise.@@ -155,7 +161,8 @@ export const CALENDAR_EVENT_ICON = "bx bx-calendar-event";* hands down through* `#child:iconClass` or a template still applies, and redrawing a shape as another kind changes the* icon with it. A note the web clipper made is drawn by its `#clipType` ({@link CLIP_TYPE_ICONS}),- * and a calendar event by {@link CALENDAR_EVENT_ICON}.+ * a recorded meeting by {@link MEETING_RECORDING_ICON}, and a calendar event by+ * {@link CALENDAR_EVENT_ICON}.* `iconClass` stays an argument rather than being read here because the share tree* narrows it to the prefixes an icon pack supplies.*/@@ -194,6 +201,9 @@ export function getNoteIcon({if (clipIcon) {return clipIcon;}+ if (getLabelValue(MEETING_RECORDING_LABEL) !== null) {+ return MEETING_RECORDING_ICON;+ }if (getEventStartDate(getLabelValue)) {return CALENDAR_EVENT_ICON;}