fix(dashboard): address PR review feedback

This commit is contained in:
4gray committed 2026-05-22 00:59:17 +03:00
1 parent 7083bd2af4
commit 2ecb5c28f4
30 files changed
+340 -104

No files matched your search

@@ -17,6 +17,10 @@ interface PlaylistRecentLabels {
m3u: string;
}
function firstNonEmpty(...values: Array<string | undefined>): string | undefined {
return values.map((value) => value?.trim()).find(Boolean);
}
function getPlaylistRecentItems(
playlist: PlaylistMeta
): PlaylistRecentlyViewedItem[] {
@@ -76,9 +80,11 @@ function mapM3uPlaylistRecentItems(
acc.push({
id: rawItem.id || channelUrl,
title:
rawItem.title?.trim() ||
rawItem.tvg_name?.trim() ||
rawItem.channel_id ||
firstNonEmpty(
rawItem.title,
rawItem.tvg_name,
rawItem.channel_id
) ||
channelUrl,
type: 'live',
playlist_id: playlist._id,
@@ -87,6 +93,12 @@ function mapM3uPlaylistRecentItems(
category_id: rawItem.category_id || 'live',
xtream_id: channelUrl,
poster_url: rawItem.poster_url || undefined,
epg_lookup_key: firstNonEmpty(
rawItem.tvg_id,
rawItem.tvg_name,
rawItem.title,
rawItem.channel_id
),
source: 'm3u',
});
@@ -16,6 +16,11 @@ export interface PortalActivityItem {
category_id: string | number;
xtream_id: string | number;
poster_url?: string;
/**
* Preferred XMLTV lookup key for live EPG enrichment. For M3U channels this
* follows the app-wide tvg.id -> tvg.name -> display name fallback chain.
*/
epg_lookup_key?: string;
/**
* Wide backdrop URL (typically 16:9), persisted when the user first views
* the detail page. Absent for stalker and for items that have never had