Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(notes): add searchable overflow for long sidebar folders (#2809)

clarkmaanbc4236e1da90
diff --git a/src/components/notes/FolderNotesPopover.tsx b/src/components/notes/FolderNotesPopover.tsx
new file mode 100644
index 000000000..fc3f5d3a0
--- /dev/null
+++ b/src/components/notes/FolderNotesPopover.tsx
@@ -0,0 +1,284 @@
+import { useEffect, useId, useRef, useState } from "react";
+import { useTranslation } from "react-i18next";
+import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
+import { Input } from "../ui/input";
+import { Button } from "../ui/button";
+import { FileText, FolderOpen, MoreHorizontal, Search, X } from "../icons";
+import { defaultFolderDisplayName } from "./shared";
+import { formatRelativeTime } from "../../utils/dateFormatting";
+import { folderContainerKey, loadContainerNotes } from "../../stores/noteStore";
+import { cn } from "../lib/utils";
+import type { FolderItem, NoteItem } from "../../types/electron";
+import type { RowA11yProps } from "./SpacesTree";
+
+interface Props {
+ folder: FolderItem;
+ total: number;
+ hiddenCount: number;
+ activeNoteId: number | null;
+ level: 2 | 3;
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ a11y: RowA11yProps;
+ onPick: (note: NoteItem, keyboard: boolean) => void;
+ onOpenFolder: () => void;
+}
+
+export function FolderNotesPopover({
+ folder,
+ total,
+ hiddenCount,
+ activeNoteId,
+ level,
+ open,
+ onOpenChange,
+ a11y,
+ onPick,
+ onOpenFolder,
+}: Props) {
+ const { t, i18n } = useTranslation();
+ const [allNotes, setAllNotes] = useState<NoteItem[] | null>(null);
+ const [failed, setFailed] = useState(false);
+ const [query, setQuery] = useState("");
+ const [reload, setReload] = useState(0);
+ const inputRef = useRef<HTMLInputElement>(null);
+ const listRef = useRef<HTMLDivElement>(null);
+ const keyboardRef = useRef(false);
+ const pickedNoteRef = useRef(false);
+ const titleId = useId();
+ const name = defaultFolderDisplayName(folder, t);
+
+ useEffect(() => {
+ if (!open) return;
+ pickedNoteRef.current = false;
+ setQuery("");
+ let stale = false;
+ setAllNotes(null);
+ setFailed(false);
+ // SQLite LIMIT -1 removes the normal 50-note container cap.
+ loadContainerNotes(folderContainerKey(folder.id), null, -1)
+ .then((items) => {
+ if (!stale) setAllNotes(items);
+ })
+ .catch(() => {
+ if (!stale) setFailed(true);
+ });
+ return () => {
+ stale = true;
+ };
+ }, [open, folder.id, reload]);
+
+ const filtered = (allNotes ?? []).filter((note) =>
+ note.title
+ .toLocaleLowerCase(i18n.language)
+ .includes(query.trim().toLocaleLowerCase(i18n.language))
+ );
+ const highlightTitle = (title: string) => {
+ const value = query.trim();
+ const index = title
+ .toLocaleLowerCase(i18n.language)
+ .indexOf(value.toLocaleLowerCase(i18n.language));
+ if (!value || index < 0) return title;
+ return (
+ <>
+ {title.slice(0, index)}
+ <span className="font-semibold text-primary">
+ {title.slice(index, index + value.length)}
+ </span>
+ {title.slice(index + value.length)}
+ </>
+ );
+ };
+ const pick = (note: NoteItem, keyboard = true) => {
+ pickedNoteRef.current = true;
+ onPick(note, keyboard);
+ onOpenChange(false);
+ };
+
+ return (
+ <Popover
+ open={open}
+ onOpenChange={(next) => {
+ if (next) setQuery("");
+ onOpenChange(next);
+ }}
+ >
+ <PopoverTrigger asChild>
+ <div
+ role="treeitem"
+ aria-level={level}
+ aria-label={t("notes.folderMore.more", { count: hiddenCount })}
+ ref={a11y.rowRef}
+ tabIndex={a11y.tabIndex}
+ onKeyDown={(event) => {
+ keyboardRef.current = true;
+ a11y.onKeyDown(event);
+ }}
+ onPointerDown={() => {
+ keyboardRef.current = false;
+ }}
+ onFocus={a11y.onFocus}
+ className={cn(
+ "flex h-7 items-center gap-2 rounded-md pe-2 text-xs cursor-pointer select-none outline-none transition-colors duration-150 focus-visible:ring-1 focus-visible:ring-ring/30",
+ level === 2 ? "ps-8" : "ps-[42px]",
+ open
+ ? "bg-foreground/8 text-foreground dark:bg-white/10"
+ : "text-foreground/55 hover:bg-foreground/5 hover:text-foreground dark:hover:bg-white/5"
+ )}
+ >
+ <MoreHorizontal size={13} aria-hidden="true" />
+ <span>{t("notes.folderMore.more", { count: hiddenCount })}</span>
+ </div>
+ </PopoverTrigger>
+ <PopoverContent
+ side={i18n.dir() === "rtl" ? "left" : "right"}
+ align="start"
+ className="flex max-h-[var(--radix-popover-content-available-height)] w-80 max-w-[calc(100vw-24px)] flex-col p-2 rounded-xl"
+ aria-labelledby={titleId}
+ onKeyDownCapture={() => {
+ keyboardRef.current = true;
+ }}
+ onPointerDownCapture={() => {
+ keyboardRef.current = false;
+ }}
+ onEscapeKeyDown={() => {
+ keyboardRef.current = true;
+ }}
+ onOpenAutoFocus={(event) => {
+ event.preventDefault();
+ inputRef.current?.focus();
+ }}
+ onCloseAutoFocus={(event) => {
+ // Picking a note hands focus back to the tree on keyboard paths only.
+ // Restoring focus after a pointer click can inherit the search input's
+ // :focus-visible state and leave a ring on the closed trigger.
+ if (pickedNoteRef.current || !keyboardRef.current) event.preventDefault();
+ }}
+ >
+ <div className="relative">
+ <Search
+ size={14}
+ aria-hidden="true"
+ className="absolute start-3 top-2.5 text-muted-foreground"
+ />
+ <Input
+ dir="auto"
+ ref={inputRef}
+ value={query}
+ onChange={(event) => setQuery(event.target.value)}
+ aria-label={t("notes.folderMore.search", { count: total, folder: name })}
+ placeholder={t("notes.folderMore.search", { count: total, folder: name })}
+ className="input-inline h-8 rounded-full bg-foreground/5 ps-9 pe-8 text-xs dark:bg-white/5"
+ onKeyDown={(event) => {
+ if (event.nativeEvent.isComposing) return;
+ if (event.key === "ArrowDown") {
+ event.preventDefault();
+ listRef.current?.querySelector<HTMLButtonElement>("button")?.focus();
+ }
+ if (event.key === "Enter" && filtered[0]) {
+ event.preventDefault();
+ pick(filtered[0]);
+ }
+ }}
+ />
+ {query && (
+ <button
+ type="button"
+ aria-label={t("meetingNotification.folders.clear")}
+ className="absolute end-2 top-2 rounded-sm text-muted-foreground focus-visible:ring-1 focus-visible:ring-ring"
+ onClick={() => {
+ setQuery("");
+ inputRef.current?.focus();
+ }}
+ >
+ <X size={14} aria-hidden="true" />
+ </button>
+ )}
+ </div>
+ <p id={titleId} className="px-2 py-2 text-[11px] text-muted-foreground">
+ {query.trim()
+ ? t("notes.folderMore.results", { count: filtered.length, total })
+ : t("notes.folderMore.newest")}
+ </p>
+ <div
+ ref={listRef}
+ className="min-h-0 max-h-64 overflow-y-auto space-y-px"
+ aria-busy={!allNotes && !failed}
+ onKeyDown={(event) => {
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;
+ event.preventDefault();
+ const buttons = Array.from(
+ listRef.current?.querySelectorAll<HTMLButtonElement>("button") ?? []
+ );
+ const index = buttons.indexOf(document.activeElement as HTMLButtonElement);
+ if (event.key === "ArrowUp" && index === 0) {
+ inputRef.current?.focus();
+ return;
+ }
+ const next =
+ event.key === "Home"
+ ? 0
+ : event.key === "End"
+ ? buttons.length - 1
+ : index + (event.key === "ArrowDown" ? 1 : -1);
+ buttons[Math.max(0, Math.min(buttons.length - 1, next))]?.focus();
+ }}
+ >
+ {failed ? (
+ <Button variant="ghost" size="sm" onClick={() => setReload((value) => value + 1)}>
+ {t("notes.folderMore.retry")}
+ </Button>
+ ) : !allNotes ? (
+ <p role="status" className="p-3 text-xs text-muted-foreground">
+ {t("notes.folderMore.loading")}
+ </p>
+ ) : filtered.length === 0 ? (
+ <p
+ role="status"
+ className="flex min-h-40 flex-col items-center justify-center gap-3 p-6 text-center text-xs text-muted-foreground"
+ >
+ <Search size={24} aria-hidden="true" />
+ {t("notes.folderMore.empty")}
+ </p>
+ ) : (
+ filtered.map((note) => (
+ <button
+ key={note.id}
+ type="button"
+ onClick={(event) => pick(note, event.detail === 0)}
+ aria-current={note.id === activeNoteId ? "page" : undefined}
+ className={cn(
+ "flex w-full items-center gap-2 rounded-md px-2 py-2 text-xs text-start outline-none hover:bg-foreground/5 focus-visible:bg-foreground/8 focus-visible:ring-1 focus-visible:ring-ring/30",
+ note.id === activeNoteId && "bg-primary/8 text-primary"
+ )}
+ >
+ <FileText size={13} aria-hidden="true" className="shrink-0" />
+ <span dir="auto" className="truncate flex-1">
+ {highlightTitle(note.title || t("notes.list.untitled"))}
+ </span>
+ <time
+ dateTime={note.updated_at}
+ className="shrink-0 text-[11px] text-muted-foreground"
+ >
+ {formatRelativeTime(note.updated_at, t, i18n.language)}
+ </time>
+ </button>
+ ))
+ )}
+ </div>
+ <Button
+ variant="outline"
+ size="sm"
+ className="mt-2 w-full rounded-full text-xs"
+ onClick={() => {
+ onOpenFolder();
+ onOpenChange(false);
+ }}
+ >
+ <FolderOpen size={13} aria-hidden="true" />
+ {t("notes.folderMore.openFolder")}
+ </Button>
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/src/components/notes/SpacesTree.tsx b/src/components/notes/SpacesTree.tsx
index 259478703..7f5517085 100644
--- a/src/components/notes/SpacesTree.tsx
+++ b/src/components/notes/SpacesTree.tsx
@@ -19,6 +19,8 @@ import {
Trash2,
Users,
} from "../icons";
+import { FolderNotesPopover } from "./FolderNotesPopover";
+import { sidebarFolderNotes } from "./sidebarFolderNotes";
import { Button } from "../ui/button";
import ThemedEmptyIllustration from "../ui/ThemedEmptyIllustration";
import sharedSpaceEmptyLight from "../../assets/empty-states/notes-shared-space-light.svg";
@@ -76,6 +78,7 @@ import {
useExpandedContainers,
useActiveContext,
useActiveNoteId,
+ useActiveNote,
useIsTreeLoading,
setActiveContext,
setActiveNoteId,
@@ -126,6 +129,7 @@ const SUB_TRIGGER_CLASS = cn(
type TFn = (key: string, options?: Record<string, unknown>) => string;
type TreeRow =
+ | { type: "more"; key: string; folder: FolderItem; parentKey: string; level: 2 | 3 }
| { type: "space"; key: string; space: SpaceItem; parentKey?: undefined }
| {
type: "folder";
@@ -149,7 +153,7 @@ interface DropHandlers {
onDrop: (e: React.DragEvent) => void;
}
-interface RowA11yProps {
+export interface RowA11yProps {
tabIndex: number;
rowRef: (el: HTMLDivElement | null) => void;
onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => void;
@@ -1121,9 +1125,12 @@ export default function SpacesTree({
const folderCounts = useFolderCounts();
const spaceRootCounts = useSpaceRootCounts();
const notesByContainer = useNotesByContainer();
+ const [openFolderId, setOpenFolderId] = useState<number | null>(null);
const expanded = useExpandedContainers();
const activeContext = useActiveContext();
const activeNoteId = useActiveNoteId();
+ const activeNote = useActiveNote();
+
const isTreeLoading = useIsTreeLoading();
const { isSignedIn, user } = useAuth();
const teamCapability = useTeamSpacesCapability(isSignedIn);
@@ -1456,7 +1463,14 @@ export default function SpacesTree({
const folderKey = folderContainerKey(folder.id);
rows.push({ type: "folder", key: folderKey, folder, level: 1 });
if (expanded.has(folderKey)) {
- (notesByContainer[folderKey] ?? []).forEach((note) => {
+ const folderNotes = notesByContainer[folderKey] ?? [];
+ const { notes: shownNotes, hiddenCount } = sidebarFolderNotes(
+ folderNotes,
+ activeNote,
+ folder.id,
+ folderCounts[folder.id] ?? folderNotes.length
+ );
+ shownNotes.forEach((note) => {
rows.push({
type: "note",
key: `n:${note.id}`,
@@ -1465,6 +1479,15 @@ export default function SpacesTree({
level: 2,
});
});
+ if (hiddenCount > 0) {
+ rows.push({
+ type: "more",
+ key: `more:${folder.id}`,
+ folder,
+ parentKey: folderKey,
+ level: 2,
+ });
+ }
}
});
(notesByContainer[spaceKey] ?? []).forEach((note) => {
@@ -1481,7 +1504,14 @@ export default function SpacesTree({
const folderKey = folderContainerKey(folder.id);
rows.push({ type: "folder", key: folderKey, folder, parentKey: spaceKey, level: 2 });
if (expanded.has(folderKey)) {
- (notesByContainer[folderKey] ?? []).forEach((note) => {
+ const folderNotes = notesByContainer[folderKey] ?? [];
+ const { notes: shownNotes, hiddenCount } = sidebarFolderNotes(
+ folderNotes,
+ activeNote,
+ folder.id,
+ folderCounts[folder.id] ?? folderNotes.length
+ );
+ shownNotes.forEach((note) => {
rows.push({
type: "note",
key: `n:${note.id}`,
@@ -1490,6 +1520,15 @@ export default function SpacesTree({
level: 3,
});
});
+ if (hiddenCount > 0) {
+ rows.push({
+ type: "more",
+ key: `more:${folder.id}`,
+ folder,
+ parentKey: folderKey,
+ level: 3,
+ });
+ }
}
});
(notesByContainer[spaceKey] ?? []).forEach((note) => {
@@ -1499,7 +1538,16 @@ export default function SpacesTree({
privateSpaces.forEach(pushPrivateSpace);
if (teamCapability) orderedTeamSpaces.forEach(pushSpace);
return rows;
- }, [privateSpaces, orderedTeamSpaces, folders, notesByContainer, expanded, teamCapability]);
+ }, [
+ privateSpaces,
+ orderedTeamSpaces,
+ folders,
+ notesByContainer,
+ expanded,
+ teamCapability,
+ activeNote,
+ folderCounts,
+ ]);
const effectiveFocusKey =
focusedKey && visibleRows.some((r) => r.key === focusedKey)
@@ -1519,7 +1567,9 @@ export default function SpacesTree({
};
const activateRow = (row: TreeRow) => {
- if (row.type === "space") {
+ if (row.type === "more") {
+ setOpenFolderId(row.folder.id);
+ } else if (row.type === "space") {
// Deselect the note so the main pane shows the container overview.
setActiveNoteId(null);
setActiveContext(row.space.id, null);
@@ -1582,7 +1632,7 @@ export default function SpacesTree({
const horizontalIntent = treeHorizontalIntent(e.key, i18n.dir());
if (horizontalIntent === "inward") {
e.preventDefault();
- if (row.type === "note") return;
+ if (row.type === "note" || row.type === "more") return;
if (!expanded.has(row.key)) {
setContainerExpanded(row.key, true);
} else if (visibleRows[idx + 1]?.parentKey === row.key) {
@@ -1592,7 +1642,7 @@ export default function SpacesTree({
}
if (horizontalIntent === "outward") {
e.preventDefault();
- if (row.type !== "note" && expanded.has(row.key)) {
+ if (row.type !== "note" && row.type !== "more" && expanded.has(row.key)) {
setContainerExpanded(row.key, false);
} else if (row.parentKey) {
focusRow(row.parentKey);
@@ -1741,6 +1791,14 @@ export default function SpacesTree({
const folderKey = folderContainerKey(folder.id);
const isExpanded = expanded.has(folderKey);
const isRenaming = renamingFolderId === folder.id;
+ const folderNotes = notesByContainer[folderKey] ?? [];
+ const total = folderCounts[folder.id] ?? folderNotes.length;
+ const { notes: shownNotes, hiddenCount } = sidebarFolderNotes(
+ folderNotes,
+ activeNote,
+ folder.id,
+ total
+ );
if (isRenaming) {
return (
@@ -1802,9 +1860,30 @@ export default function SpacesTree({
/>
<TreeChildren open={isExpanded}>
<div className="space-y-px">
- {(notesByContainer[folderKey] ?? []).map((note) =>
+ {shownNotes.map((note) =>
level === 1 ? renderNote(note, 2, folderKey, "ps-8") : renderNote(note, 3, folderKey)
)}
+ {hiddenCount > 0 && (
+ <FolderNotesPopover
+ folder={folder}
+ total={total}
+ hiddenCount={hiddenCount}
+ activeNoteId={activeNoteId}
+ level={level === 1 ? 2 : 3}
+ open={openFolderId === folder.id}
+ onOpenChange={(open) => setOpenFolderId(open ? folder.id : null)}
+ a11y={a11yFor(`more:${folder.id}`)}
+ onPick={(note, keyboard) => {
+ setActiveNoteId(note.id);
+ if (keyboard) focusRowSoon(`n:${note.id}`);
+ else setFocusedKey(`n:${note.id}`);
+ }}
+ onOpenFolder={() => {
+ setActiveNoteId(null);
+ setActiveContext(folder.space_id, folder.id);
+ }}
+ />
+ )}
</div>
</TreeChildren>
</div>
diff --git a/src/components/notes/sidebarFolderNotes.ts b/src/components/notes/sidebarFolderNotes.ts
new file mode 100644
index 000000000..d92804c4f
--- /dev/null
+++ b/src/components/notes/sidebarFolderNotes.ts
@@ -0,0 +1,22 @@
+import type { NoteItem } from "../../types/electron";
+import { normalizeDbDate } from "../../utils/dateFormatting";
+
+const SHOWN_NOTES = 5;
+
+export function sidebarFolderNotes(
+ notes: NoteItem[],
+ activeNote: NoteItem | null,
+ folderId: number,
+ total: number
+): { notes: NoteItem[]; hiddenCount: number } {
+ // The store keeps an edited note in its old slot, so order by updated_at here.
+ const visible = [...notes]
+ .sort(
+ (a, b) => normalizeDbDate(b.updated_at).getTime() - normalizeDbDate(a.updated_at).getTime()
+ )
+ .slice(0, SHOWN_NOTES);
+ if (activeNote?.folder_id === folderId && !visible.some((note) => note.id === activeNote.id)) {
+ visible.push(activeNote);
+ }
+ return { notes: visible, hiddenCount: total > SHOWN_NOTES ? total - visible.length : 0 };
+}
diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.json
index 761c1e4f8..95ac2ce95 100644
--- a/src/locales/ar/translation.json
+++ b/src/locales/ar/translation.json
@@ -2605,6 +2605,16 @@
"applied": "حدّث المساعد «{{title}}»",
"changed": "تغيّرت هذه الملاحظة بعد تعديل المساعد. لم يعد التراجع متاحًا.",
"failed": "تعذّر التراجع عن التعديل. حاول مرة أخرى."
+ },
+ "folderMore": {
+ "more": "{{count}} أخرى",
+ "search": "البحث في {{count}} ملاحظات في {{folder}}",
+ "newest": "الأحدث أولاً",
+ "openFolder": "فتح المجلد",
+ "empty": "لا توجد ملاحظات مطابقة",
+ "loading": "جارٍ تحميل الملاحظات…",
+ "retry": "تعذر تحميل الملاحظات. حاول مجدداً",
+ "results": "{{count}} من {{total}} ملاحظات"
}
},
"onboarding": {
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index 9b00cf5aa..3e76f5dfb 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -3847,6 +3847,16 @@
"applied": "Der Assistent hat „{{title}}“ aktualisiert",
"changed": "Diese Notiz wurde nach der Änderung des Assistenten erneut geändert. Rückgängig ist nicht mehr verfügbar.",
"failed": "Die Änderung konnte nicht rückgängig gemacht werden. Bitte versuche es erneut."
+ },
+ "folderMore": {
+ "more": "{{count}} weitere",
+ "search": "{{count}} Notizen in {{folder}} durchsuchen",
+ "newest": "Neueste zuerst",
+ "openFolder": "Ordner öffnen",
+ "empty": "Keine passenden Notizen",
+ "loading": "Notizen werden geladen…",
+ "retry": "Notizen konnten nicht geladen werden. Erneut versuchen",
+ "results": "{{count}} von {{total}} Notizen"
}
},
"dictionary": {
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 58a743646..14ba2d529 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -3847,6 +3847,16 @@
"applied": "Assistant updated “{{title}}”",
"changed": "This note changed after the assistant edit. Undo is no longer available.",
"failed": "Could not undo the edit. Please try again."
+ },
+ "folderMore": {
+ "more": "{{count}} more",
+ "search": "Search {{count}} notes in {{folder}}",
+ "newest": "Newest first",
+ "openFolder": "Open folder",
+ "empty": "No matching notes",
+ "loading": "Loading notes…",
+ "retry": "Couldn’t load notes. Try again",
+ "results": "{{count}} of {{total}} notes"
}
},
"dictionary": {
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index aa30d4030..fc71400ed 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -3548,6 +3548,16 @@
"applied": "El asistente actualizó «{{title}}»",
"changed": "Esta nota cambió después de la edición del asistente. Ya no se puede deshacer.",
"failed": "No se pudo deshacer la edición. Inténtalo de nuevo."
+ },
+ "folderMore": {
+ "more": "{{count}} más",
+ "search": "Buscar {{count}} notas en {{folder}}",
+ "newest": "Más recientes primero",
+ "openFolder": "Abrir carpeta",
+ "empty": "No hay notas coincidentes",
+ "loading": "Cargando notas…",
+ "retry": "No se pudieron cargar las notas. Reintentar",
+ "results": "{{count}} de {{total}} notas"
}
},
"dictionary": {
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 689ffe954..d637d8f96 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -3847,6 +3847,16 @@
"applied": "L’assistant a modifié « {{title}} »",
"changed": "Cette note a changé après la modification de l’assistant. Il n’est plus possible de l’annuler.",
"failed": "Impossible d’annuler la modification. Réessayez."
+ },
+ "folderMore": {
+ "more": "{{count}} de plus",
+ "search": "Rechercher {{count}} notes dans {{folder}}",
+ "newest": "Plus récentes en premier",
+ "openFolder": "Ouvrir le dossier",
+ "empty": "Aucune note correspondante",
+ "loading": "Chargement des notes…",
+ "retry": "Impossible de charger les notes. Réessayer",
+ "results": "{{count}} sur {{total}} notes"
}
},
"dictionary": {
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 6abedc6bd..34606335a 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -3496,6 +3496,16 @@
"applied": "L’assistente ha aggiornato «{{title}}»",
"changed": "Questa nota è cambiata dopo la modifica dell’assistente. Non è più possibile annullarla.",
"failed": "Impossibile annullare la modifica. Riprova."
+ },
+ "folderMore": {
+ "more": "Altre {{count}}",
+ "search": "Cerca {{count}} note in {{folder}}",
+ "newest": "Più recenti prima",
+ "openFolder": "Apri cartella",
+ "empty": "Nessuna nota corrispondente",
+ "loading": "Caricamento delle note…",
+ "retry": "Impossibile caricare le note. Riprova",
+ "results": "{{count}} di {{total}} note"
}
},
"dictionary": {
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 4385bda59..cd1f6254e 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -3424,6 +3424,16 @@
"applied": "アシスタントが「{{title}}」を更新しました",
"changed": "アシスタントの編集後にノートが変更されたため、元に戻せません。",
"failed": "編集を元に戻せませんでした。もう一度お試しください。"
+ },
+ "folderMore": {
+ "more": "他 {{count}} 件",
+ "search": "{{folder}} の {{count}} 件のノートを検索",
+ "newest": "新しい順",
+ "openFolder": "フォルダーを開く",
+ "empty": "一致するノートがありません",
+ "loading": "ノートを読み込み中…",
+ "retry": "ノートを読み込めませんでした。再試行",
+ "results": "{{total}} 件中 {{count}} 件のノート"
}
},
"dictionary": {
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 017e07cc7..fa786c519 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -3496,6 +3496,16 @@
"applied": "O assistente atualizou “{{title}}”",
"changed": "Esta nota mudou após a edição do assistente. Já não é possível desfazer.",
"failed": "Não foi possível desfazer a edição. Tente novamente."
+ },
+ "folderMore": {
+ "more": "Mais {{count}}",
+ "search": "Pesquisar {{count}} notas em {{folder}}",
+ "newest": "Mais recentes primeiro",
+ "openFolder": "Abrir pasta",
+ "empty": "Nenhuma nota correspondente",
+ "loading": "Carregando notas…",
+ "retry": "Não foi possível carregar as notas. Tentar novamente",
+ "results": "{{count}} de {{total}} notas"
}
},
"dictionary": {
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index a389d6665..42ee28894 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -3520,6 +3520,16 @@
"applied": "Ассистент обновил «{{title}}»",
"changed": "После правки ассистента заметка была изменена. Отмена больше недоступна.",
"failed": "Не удалось отменить правку. Повторите попытку."
+ },
+ "folderMore": {
+ "more": "Ещё {{count}}",
+ "search": "Поиск по {{count}} заметкам в {{folder}}",
+ "newest": "Сначала новые",
+ "openFolder": "Открыть папку",
+ "empty": "Нет подходящих заметок",
+ "loading": "Загрузка заметок…",
+ "retry": "Не удалось загрузить заметки. Повторить",
+ "results": "{{count}} из {{total}} заметок"
}
},
"dictionary": {
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 8d0a89c7d..50e09a515 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -3496,6 +3496,16 @@
"applied": "助手已更新“{{title}}”",
"changed": "助手编辑后,这篇笔记又发生了更改,无法撤销。",
"failed": "无法撤销编辑,请重试。"
+ },
+ "folderMore": {
+ "more": "还有 {{count}} 篇",
+ "search": "在 {{folder}} 中搜索 {{count}} 篇笔记",
+ "newest": "最新优先",
+ "openFolder": "打开文件夹",
+ "empty": "没有匹配的笔记",
+ "loading": "正在加载笔记…",
+ "retry": "无法加载笔记。重试",
+ "results": "{{count}} / {{total}} 篇笔记"
}
},
"dictionary": {
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 34039f8d7..07fba4d0b 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -3496,6 +3496,16 @@
"applied": "助理已更新「{{title}}」",
"changed": "助理編輯後,這篇筆記又有變更,無法復原。",
"failed": "無法復原編輯,請再試一次。"
+ },
+ "folderMore": {
+ "more": "還有 {{count}} 篇",
+ "search": "在 {{folder}} 中搜尋 {{count}} 篇筆記",
+ "newest": "最新優先",
+ "openFolder": "開啟資料夾",
+ "empty": "沒有符合的筆記",
+ "loading": "正在載入筆記…",
+ "retry": "無法載入筆記。重試",
+ "results": "{{count}} / {{total}} 篇筆記"
}
},
"dictionary": {
diff --git a/test/components/fieldDirectionPolicy.test.js b/test/components/fieldDirectionPolicy.test.js
index b03c92388..7452aff7e 100644
--- a/test/components/fieldDirectionPolicy.test.js
+++ b/test/components/fieldDirectionPolicy.test.js
@@ -69,6 +69,7 @@ const EXPECTED_SHARED_FIELD_DIRECTIONS = {
"src/components/SnippetsView.tsx": ["auto", "auto", "auto", "auto"],
"src/components/notes/ActionManagerDialog.tsx": ["auto", "auto", "auto"],
"src/components/notes/DeleteSpaceDialog.tsx": ["auto"],
+ "src/components/notes/FolderNotesPopover.tsx": ["auto"],
"src/components/notes/UploadAudioView.tsx": ["auto"],
"src/components/settings/DictationAgentSettings.tsx": ["auto"],
"src/components/settings/EnterpriseCheckoutDialog.tsx": ["inherit"],
diff --git a/test/components/sidebarFolderNotes.test.js b/test/components/sidebarFolderNotes.test.js
new file mode 100644
index 000000000..fb1354440
--- /dev/null
+++ b/test/components/sidebarFolderNotes.test.js
@@ -0,0 +1,84 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const { sidebarFolderNotes } = require("../../src/components/notes/sidebarFolderNotes.ts");
+const notes = Array.from({ length: 17 }, (_, index) => ({
+ id: index + 1,
+ folder_id: 7,
+ updated_at: new Date(Date.UTC(2026, 9, 21) - index * 60000).toISOString(),
+}));
+
+test("small folders keep every note and have no hidden count", () => {
+ for (const count of [0, 1, 5]) {
+ const shown = sidebarFolderNotes(notes.slice(0, count), null, 7, count);
+ assert.equal(shown.notes.length, count);
+ assert.equal(shown.hiddenCount, 0);
+ }
+});
+test("long folders show five newest notes and count the remainder", () => {
+ const shown = sidebarFolderNotes(notes, null, 7, notes.length);
+ assert.deepEqual(
+ shown.notes.map((note) => note.id),
+ [1, 2, 3, 4, 5]
+ );
+ assert.equal(shown.hiddenCount, 12);
+ assert.equal(sidebarFolderNotes(notes, null, 7, 60).hiddenCount, 55);
+});
+test("an older note edited last is among the five", () => {
+ const edited = notes.map((note) =>
+ note.id === 9 ? { ...note, updated_at: new Date(Date.UTC(2026, 9, 22)).toISOString() } : note
+ );
+ assert.deepEqual(
+ sidebarFolderNotes(edited, null, 7, edited.length).notes.map((note) => note.id),
+ [9, 1, 2, 3, 4]
+ );
+});
+test("an older active note stays sixth, including outside the loaded page", () => {
+ const active = { id: 100, folder_id: 7 };
+ const shown = sidebarFolderNotes(notes, active, 7, 101);
+ assert.deepEqual(
+ shown.notes.map((note) => note.id),
+ [1, 2, 3, 4, 5, 100]
+ );
+ assert.equal(shown.hiddenCount, 95);
+});
+test("active notes in the top five or another folder are not duplicated or pinned", () => {
+ assert.equal(sidebarFolderNotes(notes, notes[1], 7, notes.length).notes.length, 5);
+ assert.equal(
+ sidebarFolderNotes(notes, { id: 100, folder_id: 8 }, 7, notes.length).notes.length,
+ 5
+ );
+});
+
+test("loading the full folder makes an older note available to the editor's shared store", async (t) => {
+ const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+ const allNotes = Array.from({ length: 57 }, (_, index) => ({
+ id: index + 1,
+ folder_id: 7,
+ space_id: 1,
+ title: `Note ${index + 1}`,
+ }));
+ const calls = [];
+ installBrowserGlobals(t, {
+ window: {
+ electronAPI: {
+ getNotes: async (type, limit, folderId) => {
+ calls.push({ type, limit, folderId });
+ return limit < 0 ? allNotes : allNotes.slice(0, limit);
+ },
+ },
+ },
+ });
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-folder-overflow-store-",
+ mockModules: {
+ "/services/SyncService.js": "export const syncService = { setNoteOpen() {} };",
+ },
+ });
+ const store = await vite.ssrLoadModule("/stores/noteStore.ts");
+ await store.loadContainerNotes("f:7");
+ assert.equal(store.getNoteFromStore(57), null);
+ await store.loadContainerNotes("f:7", null, -1);
+ store.setActiveNoteId(57);
+ assert.equal(store.getNoteFromStore(57)?.id, 57);
+ assert.deepEqual(calls.at(-1), { type: null, limit: -1, folderId: 7 });
+});
diff --git a/test/components/spacesTreeNoteActionClearance.test.js b/test/components/spacesTreeNoteActionClearance.test.js
index 9a7377194..1231c5051 100644
--- a/test/components/spacesTreeNoteActionClearance.test.js
+++ b/test/components/spacesTreeNoteActionClearance.test.js
@@ -52,6 +52,7 @@ async function renderTree(t, direction) {
]);
export const useActiveContext = () => null;
export const useActiveNoteId = () => null;
+ export const useActiveNote = () => null;
export const useIsTreeLoading = () => false;
export const useShareCache = () => new Map();
export const getNoteFromStore = (id) => notes.find((note) => note.id === id);