feat(settings): grouped navigation, cards and switches from the settings concept (#1853)

* feat(settings): grouped navigation, cards and switches from the settings concept

Implements the Claude Design "Settings concept" handoff.

Navigation: the sidebar is a 20px "Settings" title over App, Library, Devices
and Data groups, with About pinned to the footer beside the installed version
and an update badge. The active item is a soft fill without a border. Esc
leaves settings like the header Back. Reset is no longer a page: its one
destructive action is the last card of "Backup & data".

Pages: a title and one-line subtitle, then rows grouped into titled cards
with one right-aligned control column. Selects are compact without floating
labels, checkboxes are switches, segmented controls are pills, and
descriptions are capped at 56ch. "Show subtitles" moves to Playback, the
Embedded MPV note becomes a callout under the player select (only while it
is selected), and the TMDB attribution becomes the About footer.

EPG: Add and Refresh all sit in the Sources header, the empty state has its
own Add, the format examples are one line, Clear EPG data is its own row and
the offset is a stepper. About: version, update state and channel share one
card; the nightly warning is a callout shown only while Nightly is selected,
with a shortcut to the backup page; the support buttons are neutral with
coloured icons.

Save model: the save bar stays (design option B) and now floats over the
content column, counts the staged changes, answers Cmd/Ctrl+S, and marks
pages with staged edits in the sidebar. A saved change that waits for a
restart shows a dismissible notice.

Rows stack under 600px of pane width (the page is a size container, so the
persistent sidebar is accounted for). Page-specific styles moved into the
About, EPG, Backup and Remote control section stylesheets to stay within the
component style budget. New SETTINGS keys are translated in all 19 locales
and NAV_RESET is removed; brand names and loanwords that stay English are in
the identical-value baseline.

E2E: Material slide toggles report aria-checked after the next render, so
both suites toggle through a setSwitch helper; the settings nav is a
navigation landmark, so the Dashboard rail link is scoped to the rail.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(settings): compare restart notices against the running app, fix CI fallout

The restart notice now lists only the restart controls whose saved value
differs from what the running app uses: the stored values at first load,
or what the embedded engine reports it actually runs for the frame-copy
opt-in. Saving the launch value back withdraws the notice instead of
leaving it up with no chip to explain it. The refresh reads the current
list untracked and writes only a changed one, because the engine probe
effect calls it.

CI: the zoneless checklist dropped the deleted Reset section component, and
the theme-tokens Electron E2E floats the recording folder label on the
Playback page now that the settings selects carry no floating label.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(settings): keep a dismissed restart reminder away until the setting changes

"Later" now records the saved value it dismissed, for the rest of the app
run, so an unrelated save (or reopening Settings) does not bring the same
reminder back. It returns once a restart setting is saved with another
value.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Fable 5.1 authored and GitHub committed 2026-10-09 20:39:07 +02:00
1 parent 4c6540679d
commit 8030ced95a
90 files changed
+5957 -3617

No files matched your search

+111 -4
View File
@@ -3,6 +3,7 @@ import {
computed,
effect,
ElementRef,
HostListener,
inject,
OnDestroy,
OnInit,
@@ -23,12 +24,20 @@ import {
RuntimeCapabilitiesService,
} from '@iptvnator/services';
import { VodSourceDiscoveryService } from '@iptvnator/portal/shared/data-access';
import { Language, StreamFormat } from '@iptvnator/shared/interfaces';
import { firstValueFrom, map } from 'rxjs';
import {
ELECTRON_BRIDGE_APP_UPDATE_STATUSES,
Language,
StreamFormat,
} from '@iptvnator/shared/interfaces';
import { firstValueFrom, map, startWith } from 'rxjs';
import { BUILD_COMMIT } from '../../environments/build-commit';
import { SettingsAboutSectionComponent } from './settings-about-section.component';
import { SettingsAppUpdateFacade } from './settings-app-update.facade';
import { SettingsBackupSectionComponent } from './settings-backup-section.component';
import {
sectionOfSettingsPath,
SETTINGS_RESTART_CONTROLS,
} from './settings-change-tracking';
import { SettingsDashboardSectionComponent } from './settings-dashboard-section.component';
import { SettingsEmbeddedMpvFacade } from './settings-embedded-mpv.facade';
import { SettingsEpgFacade } from './settings-epg.facade';
@@ -51,7 +60,6 @@ import { SettingsParentalLockSectionComponent } from './settings-parental-sectio
import { SettingsPlaybackSectionComponent } from './settings-playback-section.component';
import { SettingsRemoteControlFacade } from './settings-remote-control.facade';
import { SettingsRemoteControlSectionComponent } from './settings-remote-control-section.component';
import { SettingsResetSectionComponent } from './settings-reset-section.component';
import { SettingsSearchFacade } from './settings-search.facade';
import { SettingsSearchResultsComponent } from './settings-search-results.component';
import { SettingsTmdbSectionComponent } from './settings-tmdb-section.component';
@@ -98,7 +106,6 @@ export const SETTINGS_DEFAULT_SECTION = 'general';
SettingsParentalLockSectionComponent,
SettingsPlaybackSectionComponent,
SettingsRemoteControlSectionComponent,
SettingsResetSectionComponent,
SettingsSearchResultsComponent,
SettingsTmdbSectionComponent,
],
@@ -179,6 +186,42 @@ export class SettingsComponent
/** Git commit the app was built from (CI builds only) */
readonly buildCommit = BUILD_COMMIT;
/** Staged leaf values that differ from the saved settings */
readonly changeCount = computed(() => this.form.changedPaths().length);
/** Save bar text: a count once something actually differs */
readonly unsavedMessageKey = computed(() => {
const count = this.changeCount();
if (count === 1) return 'SETTINGS.UNSAVED_CHANGES_ONE';
return count > 1
? 'SETTINGS.UNSAVED_CHANGES_COUNT'
: 'SETTINGS.UNSAVED_CHANGES';
});
/** Re-reads translated text after a language switch */
private readonly languageTick = toSignal(
this.translate.onLangChange.pipe(startWith(null)),
{ initialValue: null }
);
/** Rows whose saved change waits for a restart, as one readable list */
readonly restartPendingLabels = computed(() => {
this.languageTick();
return this.form
.restartPendingControls()
.map((control) =>
this.translate.instant(SETTINGS_RESTART_CONTROLS[control])
)
.join(', ');
});
/** The Save button advertises the platform's save chord */
readonly saveShortcutLabel = /mac|iphone|ipad/i.test(
navigator.platform || navigator.userAgent
)
? '⌘S'
: 'Ctrl+S';
readonly themeOptions = SETTINGS_THEME_OPTIONS;
readonly coverSizeOptions = SETTINGS_COVER_SIZE_OPTIONS;
readonly startupBehaviorOptions = SETTINGS_STARTUP_BEHAVIOR_OPTIONS;
@@ -242,6 +285,63 @@ export class SettingsComponent
activeSection: this.activeSection,
ready: this.formReady.asReadonly(),
});
// The navigation marks pages with staged edits and shows the
// installed version (with an update badge) beside About.
effect(() => {
const sections = new Set<string>();
for (const path of this.form.changedPaths()) {
const section = sectionOfSettingsPath(path);
if (section) sections.add(section);
}
this.settingsCtx.setDirtySections(sections);
});
// The frame-copy opt-in may not be what the engine runs (it was not
// available at launch): the restart notice compares against that.
effect(() => {
if (this.embeddedMpv.support()) {
this.form.setRunningValue(
'embeddedMpvFrameCopy',
this.embeddedMpv.frameCopyActive()
);
}
});
effect(() => {
const status = this.appUpdate.status()?.status;
this.settingsCtx.setVersion(this.appUpdate.version() || null);
this.settingsCtx.setUpdateAvailable(
status === ELECTRON_BRIDGE_APP_UPDATE_STATUSES.Available ||
status === ELECTRON_BRIDGE_APP_UPDATE_STATUSES.Downloaded
);
});
}
/**
* Cmd/Ctrl+S saves the staged edits. The browser's own save-page dialog
* is suppressed on every settings page, also while nothing is staged.
* While the page is inert (the phone drawer is open over it) or an
* overlay with a backdrop is up (the unsaved-changes dialog, a select
* panel), the chord belongs to that surface, not to the obscured form:
* saving under the leave dialog would make its Discard keep the edits.
*/
@HostListener('document:keydown', ['$event'])
onSaveShortcut(event: KeyboardEvent): void {
const host = this.hostElement.nativeElement;
if (
event.defaultPrevented ||
!(event.metaKey || event.ctrlKey) ||
event.altKey ||
event.shiftKey ||
event.key.toLowerCase() !== 's' ||
host.closest('[inert]') ||
host.ownerDocument.querySelector('.cdk-overlay-backdrop')
) {
return;
}
event.preventDefault();
if (!this.settingsForm.pristine && this.settingsForm.valid) {
this.onSubmit();
}
}
/**
@@ -274,6 +374,13 @@ export class SettingsComponent
this.settingsCtx.reset();
}
/** Switches section page in place, like the sidebar links do */
openSection(sectionId: string): void {
void this.router.navigate(['/workspace/settings', sectionId], {
replaceUrl: true,
});
}
/** Picks a recording folder in the desktop shell and stages it in the form */
async selectRecordingFolder(): Promise<void> {
const folder = await this.embeddedMpv.selectRecordingFolder();