mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-10 10:06:15 -08:00
- Introduced M3uRecentlyViewedItem interface to define structure for recently viewed items. - Implemented utility functions to handle mapping and building of recently viewed items from playlists. - Updated Playlist interface to use PlaylistRecentlyViewedItem type for recently viewed items. - Enhanced PortalActivityItem interface to include 'm3u' as a possible source. - Added UI components for displaying recently viewed channels, including clear functionality. - Integrated recent view functionality into the channel list container and sidebar components. - Updated dashboard data service to manage M3U favorites and recently viewed items. - Added tests to ensure correct behavior of recently viewed items in the dashboard data service.
35 lines
833 B
TypeScript
35 lines
833 B
TypeScript
import { StalkerPortalItem } from './stalker-portal-item.interface';
|
|
|
|
export interface M3uRecentlyViewedItem {
|
|
source: 'm3u';
|
|
id: string;
|
|
url: string;
|
|
title: string;
|
|
channel_id?: string;
|
|
poster_url?: string;
|
|
tvg_id?: string;
|
|
tvg_name?: string;
|
|
group_title?: string;
|
|
category_id: 'live';
|
|
added_at: string | number;
|
|
}
|
|
|
|
export type PlaylistRecentlyViewedItem =
|
|
| M3uRecentlyViewedItem
|
|
| StalkerPortalItem;
|
|
|
|
export function isM3uRecentlyViewedItem(
|
|
item: unknown
|
|
): item is M3uRecentlyViewedItem {
|
|
if (!item || typeof item !== 'object') {
|
|
return false;
|
|
}
|
|
|
|
const candidate = item as Record<string, unknown>;
|
|
return (
|
|
candidate['source'] === 'm3u' &&
|
|
typeof candidate['url'] === 'string' &&
|
|
candidate['url'].trim().length > 0
|
|
);
|
|
}
|