From 58b22a47c90dd5907150c0c67a2a84f76aad69b7 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Thu, 30 Oct 2025 14:01:26 -0400 Subject: [PATCH] feat: unify filter badges and enhance search UX - Introduced FilterBadgeComponent to consolidate tag, folder, quicklink and kind filters into a single row of badges - Added FilterService to manage cumulative tag filtering and kind selection state - Enhanced search behavior to maintain focus while typing and trigger note selection on enter - Reorganized sidebar sections to close other sections when one is opened - Added clear methods for individual filter types in UrlStateService - Improved folder --- .../filter-badge/filter-badge.component.ts | 41 ++++ src/app/features/list/notes-list.component.ts | 185 +++++++++--------- .../sidebar/nimbus-sidebar.component.ts | 41 ++-- .../app-shell-nimbus.component.ts | 5 +- src/app/services/filter.service.ts | 153 +++++++++++++++ src/app/services/sidebar-state.service.ts | 21 ++ src/app/services/url-state.service.ts | 20 ++ 7 files changed, 349 insertions(+), 117 deletions(-) create mode 100644 src/app/components/filter-badge/filter-badge.component.ts create mode 100644 src/app/services/filter.service.ts create mode 100644 src/app/services/sidebar-state.service.ts diff --git a/src/app/components/filter-badge/filter-badge.component.ts b/src/app/components/filter-badge/filter-badge.component.ts new file mode 100644 index 0000000..77d6177 --- /dev/null +++ b/src/app/components/filter-badge/filter-badge.component.ts @@ -0,0 +1,41 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@Component({ + selector: 'app-filter-badge', + standalone: true, + imports: [CommonModule], + template: ` + + + {{ label }} + + + `, + styles: [` + :host { display: inline-flex; } + .badge { + background: var(--badge-bg, color-mix(in oklab, var(--card) 96%, black 4%)); + color: var(--badge-fg, var(--text-main)); + border: 1px solid color-mix(in oklab, var(--border) 70%, transparent 30%); + box-shadow: 0 1px 1.5px color-mix(in oklab, var(--shadow) 8%, transparent 92%); + } + :host-context(html.dark) .badge { + background: var(--badge-bg, color-mix(in oklab, var(--card) 86%, black 14%)); + color: var(--badge-fg, var(--text-main)); + border-color: color-mix(in oklab, var(--border) 55%, transparent 45%); + } + .remove { color: var(--text-muted); } + .remove:hover { background: color-mix(in oklab, var(--surface2) 25%, transparent 75%); color: var(--text-main); } + `] +}) +export class FilterBadgeComponent { + @Input() label = ''; + @Input() icon = ''; + @Output() remove = new EventEmitter(); +} diff --git a/src/app/features/list/notes-list.component.ts b/src/app/features/list/notes-list.component.ts index f39924e..506ef8e 100644 --- a/src/app/features/list/notes-list.component.ts +++ b/src/app/features/list/notes-list.component.ts @@ -8,6 +8,8 @@ import { NotesListStateService, SortBy, ViewMode } from '../../services/notes-li import { NoteCreationService } from '../../services/note-creation.service'; import { NoteContextMenuComponent } from '../../../components/note-context-menu/note-context-menu.component'; import { WarningPanelComponent } from '../../components/warning-panel/warning-panel.component'; +import { FilterBadgeComponent } from '../../components/filter-badge/filter-badge.component'; +import { FilterService } from '../../services/filter.service'; import { NoteContextMenuService } from '../../services/note-context-menu.service'; import { UrlStateService } from '../../services/url-state.service'; import { EditorStateService } from '../../../services/editor-state.service'; @@ -17,28 +19,16 @@ import { FileTypeDetectorService } from '../../../services/file-type-detector.se @Component({ selector: 'app-notes-list', standalone: true, - imports: [CommonModule, ScrollableOverlayDirective, NoteContextMenuComponent, WarningPanelComponent], + imports: [CommonModule, ScrollableOverlayDirective, NoteContextMenuComponent, WarningPanelComponent, FilterBadgeComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
-
- - - Filtre: #{{ t }} - - -
-
- - {{ ql.icon }} {{ ql.name }} - - + +
+
@@ -51,9 +41,10 @@ import { FileTypeDetectorService } from '../../../services/file-type-detector.se
-