mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-09 17:36:15 -08:00
The header search on the Settings page was shown but disabled. It now searches a shared index of all 56 settings rows by translated title, description and English synonyms, replaces the section page with ranked results, and opens a result by scrolling to, focusing and briefly highlighting its row. Enter opens the best match, and the section navigation shows per-section match counts. The command palette gains a "Settings" group that lists the best six matches for a non-empty query, so any setting is one Ctrl/Cmd+K away. Rows hidden by the current form state fall back to the control that reveals them; rows the runtime cannot render are never returned. The index ships through a new @iptvnator/workspace/shell/util/settings-search sub-entrypoint so it stays out of the eager bundle, and a registry spec keeps it in step with the section templates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { Injectable, signal } from '@angular/core';
|
|
|
|
export interface SettingsNavItem {
|
|
id: string;
|
|
label: string;
|
|
icon: string;
|
|
}
|
|
|
|
/**
|
|
* Bridge between the routed settings page and the workspace context panel:
|
|
* the page publishes which section pages exist for the current runtime, the
|
|
* panel renders them as router links to `/workspace/settings/:section`.
|
|
* Active-state highlighting comes from the router (`routerLinkActive`), not
|
|
* from this service.
|
|
*/
|
|
@Injectable({ providedIn: 'root' })
|
|
export class SettingsContextService {
|
|
readonly sections = signal<SettingsNavItem[]>([]);
|
|
/**
|
|
* Settings search matches per section id while a search term is active,
|
|
* `null` otherwise. The panel shows the counts and mutes sections
|
|
* without matches.
|
|
*/
|
|
readonly matchCounts = signal<Readonly<Record<string, number>> | null>(
|
|
null
|
|
);
|
|
|
|
setSections(items: SettingsNavItem[]): void {
|
|
this.sections.set(items);
|
|
}
|
|
|
|
setMatchCounts(counts: Readonly<Record<string, number>> | null): void {
|
|
this.matchCounts.set(counts);
|
|
}
|
|
|
|
reset(): void {
|
|
this.sections.set([]);
|
|
this.matchCounts.set(null);
|
|
}
|
|
}
|