feat: add URL state synchronization for navigation

- Added UrlStateService to sync app state with URL parameters for note selection, tags, folders, and search
- Implemented URL state effects in AppComponent to handle navigation from URL parameters
- Updated sidebar and layout components to reflect URL state changes in UI
- Added URL state updates when navigating via note selection, tag clicks, and search
- Modified note sharing to use URL parameters instead of route paths
- Added auto-opening of relevant
This commit is contained in:
2025-10-24 23:23:30 -04:00
parent 0f7cc552ca
commit 96745e9997
28 changed files with 5991 additions and 360 deletions
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, Output, ViewChild, inject } from '@angular/core';
import { Component, EventEmitter, Input, Output, ViewChild, inject, OnChanges, SimpleChanges } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { FileExplorerComponent } from '../../../components/file-explorer/file-explorer.component';
@@ -163,12 +163,13 @@ import { VaultService } from '../../../services/vault.service';
</div>
`
})
export class NimbusSidebarComponent {
export class NimbusSidebarComponent implements OnChanges {
@Input() vaultName = '';
@Input() effectiveFileTree: VaultNode[] = [];
@Input() selectedNoteId: string | null = null;
@Input() tags: TagInfo[] = [];
@Input() quickLinkFilter: 'favoris' | 'publish' | 'draft' | 'template' | 'task' | 'private' | 'archive' | null = null;
@Input() forceOpenSection: 'folders' | 'tags' | 'quick' | null = null;
@Output() toggleSidebarRequest = new EventEmitter<void>();
@Output() folderSelected = new EventEmitter<string>();
@@ -185,6 +186,19 @@ export class NimbusSidebarComponent {
private vault = inject(VaultService);
@ViewChild('foldersExplorer') private foldersExplorer?: FileExplorerComponent;
ngOnChanges(changes: SimpleChanges): void {
if (changes['forceOpenSection']) {
const which = this.forceOpenSection;
if (which === 'folders') {
this.open = { quick: false, folders: true, tags: false, trash: false, tests: false };
} else if (which === 'tags') {
this.open = { quick: false, folders: false, tags: true, trash: false, tests: false };
} else if (which === 'quick') {
this.open = { quick: true, folders: false, tags: false, trash: false, tests: false };
}
}
}
onQuickLink(id: string) { this.quickLinkSelected.emit(id); }
onMarkdownPlaygroundClick(): void {