fix: hide system properties (trashed, archived, icon) from Properties panel

These properties have dedicated UI elsewhere (trash/archive banner, emoji picker)
and should not appear as generic editable properties.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Test
2026-03-19 03:28:29 +01:00
parent 975931ec6d
commit d4b0cd5cc2
2 changed files with 56 additions and 7 deletions

View File

@@ -227,14 +227,14 @@ describe('DynamicPropertiesPanel', () => {
<DynamicPropertiesPanel
entry={makeEntry()}
content=""
frontmatter={{ archived: false }}
frontmatter={{ published: false }}
onUpdateProperty={onUpdateProperty}
/>
)
// Boolean should show as Yes/No toggle
const toggleBtn = screen.getByText('\u2717 No')
fireEvent.click(toggleBtn)
expect(onUpdateProperty).toHaveBeenCalledWith('archived', true)
expect(onUpdateProperty).toHaveBeenCalledWith('published', true)
})
it('renders array property as tag pills', () => {
@@ -441,7 +441,7 @@ describe('DynamicPropertiesPanel', () => {
<DynamicPropertiesPanel
entry={makeEntry()}
content=""
frontmatter={{ archived: 'false' }}
frontmatter={{ draft: 'false' }}
onUpdateProperty={onUpdateProperty}
/>
)
@@ -450,7 +450,7 @@ describe('DynamicPropertiesPanel', () => {
const input = screen.getByDisplayValue('false')
fireEvent.change(input, { target: { value: 'true' } })
fireEvent.keyDown(input, { key: 'Enter' })
expect(onUpdateProperty).toHaveBeenCalledWith('archived', true)
expect(onUpdateProperty).toHaveBeenCalledWith('draft', true)
})
it('coerces numeric strings to numbers on save', () => {
@@ -885,7 +885,7 @@ describe('DynamicPropertiesPanel', () => {
<DynamicPropertiesPanel
entry={makeEntry()}
content=""
frontmatter={{ archived: false }}
frontmatter={{ published: false }}
onUpdateProperty={onUpdateProperty}
/>
)
@@ -894,6 +894,54 @@ describe('DynamicPropertiesPanel', () => {
})
})
describe('system property filtering', () => {
it('hides trashed, trashed_at, archived, archived_at, icon from properties panel', () => {
render(
<DynamicPropertiesPanel
entry={makeEntry()}
content=""
frontmatter={{ trashed: true, trashed_at: '2026-01-01', archived: false, archived_at: '', icon: '📝', cadence: 'Weekly' }}
onUpdateProperty={onUpdateProperty}
/>
)
expect(screen.queryByText('trashed')).not.toBeInTheDocument()
expect(screen.queryByText('trashed_at')).not.toBeInTheDocument()
expect(screen.queryByText('archived')).not.toBeInTheDocument()
expect(screen.queryByText('archived_at')).not.toBeInTheDocument()
expect(screen.queryByText('icon')).not.toBeInTheDocument()
// Custom property still visible
expect(screen.getByText('cadence')).toBeInTheDocument()
})
it('filters system properties case-insensitively', () => {
render(
<DynamicPropertiesPanel
entry={makeEntry()}
content=""
frontmatter={{ Trashed: true, Archived: false, Icon: '🎯', cadence: 'Daily' }}
onUpdateProperty={onUpdateProperty}
/>
)
expect(screen.queryByText('Trashed')).not.toBeInTheDocument()
expect(screen.queryByText('Archived')).not.toBeInTheDocument()
expect(screen.queryByText('Icon')).not.toBeInTheDocument()
expect(screen.getByText('cadence')).toBeInTheDocument()
})
it('does not filter similar but non-matching property names', () => {
render(
<DynamicPropertiesPanel
entry={makeEntry()}
content=""
frontmatter={{ 'Is Trashed': true, 'archive_date': '2026-01-01' }}
onUpdateProperty={onUpdateProperty}
/>
)
expect(screen.getByText('Is Trashed')).toBeInTheDocument()
expect(screen.getByText('archive_date')).toBeInTheDocument()
})
})
describe('display mode override', () => {
beforeEach(() => {
resetVaultConfigStore()

View File

@@ -11,7 +11,8 @@ import {
import { containsWikilinks } from '../components/DynamicPropertiesPanel'
// Keys to skip showing in Properties (handled by dedicated UI or internal)
const SKIP_KEYS = new Set(['aliases', 'workspace', 'title', 'type', 'is_a', 'Is A'])
// Compared case-insensitively via isVisibleProperty()
const SKIP_KEYS = new Set(['aliases', 'workspace', 'title', 'type', 'is_a', 'is a', 'trashed', 'trashed_at', 'archived', 'archived_at', 'icon'])
function coerceValue(raw: string): FrontmatterValue {
if (raw.toLowerCase() === 'true') return true
@@ -79,7 +80,7 @@ function collectAllVaultTags(entries: VaultEntry[] | undefined): Record<string,
}
function isVisibleProperty([key, value]: [string, FrontmatterValue]): boolean {
return !SKIP_KEYS.has(key) && !containsWikilinks(value)
return !SKIP_KEYS.has(key.toLowerCase()) && !containsWikilinks(value)
}
function parseAddedValue(rawValue: string, mode: PropertyDisplayMode): FrontmatterValue {