feat(workspace): sidebar search opens the global search

The sidebar filter only matched titles and tags, never the bullets. It
is replaced by a search-field-like button that opens the command palette
(full-text search over all notes and bullets).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-10-29 12:44:40 +01:00
1 parent 4bf060b97e
commit e7851f1257
2 files changed
+24 -39

No files matched your search

+1
View File
@@ -1086,6 +1086,7 @@ export const App: React.FC = () => {
initialBlockId={selectedBlockId} initialBlockId={selectedBlockId}
onStatsChange={refreshAll} onStatsChange={refreshAll}
onOpenTask={handleOpenTask} onOpenTask={handleOpenTask}
onOpenSearch={() => setShowCommandPalette(true)}
/> />
)} )}
@@ -64,6 +64,8 @@ interface WorkspaceViewProps {
initialBlockId?: string | null; initialBlockId?: string | null;
onStatsChange: () => void; onStatsChange: () => void;
onOpenTask?: (taskId: string) => void; onOpenTask?: (taskId: string) => void;
// Opens the global search (command palette); the notes sidebar has no search of its own
onOpenSearch?: () => void;
} }
type WorkspaceSubView = 'editor' | 'tag_detail' | 'todos' | 'tags' | 'trash'; type WorkspaceSubView = 'editor' | 'tag_detail' | 'todos' | 'tags' | 'trash';
@@ -282,6 +284,7 @@ export const WorkspaceView: React.FC<WorkspaceViewProps> = ({
initialBlockId, initialBlockId,
onStatsChange, onStatsChange,
onOpenTask, onOpenTask,
onOpenSearch,
}) => { }) => {
const [docs, setDocs] = useState<Document[]>([]); const [docs, setDocs] = useState<Document[]>([]);
const [folders, setFolders] = useState<string[]>([]); const [folders, setFolders] = useState<string[]>([]);
@@ -325,7 +328,6 @@ export const WorkspaceView: React.FC<WorkspaceViewProps> = ({
const [tagSearchQuery, setTagSearchQuery] = useState<string>(''); const [tagSearchQuery, setTagSearchQuery] = useState<string>('');
const [tagSortBy, setTagSortBy] = useState<'count' | 'name'>('count'); const [tagSortBy, setTagSortBy] = useState<'count' | 'name'>('count');
const [searchQuery, setSearchQuery] = useState<string>('');
const [expandedFolders, setExpandedFolders] = useState<Record<string, boolean>>(() => { const [expandedFolders, setExpandedFolders] = useState<Record<string, boolean>>(() => {
try { try {
const saved = localStorage.getItem('mindsift:workspace_expanded_folders'); const saved = localStorage.getItem('mindsift:workspace_expanded_folders');
@@ -868,17 +870,6 @@ export const WorkspaceView: React.FC<WorkspaceViewProps> = ({
return Array.from(set).sort(); return Array.from(set).sort();
}, [docs, folders, sharedFolders]); }, [docs, folders, sharedFolders]);
const filteredDocs = useMemo(() => {
const q = searchQuery.trim().toLowerCase();
if (!q) return docs;
return docs.filter(
(d) =>
d.title.toLowerCase().includes(q) ||
(d.content && d.content.toLowerCase().includes(q)) ||
(d.tags && d.tags.some((t) => t.toLowerCase().includes(q)))
);
}, [docs, searchQuery]);
const folderTree = useMemo(() => { const folderTree = useMemo(() => {
const rootNodes: FolderTreeNode[] = []; const rootNodes: FolderTreeNode[] = [];
const nodeMap = new Map<string, FolderTreeNode>(); const nodeMap = new Map<string, FolderTreeNode>();
@@ -906,7 +897,7 @@ export const WorkspaceView: React.FC<WorkspaceViewProps> = ({
const sharedFolderObj = sharedFolders.find( const sharedFolderObj = sharedFolders.find(
(sf) => sf.mountPath === p || sf.name === p (sf) => sf.mountPath === p || sf.name === p
); );
const folderDocs = filteredDocs.filter((d) => d.folderPath === p); const folderDocs = docs.filter((d) => d.folderPath === p);
const node: FolderTreeNode = { const node: FolderTreeNode = {
name: leafName, name: leafName,
@@ -931,16 +922,16 @@ export const WorkspaceView: React.FC<WorkspaceViewProps> = ({
} }
return rootNodes; return rootNodes;
}, [allFolderPaths, filteredDocs, sharedFolders]); }, [allFolderPaths, docs, sharedFolders]);
const pinnedDocs = useMemo( const pinnedDocs = useMemo(
() => filteredDocs.filter((d) => d.isPinned), () => docs.filter((d) => d.isPinned),
[filteredDocs] [docs]
); );
const rootDocs = useMemo( const rootDocs = useMemo(
() => filteredDocs.filter((d) => !d.folderPath), () => docs.filter((d) => !d.folderPath),
[filteredDocs] [docs]
); );
// Global To-Dos rollup collections // Global To-Dos rollup collections
@@ -1357,32 +1348,25 @@ export const WorkspaceView: React.FC<WorkspaceViewProps> = ({
</div> </div>
</div> </div>
{/* Search Input */} {/* Opens the global full-text search, which also finds the content of every bullet */}
<div className="relative"> {onOpenSearch && (
<Search className="w-3.5 h-3.5 text-faint absolute left-2.5 top-1/2 -translate-y-1/2" /> <button
<input type="button"
type="text" onClick={onOpenSearch}
value={searchQuery} className="input-field w-full h-11 sm:h-7 px-2.5 flex items-center gap-2 text-xs text-faint hover:text-main cursor-pointer"
onChange={(e) => setSearchQuery(e.target.value)} title="Globale Suche (Strg+K / ⌘K oder /)"
placeholder="Notizen oder #Tags suchen…" >
className="input-field w-full pl-8 pr-6 py-1 text-xs" <Search className="w-3.5 h-3.5 shrink-0" />
/> <span className="flex-1 text-left truncate">Notizen durchsuchen…</span>
{searchQuery && ( <span className="hidden sm:inline font-mono text-[10px]">⌘K</span>
<button </button>
type="button" )}
onClick={() => setSearchQuery('')}
className="absolute right-2 top-1/2 -translate-y-1/2 text-faint hover:text-main"
>
<X className="w-3.5 h-3.5" />
</button>
)}
</div>
</div> </div>
{/* Scrollable Navigation Tree */} {/* Scrollable Navigation Tree */}
<div className="flex-1 overflow-y-auto p-2 space-y-3"> <div className="flex-1 overflow-y-auto p-2 space-y-3">
{/* Pinned Notes */} {/* Pinned Notes */}
{pinnedDocs.length > 0 && !searchQuery && ( {pinnedDocs.length > 0 && (
<div> <div>
<div className="px-2 mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-faint"> <div className="px-2 mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-faint">
<Pin className="w-3 h-3 text-status-warn" /> <Pin className="w-3 h-3 text-status-warn" />