feat: add icon and color fields to VaultEntry

- Add icon (string|null) and color (string|null) to VaultEntry interface
- Update Rust VaultEntry struct and frontmatter parsing to read icon/color
- Add icon/color to SKIP_KEYS so they don't appear as relationships
- Set mock data: Recipe type → cooking-pot/orange, Book type → book-open/green
- Update all test files with the new required fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-02-21 13:23:10 +01:00
parent a7addf127e
commit f36cfd1808
8 changed files with 117 additions and 2 deletions

View File

@@ -49,6 +49,8 @@ const mockEntry: VaultEntry = {
fileSize: 1024,
snippet: '',
relationships: {},
icon: null,
color: null,
}
const mockContent = `---

View File

@@ -19,6 +19,8 @@ const mockEntry: VaultEntry = {
fileSize: 1024,
snippet: '',
relationships: {},
icon: null,
color: null,
}
const mockContent = `---
@@ -54,6 +56,8 @@ const referrerEntry: VaultEntry = {
fileSize: 200,
snippet: '',
relationships: {},
icon: null,
color: null,
}
const allContent: Record<string, string> = {

View File

@@ -25,6 +25,8 @@ const mockEntries: VaultEntry[] = [
relationships: {
'Related to': ['[[topic/software-development]]'],
},
icon: null,
color: null,
},
{
path: '/Users/luca/Laputa/note/facebook-ads-strategy.md',
@@ -45,6 +47,8 @@ const mockEntries: VaultEntry[] = [
'Belongs to': ['[[project/26q1-laputa-app]]'],
'Related to': ['[[topic/growth]]'],
},
icon: null,
color: null,
},
{
path: '/Users/luca/Laputa/person/matteo-cellini.md',
@@ -62,6 +66,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 320,
snippet: 'Sponsorship manager.',
relationships: {},
icon: null,
color: null,
},
{
path: '/Users/luca/Laputa/event/2026-02-14-kickoff.md',
@@ -79,6 +85,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 512,
snippet: 'Project kickoff meeting notes.',
relationships: {},
icon: null,
color: null,
},
{
path: '/Users/luca/Laputa/topic/software-development.md',
@@ -96,6 +104,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 256,
snippet: 'Frontend, backend, and systems programming.',
relationships: {},
icon: null,
color: null,
},
]

View File

@@ -20,6 +20,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 1024,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/responsibility/grow-newsletter.md',
@@ -37,6 +39,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 512,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/experiment/stock-screener.md',
@@ -54,6 +58,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 256,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/procedure/weekly-essays.md',
@@ -71,6 +77,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 128,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/topic/software-development.md',
@@ -88,6 +96,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 256,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/topic/trading.md',
@@ -105,6 +115,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 180,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/person/alice.md',
@@ -122,6 +134,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 100,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/event/kickoff.md',
@@ -139,6 +153,8 @@ const mockEntries: VaultEntry[] = [
fileSize: 200,
snippet: '',
relationships: {},
icon: null,
color: null,
},
]
@@ -283,6 +299,8 @@ describe('Sidebar', () => {
fileSize: 200,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/type/book.md',
@@ -300,6 +318,8 @@ describe('Sidebar', () => {
fileSize: 200,
snippet: '',
relationships: {},
icon: null,
color: null,
},
{
path: '/vault/recipe/pasta.md',
@@ -317,6 +337,8 @@ describe('Sidebar', () => {
fileSize: 300,
snippet: '',
relationships: {},
icon: null,
color: null,
},
]
@@ -362,6 +384,8 @@ describe('Sidebar', () => {
fileSize: 200,
snippet: '',
relationships: {},
icon: null,
color: null,
}
render(<Sidebar entries={[...mockEntries, projectTypeEntry]} selection={defaultSelection} onSelect={() => {}} />)
// "Projects" should appear once (the built-in section), not twice