feat: add archived boolean property to VaultEntry

Add archived field to both TypeScript VaultEntry interface and Rust
VaultEntry struct. Parse Archived frontmatter field in Rust backend.
Add archived mock entries (Website Redesign, Twitter Thread Experiment)
for visual testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-02-21 16:36:06 +01:00
parent cc3dff7d47
commit 4d2f96dfab
3 changed files with 119 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ pub struct VaultEntry {
pub status: Option<String>,
pub owner: Option<String>,
pub cadence: Option<String>,
pub archived: bool,
#[serde(rename = "modifiedAt")]
pub modified_at: Option<u64>,
#[serde(rename = "createdAt")]
@@ -53,6 +54,8 @@ struct Frontmatter {
owner: Option<String>,
#[serde(rename = "Cadence")]
cadence: Option<String>,
#[serde(rename = "Archived")]
archived: Option<bool>,
#[serde(rename = "Created at")]
created_at: Option<String>,
#[serde(rename = "Created time")]
@@ -202,7 +205,7 @@ fn parse_frontmatter(data: &HashMap<String, serde_json::Value>) -> Frontmatter {
/// Known non-relationship frontmatter keys to skip (case-insensitive comparison).
/// Only skip keys that can never contain wikilinks.
const SKIP_KEYS: &[&str] = &[
"is a", "aliases", "status", "cadence", "created at", "created time",
"is a", "aliases", "status", "cadence", "archived", "created at", "created time",
];
/// Check if a string contains a wikilink pattern `[[...]]`.
@@ -351,6 +354,7 @@ pub fn parse_md_file(path: &Path) -> Result<VaultEntry, String> {
status: frontmatter.status,
owner: frontmatter.owner,
cadence: frontmatter.cadence,
archived: frontmatter.archived.unwrap_or(false),
modified_at, created_at, file_size,
})
}

View File

@@ -575,6 +575,47 @@ A **book** you're reading or have read. Track reading progress, notes, and key t
- **Author**: The book's author
- **Status**: Reading, Finished, Abandoned
- **Rating**: 1-5 stars
`,
// --- Archived entries ---
'/Users/luca/Laputa/project/25q3-website-redesign.md': `---
title: Website Redesign
is_a: Project
status: Done
archived: true
owner: Luca Rossi
belongs_to:
- "[[quarter/q3-2025]]"
---
# Website Redesign
Completed redesign of the company website. Migrated from WordPress to Next.js with improved performance and SEO.
## Results
- Page load time: 4.2s → 1.1s
- Organic traffic: +35% in 3 months
- Bounce rate: 58% → 42%
`,
'/Users/luca/Laputa/experiment/twitter-thread-experiment.md': `---
title: Twitter Thread Growth Experiment
is_a: Experiment
status: Done
archived: true
owner: Luca Rossi
related_to:
- "[[responsibility/grow-newsletter]]"
---
# Twitter Thread Growth Experiment
## Hypothesis
Publishing 3 Twitter threads per week (instead of 1) will increase newsletter signups by 50%.
## Result
After 6 weeks, signups increased by only 12%. The additional threads had diminishing returns — quality matters more than quantity.
## Decision
Reverted to 1 high-quality thread per week. Archived this experiment.
`,
// --- Instances of custom types ---
'/Users/luca/Laputa/recipe/pasta-carbonara.md': `---
@@ -622,6 +663,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: 'Active',
owner: 'Luca Rossi',
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000,
createdAt: null,
fileSize: 2048,
@@ -643,6 +685,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: 'Active',
owner: 'Luca Rossi',
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 3600,
createdAt: null,
fileSize: 1024,
@@ -669,6 +712,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: 'Active',
owner: 'Matteo Cellini',
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 7200,
createdAt: null,
fileSize: 890,
@@ -689,6 +733,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: 'Active',
owner: 'Luca Rossi',
cadence: 'Weekly',
archived: false,
modifiedAt: Date.now() / 1000 - 86400,
createdAt: null,
fileSize: 512,
@@ -709,6 +754,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: 'Active',
owner: 'Matteo Cellini',
cadence: 'Weekly',
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 2,
createdAt: null,
fileSize: 640,
@@ -729,6 +775,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: 'Active',
owner: 'Luca Rossi',
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400,
createdAt: null,
fileSize: 3200,
@@ -750,6 +797,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 3600 * 5,
createdAt: null,
fileSize: 847,
@@ -771,6 +819,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400,
createdAt: null,
fileSize: 560,
@@ -791,6 +840,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 7,
createdAt: null,
fileSize: 320,
@@ -810,6 +860,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 3600 * 2,
createdAt: null,
fileSize: 1200,
@@ -830,6 +881,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 30,
createdAt: null,
fileSize: 256,
@@ -850,6 +902,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 14,
createdAt: null,
fileSize: 180,
@@ -870,6 +923,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 3,
createdAt: null,
fileSize: 4200,
@@ -890,6 +944,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 7,
createdAt: null,
fileSize: 3800,
@@ -911,6 +966,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 10,
createdAt: null,
fileSize: 5100,
@@ -932,6 +988,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 320,
@@ -949,6 +1006,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 280,
@@ -966,6 +1024,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 310,
@@ -983,6 +1042,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 290,
@@ -1000,6 +1060,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 200,
@@ -1017,6 +1078,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 180,
@@ -1034,6 +1096,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 170,
@@ -1051,6 +1114,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 200,
@@ -1068,6 +1132,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 190,
@@ -1086,6 +1151,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 30,
createdAt: null,
fileSize: 250,
@@ -1103,6 +1169,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 30,
createdAt: null,
fileSize: 220,
@@ -1121,6 +1188,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 5,
createdAt: null,
fileSize: 420,
@@ -1140,6 +1208,7 @@ const MOCK_ENTRIES: VaultEntry[] = [
status: null,
owner: null,
cadence: null,
archived: false,
modifiedAt: Date.now() / 1000 - 86400 * 14,
createdAt: null,
fileSize: 380,
@@ -1148,6 +1217,49 @@ const MOCK_ENTRIES: VaultEntry[] = [
'Type': ['[[type/book]]'],
},
},
// --- Archived entries ---
{
path: '/Users/luca/Laputa/project/25q3-website-redesign.md',
filename: '25q3-website-redesign.md',
title: 'Website Redesign',
isA: 'Project',
aliases: [],
belongsTo: ['[[quarter/q3-2025]]'],
relatedTo: [],
status: 'Done',
owner: 'Luca Rossi',
cadence: null,
archived: true,
modifiedAt: Date.now() / 1000 - 86400 * 120,
createdAt: null,
fileSize: 680,
snippet: 'Completed redesign of the company website. Migrated from WordPress to Next.js with improved performance and SEO.',
relationships: {
'Belongs to': ['[[quarter/q3-2025]]'],
'Type': ['[[type/project]]'],
},
},
{
path: '/Users/luca/Laputa/experiment/twitter-thread-experiment.md',
filename: 'twitter-thread-experiment.md',
title: 'Twitter Thread Growth Experiment',
isA: 'Experiment',
aliases: [],
belongsTo: [],
relatedTo: ['[[responsibility/grow-newsletter]]'],
status: 'Done',
owner: 'Luca Rossi',
cadence: null,
archived: true,
modifiedAt: Date.now() / 1000 - 86400 * 90,
createdAt: null,
fileSize: 520,
snippet: 'Publishing 3 Twitter threads per week instead of 1 will increase newsletter signups by 50%. Result: only 12% increase.',
relationships: {
'Related to': ['[[responsibility/grow-newsletter]]'],
'Type': ['[[type/experiment]]'],
},
},
]
function mockFileHistory(path: string): GitCommit[] {

View File

@@ -9,6 +9,7 @@ export interface VaultEntry {
status: string | null
owner: string | null
cadence: string | null
archived: boolean
modifiedAt: number | null
createdAt: number | null
fileSize: number
@@ -32,7 +33,7 @@ export interface ModifiedFile {
}
export type SidebarSelection =
| { kind: 'filter'; filter: 'all' | 'favorites' }
| { kind: 'filter'; filter: 'all' | 'favorites' | 'archived' }
| { kind: 'sectionGroup'; type: string }
| { kind: 'entity'; entry: VaultEntry }
| { kind: 'topic'; entry: VaultEntry }