mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-12 20:16:15 -08:00
Merge remote-tracking branch 'origin/master' into claude/iptvnator-vod-hero-redesign-2c8950
# Conflicts: # apps/electron-backend-e2e/src/detail-back-lane.e2e.ts # apps/web-e2e/src/m3u-movie-details.e2e.ts # docs/architecture/iptvnator-ui-guidelines.md # libs/ui/components/src/lib/content-hero/content-hero.component.scss # libs/ui/components/src/lib/portal-detail-shell/portal-detail-shell.component.scss
This commit is contained in:
commit
87d7e1d46c
122 files changed
+2080
-1040
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