From 761a67f2388e98ee5f5c9633ff83617aa7ed334c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 27 Dec 2025 20:37:59 +0200 Subject: [PATCH] feat(note_icon): display icon pack in note title --- .../client/src/translations/en/translation.json | 3 ++- apps/client/src/widgets/note_icon.tsx | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 6af105306..c16029896 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -769,7 +769,8 @@ "reset-default": "Reset to default icon", "filter": "Filter", "filter-none": "All icons", - "filter-default": "Default icons" + "filter-default": "Default icons", + "icon_tooltip": "{{name}}\nIcon pack: {{iconPack}}" }, "basic_properties": { "note_type": "Note type", diff --git a/apps/client/src/widgets/note_icon.tsx b/apps/client/src/widgets/note_icon.tsx index e70f2ae20..7ce5e020f 100644 --- a/apps/client/src/widgets/note_icon.tsx +++ b/apps/client/src/widgets/note_icon.tsx @@ -21,7 +21,7 @@ interface IconToCountCache { interface IconData { iconToCount: Record; - icons: IconRegistry["sources"][number]["icons"]; + icons: (IconRegistry["sources"][number]["icons"][number] & { iconPack: string })[]; } let iconToCountCache!: Promise | null; @@ -65,8 +65,11 @@ function NoteIconList({ note, dropdownRef }: { useEffect(() => { async function loadIcons() { // Filter by text and/or category. - let icons: IconRegistry["sources"][number]["icons"] = [ - ...glob.iconRegistry.sources.map(s => s.icons).flat() + let icons: IconData["icons"] = [ + ...glob.iconRegistry.sources.map(s => s.icons.map((i) => ({ + ...i, + iconPack: s.name, + }))).flat() ]; const processedSearch = search?.trim()?.toLowerCase(); if (processedSearch || filterByPrefix !== null) { @@ -162,8 +165,12 @@ function NoteIconList({ note, dropdownRef }: { dropdownRef?.current?.hide(); }} > - {(iconData?.icons ?? []).map(({ id, terms }) => ( - + {(iconData?.icons ?? []).map(({ id, terms, iconPack }) => ( + ))}