({
{item.noteType}
diff --git a/src/components/SearchPanel.tsx b/src/components/SearchPanel.tsx
index ffc7a9eb..28e05b6d 100644
--- a/src/components/SearchPanel.tsx
+++ b/src/components/SearchPanel.tsx
@@ -4,7 +4,7 @@ import { cn } from '@/lib/utils'
import { Badge } from '@/components/ui/badge'
import type { SearchResult, VaultEntry } from '../types'
import { useUnifiedSearch } from '../hooks/useUnifiedSearch'
-import { getTypeColor, buildTypeEntryMap } from '../utils/typeColors'
+import { getTypeColor, getTypeLightColor, buildTypeEntryMap } from '../utils/typeColors'
interface SearchPanelProps {
open: boolean
@@ -193,6 +193,7 @@ function SearchContent({
const isA = entryLookup.get(result.path)?.isA ?? result.noteType
const noteType = isA && isA !== 'Note' ? isA : null
const typeColor = noteType ? getTypeColor(isA, typeEntryMap[isA ?? '']?.color) : undefined
+ const typeLightColor = noteType ? getTypeLightColor(isA, typeEntryMap[isA ?? '']?.color) : undefined
return (
{result.title}
{noteType && (
-
+
{noteType}
)}
diff --git a/src/components/WikilinkSuggestionMenu.tsx b/src/components/WikilinkSuggestionMenu.tsx
index e6198330..8402dd37 100644
--- a/src/components/WikilinkSuggestionMenu.tsx
+++ b/src/components/WikilinkSuggestionMenu.tsx
@@ -7,6 +7,7 @@ export interface WikilinkSuggestionItem {
onItemClick: () => void
noteType?: string
typeColor?: string
+ typeLightColor?: string
TypeIcon?: ComponentType>
aliases?: string[]
entryTitle?: string
diff --git a/src/hooks/useNoteSearch.test.ts b/src/hooks/useNoteSearch.test.ts
index 44da8007..d1b1bb06 100644
--- a/src/hooks/useNoteSearch.test.ts
+++ b/src/hooks/useNoteSearch.test.ts
@@ -60,18 +60,20 @@ describe('useNoteSearch', () => {
expect(result.current.results).toHaveLength(2)
})
- it('includes noteType for non-Note entries', () => {
+ it('includes noteType and light color for non-Note entries', () => {
const { result } = renderHook(() => useNoteSearch(entries, ''))
const project = result.current.results.find((r) => r.title === 'Alpha Project')
expect(project?.noteType).toBe('Project')
expect(project?.typeColor).toBeTruthy()
+ expect(project?.typeLightColor).toBeTruthy()
})
- it('excludes noteType for Note entries', () => {
+ it('excludes noteType and light color for Note entries', () => {
const { result } = renderHook(() => useNoteSearch(entries, ''))
const note = result.current.results.find((r) => r.title === 'Beta Notes')
expect(note?.noteType).toBeUndefined()
expect(note?.typeColor).toBeUndefined()
+ expect(note?.typeLightColor).toBeUndefined()
})
it('includes original VaultEntry in results', () => {
@@ -182,10 +184,12 @@ describe('useNoteSearch', () => {
const pasta = result.current.results.find(r => r.title === 'Pasta')
expect(pasta?.noteType).toBe('Recipe')
expect(pasta?.typeColor).toBe('var(--accent-orange)')
+ expect(pasta?.typeLightColor).toBe('var(--accent-orange-light)')
expect(pasta?.TypeIcon).toBeDefined()
// Built-in type still works
const project = result.current.results.find(r => r.title === 'My Project')
expect(project?.typeColor).toBe('var(--accent-red)')
+ expect(project?.typeLightColor).toBe('var(--accent-red-light)')
expect(project?.TypeIcon).toBeDefined()
})
})
diff --git a/src/hooks/useNoteSearch.ts b/src/hooks/useNoteSearch.ts
index 60b4350c..5152a077 100644
--- a/src/hooks/useNoteSearch.ts
+++ b/src/hooks/useNoteSearch.ts
@@ -1,7 +1,7 @@
import { useState, useMemo, useCallback, useEffect } from 'react'
import type { VaultEntry } from '../types'
import { fuzzyMatch } from '../utils/fuzzyMatch'
-import { getTypeColor, buildTypeEntryMap } from '../utils/typeColors'
+import { getTypeColor, getTypeLightColor, buildTypeEntryMap } from '../utils/typeColors'
import { getTypeIcon } from '../components/NoteItem'
import type { NoteSearchResultItem } from '../components/NoteSearchList'
@@ -19,6 +19,7 @@ function toResult(e: VaultEntry, typeEntryMap: Record): Note
title: e.title,
noteType,
typeColor: noteType ? getTypeColor(e.isA, te?.color) : undefined,
+ typeLightColor: noteType ? getTypeLightColor(e.isA, te?.color) : undefined,
TypeIcon: noteType ? getTypeIcon(e.isA, te?.icon) : undefined,
}
}