feat: add trashed/trashedAt fields to VaultEntry

- Added trashed (boolean) and trashedAt (timestamp) to TypeScript VaultEntry
- Added 'trash' filter to SidebarSelection union type
- Added trashed/trashed_at fields to Rust VaultEntry struct and Frontmatter parser
- Added 3 trashed mock entries for visual testing (recently trashed,
  30+ days old, and dropped experiment)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-02-21 16:52:28 +01:00
parent 7bee41847f
commit 66a15e4ddb
3 changed files with 188 additions and 3 deletions

View File

@@ -25,6 +25,9 @@ pub struct VaultEntry {
pub owner: Option<String>,
pub cadence: Option<String>,
pub archived: bool,
pub trashed: bool,
#[serde(rename = "trashedAt")]
pub trashed_at: Option<u64>,
#[serde(rename = "modifiedAt")]
pub modified_at: Option<u64>,
#[serde(rename = "createdAt")]
@@ -60,6 +63,10 @@ struct Frontmatter {
cadence: Option<String>,
#[serde(rename = "Archived")]
archived: Option<bool>,
#[serde(rename = "Trashed")]
trashed: Option<bool>,
#[serde(rename = "Trashed at")]
trashed_at: Option<String>,
#[serde(rename = "Created at")]
created_at: Option<String>,
#[serde(rename = "Created time")]
@@ -213,8 +220,8 @@ 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", "archived", "created at", "created time",
"icon", "color",
"is a", "aliases", "status", "cadence", "archived", "trashed", "trashed at",
"created at", "created time", "icon", "color",
];
/// Check if a string contains a wikilink pattern `[[...]]`.
@@ -364,6 +371,8 @@ pub fn parse_md_file(path: &Path) -> Result<VaultEntry, String> {
owner: frontmatter.owner,
cadence: frontmatter.cadence,
archived: frontmatter.archived.unwrap_or(false),
trashed: frontmatter.trashed.unwrap_or(false),
trashed_at: frontmatter.trashed_at.as_deref().and_then(parse_iso_date),
modified_at, created_at, file_size,
icon: frontmatter.icon,
color: frontmatter.color,