From 168fcaf0497e539daac2beea18c8ed0976c3bf94 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Sun, 19 Oct 2025 22:19:35 -0400 Subject: [PATCH] feat: reorder frontmatter keys and add publish/private quick links --- server/ensureFrontmatter.test.mjs | 10 +-- src/app/features/list/notes-list.component.ts | 4 +- .../quick-links/quick-links.component.ts | 30 ++++++-- .../sidebar/nimbus-sidebar.component.ts | 20 ++++- .../app-shell-nimbus.component.ts | 22 +++++- .../note-viewer/note-viewer.component.ts | 77 +++++++++++++------ src/services/vault.service.ts | 6 ++ vault/Nouveau-markdown.md | 17 ++++ vault/Nouveau-markdown.md.bak | 0 9 files changed, 144 insertions(+), 42 deletions(-) create mode 100644 vault/Nouveau-markdown.md create mode 100644 vault/Nouveau-markdown.md.bak diff --git a/server/ensureFrontmatter.test.mjs b/server/ensureFrontmatter.test.mjs index 0b27637..866a5f7 100644 --- a/server/ensureFrontmatter.test.mjs +++ b/server/ensureFrontmatter.test.mjs @@ -162,13 +162,13 @@ test('Should maintain correct key order', async () => { 'tags:', 'aliases:', 'status:', - 'publish:', 'favoris:', - 'template:', - 'task:', - 'archive:', + 'publish:', 'draft:', - 'private:' + 'template:', + 'task:', + 'private:', + 'archive:' ]; let lastIndex = -1; diff --git a/src/app/features/list/notes-list.component.ts b/src/app/features/list/notes-list.component.ts index 6c3199c..06c5df6 100644 --- a/src/app/features/list/notes-list.component.ts +++ b/src/app/features/list/notes-list.component.ts @@ -50,7 +50,7 @@ export class NotesListComponent { folderFilter = input(null); // like "folder/subfolder" query = input(''); tagFilter = input(null); - quickLinkFilter = input<'favoris' | 'template' | 'task' | 'draft' | 'archive' | null>(null); + quickLinkFilter = input<'favoris' | 'publish' | 'draft' | 'template' | 'task' | 'private' | 'archive' | null>(null); @Output() openNote = new EventEmitter(); @Output() queryChange = new EventEmitter(); @@ -72,7 +72,7 @@ export class NotesListComponent { // All files anywhere under .trash (including subfolders) list = list.filter(n => { const filePath = (n.filePath || n.originalPath || '').toLowerCase().replace(/\\/g, '/'); - return filePath.includes('/.trash/'); + return filePath.startsWith('.trash/') || filePath.includes('/.trash/'); }); } else { list = list.filter(n => { diff --git a/src/app/features/quick-links/quick-links.component.ts b/src/app/features/quick-links/quick-links.component.ts index 338cdd4..734fc1a 100644 --- a/src/app/features/quick-links/quick-links.component.ts +++ b/src/app/features/quick-links/quick-links.component.ts @@ -6,9 +6,11 @@ import { BadgeCountComponent } from '../../shared/ui/badge-count.component'; interface QuickLinkCountsUi { all: number; favorites: number; + publish: number; templates: number; tasks: number; drafts: number; + private: number; archive: number; } @@ -21,32 +23,44 @@ interface QuickLinkCountsUi {
  • - +
  • +
  • + +
  • +
  • +
  • -
  • diff --git a/src/app/features/sidebar/nimbus-sidebar.component.ts b/src/app/features/sidebar/nimbus-sidebar.component.ts index 0d8b113..1f98beb 100644 --- a/src/app/features/sidebar/nimbus-sidebar.component.ts +++ b/src/app/features/sidebar/nimbus-sidebar.component.ts @@ -54,7 +54,7 @@ import { VaultService } from '../../../services/vault.service';
    @@ -92,7 +92,7 @@ import { VaultService } from '../../../services/vault.service';
    @@ -146,4 +146,20 @@ export class NimbusSidebarComponent { trashCount = () => this.vault.counts().trash; trashHasContent = () => (this.vault.trashTree() || []).length > 0; trackNoteId = (_: number, n: { id: string }) => n.id; + + toggleFoldersSection(): void { + const next = !this.open.folders; + this.open.folders = next; + if (next) { + this.quickLinkSelected.emit('all'); + } + } + + toggleTrashSection(): void { + const next = !this.open.trash; + this.open.trash = next; + if (next) { + this.folderSelected.emit('.trash'); + } + } } diff --git a/src/app/layout/app-shell-nimbus/app-shell-nimbus.component.ts b/src/app/layout/app-shell-nimbus/app-shell-nimbus.component.ts index 50adddb..45ab09d 100644 --- a/src/app/layout/app-shell-nimbus/app-shell-nimbus.component.ts +++ b/src/app/layout/app-shell-nimbus/app-shell-nimbus.component.ts @@ -261,7 +261,7 @@ export class AppShellNimbusLayoutComponent { hoveredFlyout: 'quick' | 'folders' | 'tags' | 'trash' | null = null; private flyoutCloseTimer: any = null; tagFilter: string | null = null; - quickLinkFilter: 'favoris' | 'template' | 'task' | 'draft' | 'archive' | null = null; + quickLinkFilter: 'favoris' | 'publish' | 'draft' | 'template' | 'task' | 'private' | 'archive' | null = null; toggleNoteFullScreen(): void { this.noteFullScreen = !this.noteFullScreen; @@ -324,6 +324,16 @@ export class AppShellNimbusLayoutComponent { this.mobileNav.setActiveTab('list'); } this.scheduleCloseFlyout(150); + } else if (_id === 'publish') { + // Filter by publish: true + this.folderFilter = null; + this.tagFilter = null; + this.quickLinkFilter = 'publish'; + this.listQuery = ''; + if (!this.responsive.isDesktop()) { + this.mobileNav.setActiveTab('list'); + } + this.scheduleCloseFlyout(150); } else if (_id === 'favorites') { // Filter by favoris: true this.folderFilter = null; @@ -364,6 +374,16 @@ export class AppShellNimbusLayoutComponent { this.mobileNav.setActiveTab('list'); } this.scheduleCloseFlyout(150); + } else if (_id === 'private') { + // Filter by private: true + this.folderFilter = null; + this.tagFilter = null; + this.quickLinkFilter = 'private'; + this.listQuery = ''; + if (!this.responsive.isDesktop()) { + this.mobileNav.setActiveTab('list'); + } + this.scheduleCloseFlyout(150); } else if (_id === 'archive') { // Filter by archive: true this.folderFilter = null; diff --git a/src/components/tags-view/note-viewer/note-viewer.component.ts b/src/components/tags-view/note-viewer/note-viewer.component.ts index b4f2846..6aef0a7 100644 --- a/src/components/tags-view/note-viewer/note-viewer.component.ts +++ b/src/components/tags-view/note-viewer/note-viewer.component.ts @@ -202,15 +202,6 @@ interface MetadataEntry { {{ getAuthorFromFrontmatter() ?? note().author ?? 'Auteur inconnu' }} - @if (hasState('publish')) { - - - - - - - - } @if (hasState('favoris')) { @if (state('favoris')) { @@ -224,21 +215,13 @@ interface MetadataEntry { } } - @if (hasState('archive')) { - - @if (state('archive')) { + @if (hasState('publish')) { + - - - + + + - } @else { - - - - - - } } @if (hasState('draft')) { @@ -256,6 +239,35 @@ interface MetadataEntry { } } + @if (hasState('template')) { + + @if (state('template')) { + + + + + + } @else { + + + + } + + } + @if (hasState('task')) { + + @if (state('task')) { + + + + + } @else { + + + + } + + } @if (hasState('private')) { @if (state('private')) { @@ -271,6 +283,23 @@ interface MetadataEntry { } } + @if (hasState('archive')) { + + @if (state('archive')) { + + + + + + } @else { + + + + + + } + + }
    @@ -1148,7 +1177,7 @@ export class NoteViewerComponent implements OnDestroy { this.copyFeedbackTimers.set(block, timeout); } - hasState(key: 'publish' | 'favoris' | 'archive' | 'draft' | 'private'): boolean { + hasState(key: 'publish' | 'favoris' | 'archive' | 'draft' | 'private' | 'template' | 'task'): boolean { try { const fm = (this.note()?.frontmatter ?? {}) as any; const raw = (fm as any)[key]; @@ -1158,7 +1187,7 @@ export class NoteViewerComponent implements OnDestroy { } } - state(key: 'publish' | 'favoris' | 'archive' | 'draft' | 'private'): boolean { + state(key: 'publish' | 'favoris' | 'archive' | 'draft' | 'private' | 'template' | 'task'): boolean { try { const fm = (this.note()?.frontmatter ?? {}) as any; const raw = (fm as any)[key]; diff --git a/src/services/vault.service.ts b/src/services/vault.service.ts index aa58309..c36f4ff 100644 --- a/src/services/vault.service.ts +++ b/src/services/vault.service.ts @@ -29,9 +29,11 @@ interface VaultApiResponse { interface QuickLinkCounts { all: number; favorites: number; + publish: number; templates: number; tasks: number; drafts: number; + private: number; archive: number; trash: number; } @@ -449,9 +451,11 @@ export class VaultService implements OnDestroy { const counts: QuickLinkCounts = { all: 0, favorites: 0, + publish: 0, templates: 0, tasks: 0, drafts: 0, + private: 0, archive: 0, trash: 0 }; @@ -468,9 +472,11 @@ export class VaultService implements OnDestroy { const fm = note.frontmatter || {}; if (fm.favoris === true) counts.favorites++; + if (fm.publish === true) counts.publish++; if (fm.template === true) counts.templates++; if (fm.task === true) counts.tasks++; if (fm.draft === true) counts.drafts++; + if (fm.private === true) counts.private++; if (fm.archive === true) counts.archive++; } diff --git a/vault/Nouveau-markdown.md b/vault/Nouveau-markdown.md new file mode 100644 index 0000000..0beaa78 --- /dev/null +++ b/vault/Nouveau-markdown.md @@ -0,0 +1,17 @@ +--- +titre: Nouveau-markdown +auteur: Bruno Charest +creation_date: 2025-10-19T21:42:53-04:00 +modification_date: 2025-10-19T21:43:06-04:00 +catégorie: "" +tags: [] +aliases: [] +status: en-cours +publish: true +favoris: true +template: true +task: true +archive: true +draft: true +private: true +--- diff --git a/vault/Nouveau-markdown.md.bak b/vault/Nouveau-markdown.md.bak new file mode 100644 index 0000000..e69de29