mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-10 18:36:15 -08:00
fix(ui): destructive confirmations, verb labels and provider icons
Confirmations: ConfirmDialogData.confirmLabel is required, so no dialog can
fall back to "Yes"/"No"; the dismiss defaults to "Cancel" and
`tone: 'destructive'` styles the confirm with .app-destructive-button. Every
caller names its action ("Remove playlist", "Clear", "Refresh playlist",
"Cancel download" with a "Close" dismiss). The confirm button has the
confirm-dialog-confirm test id and drops its no-op color="primary".
The no-op `warn` color input becomes .app-destructive-button on the EPG
mapping, playlist item, error view, EPG/reset settings, delete-all and source
cleanup buttons, and on the unsaved-changes dialog's Discard.
Provider icons come from SOURCE_TYPE_ICONS in shared/interfaces (Xtream
cloud, Stalker cast, M3U playlist_play / link / description / subject) in the
add dialog, auto-import, empty state, playlist switcher, playlist rows,
dashboard source rail, command palette, Sources filters and both reset
summaries. Stalker no longer borrows the Dashboard icon, and Xtream no longer
shares a glyph with M3U URL playlists.
The playlist error view removed a playlist through the stale
PlaylistActions.removePlaylist: it dropped the playlist from state before the
delete ran, swallowed failures, skipped the source activity guard and showed
no toast. It now uses PlaylistDeleteActionService like every other removal,
commits only a completed delete, toasts and goes home. The unused action and
its effect are removed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
572034f3be
commit
082c56608b
50 files changed
+584
-103
No files matched your search
@@ -47,6 +47,7 @@ export * from './lib/portal-debug.interface';
|
||||
export * from './lib/playlist-display-label.util';
|
||||
export * from './lib/portal-playback.interface';
|
||||
export * from './lib/provider-import-detection.util';
|
||||
export * from './lib/source-type-icons.util';
|
||||
export * from './lib/provider-overview.util';
|
||||
export * from './lib/random-id.util';
|
||||
export * from './lib/recording-metadata.interface';
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import {
|
||||
getPlaylistSourceIcon,
|
||||
resolvePlaylistSourceIconKey,
|
||||
SOURCE_TYPE_ICONS,
|
||||
} from './source-type-icons.util';
|
||||
|
||||
describe('source type icons', () => {
|
||||
it('never lets one icon stand for two providers', () => {
|
||||
const byProvider = {
|
||||
xtream: [SOURCE_TYPE_ICONS.xtream],
|
||||
stalker: [SOURCE_TYPE_ICONS.stalker],
|
||||
m3u: [
|
||||
SOURCE_TYPE_ICONS.m3u,
|
||||
SOURCE_TYPE_ICONS['m3u-url'],
|
||||
SOURCE_TYPE_ICONS['m3u-local'],
|
||||
SOURCE_TYPE_ICONS['m3u-text'],
|
||||
],
|
||||
};
|
||||
const owners = new Map<string, string>();
|
||||
for (const [provider, icons] of Object.entries(byProvider)) {
|
||||
for (const icon of icons) {
|
||||
expect(owners.get(icon) ?? provider).toBe(provider);
|
||||
owners.set(icon, provider);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('does not reuse the Dashboard rail icon for a provider', () => {
|
||||
expect(Object.values(SOURCE_TYPE_ICONS)).not.toContain('dashboard');
|
||||
});
|
||||
|
||||
it.each([
|
||||
[{ macAddress: '00:1A:79:00:00:01', url: 'http://portal' }, 'stalker'],
|
||||
[{ serverUrl: 'http://xtream' }, 'xtream'],
|
||||
[{ url: 'http://list.m3u' }, 'm3u-url'],
|
||||
[{}, 'm3u-local'],
|
||||
] as const)('resolves %o to %s', (playlist, expected) => {
|
||||
expect(resolvePlaylistSourceIconKey(playlist)).toBe(expected);
|
||||
expect(getPlaylistSourceIcon(playlist)).toBe(
|
||||
SOURCE_TYPE_ICONS[expected]
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { PlaylistMeta } from './playlist-meta.type';
|
||||
|
||||
/**
|
||||
* One Material icon ligature per source type, used everywhere a source is
|
||||
* shown: the add dialog, provider auto-detection, the Sources list and its
|
||||
* filters, the playlist switcher, dashboard cards, the command palette and
|
||||
* the reset summaries. A provider must look the same on every screen, and no
|
||||
* icon may stand for two providers.
|
||||
*
|
||||
* `m3u` is the provider family (filters and summaries that count every M3U
|
||||
* source); the other M3U keys name how a single playlist was added. Stored
|
||||
* playlists cannot tell a local file from pasted text, so both render as
|
||||
* `m3u-local`; only the add dialog and auto-detection show `m3u-text`.
|
||||
*/
|
||||
export const SOURCE_TYPE_ICONS = {
|
||||
m3u: 'playlist_play',
|
||||
'm3u-url': 'link',
|
||||
'm3u-local': 'description',
|
||||
'm3u-text': 'subject',
|
||||
xtream: 'cloud',
|
||||
stalker: 'cast',
|
||||
} as const;
|
||||
|
||||
export type SourceTypeIconKey = keyof typeof SOURCE_TYPE_ICONS;
|
||||
|
||||
export type PlaylistSourceIconKey = Extract<
|
||||
SourceTypeIconKey,
|
||||
'm3u-url' | 'm3u-local' | 'xtream' | 'stalker'
|
||||
>;
|
||||
|
||||
export function resolvePlaylistSourceIconKey(
|
||||
playlist: Pick<PlaylistMeta, 'macAddress' | 'serverUrl' | 'url'>
|
||||
): PlaylistSourceIconKey {
|
||||
if (playlist.macAddress) {
|
||||
return 'stalker';
|
||||
}
|
||||
if (playlist.serverUrl) {
|
||||
return 'xtream';
|
||||
}
|
||||
if (playlist.url) {
|
||||
return 'm3u-url';
|
||||
}
|
||||
return 'm3u-local';
|
||||
}
|
||||
|
||||
export function getPlaylistSourceIcon(
|
||||
playlist: Pick<PlaylistMeta, 'macAddress' | 'serverUrl' | 'url'>
|
||||
): string {
|
||||
return SOURCE_TYPE_ICONS[resolvePlaylistSourceIconKey(playlist)];
|
||||
}
|
||||
Reference in new issue
Block a user