mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-13 20:56:19 -08:00
feat(global-widgets): add M3U recently-viewed and favs support
- 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.
This commit is contained in:
1 parent
188ebb6fd9
commit
1e9f5d9d05
27 files changed
+1286
-227
No files matched your search
@@ -36,6 +36,7 @@ import {
|
||||
PlaylistType,
|
||||
} from '@iptvnator/playlist/shared/ui';
|
||||
import {
|
||||
PlaylistActions,
|
||||
selectActivePlaylist,
|
||||
selectAllPlaylistsMeta,
|
||||
selectPlaylistTitle,
|
||||
@@ -55,6 +56,7 @@ import {
|
||||
PlaylistsService,
|
||||
SettingsStore,
|
||||
} from 'services';
|
||||
import { PlaylistMeta } from 'shared-interfaces';
|
||||
import {
|
||||
SettingsContextService,
|
||||
WorkspaceAccountInfoData,
|
||||
@@ -481,6 +483,21 @@ export class WorkspaceShellComponent {
|
||||
};
|
||||
}
|
||||
|
||||
if (context.provider === 'playlists' && section === 'recent') {
|
||||
return {
|
||||
icon: 'delete_sweep',
|
||||
tooltip: this.translateText(
|
||||
'WORKSPACE.SHELL.CLEAR_RECENTLY_VIEWED_SECTION'
|
||||
),
|
||||
ariaLabel: this.translateText(
|
||||
'WORKSPACE.SHELL.CLEAR_RECENTLY_VIEWED_SECTION_ARIA'
|
||||
),
|
||||
disabled:
|
||||
(this.activePlaylist()?.recentlyViewed?.length ?? 0) ===
|
||||
0,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
);
|
||||
@@ -707,11 +724,37 @@ export class WorkspaceShellComponent {
|
||||
}
|
||||
|
||||
if (context.provider === 'stalker' && section === 'recent') {
|
||||
await firstValueFrom(
|
||||
const updatedPlaylist = await firstValueFrom(
|
||||
this.playlistsService.clearPortalRecentlyViewed(
|
||||
context.playlistId
|
||||
)
|
||||
);
|
||||
this.store.dispatch(
|
||||
PlaylistActions.updatePlaylistMeta({
|
||||
playlist: {
|
||||
_id: context.playlistId,
|
||||
recentlyViewed: updatedPlaylist?.recentlyViewed ?? [],
|
||||
} as PlaylistMeta,
|
||||
}) as any
|
||||
);
|
||||
this.bumpRefreshQueryParam();
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.provider === 'playlists' && section === 'recent') {
|
||||
const updatedPlaylist = await firstValueFrom(
|
||||
this.playlistsService.clearM3uRecentlyViewed(
|
||||
context.playlistId
|
||||
)
|
||||
);
|
||||
this.store.dispatch(
|
||||
PlaylistActions.updatePlaylistMeta({
|
||||
playlist: {
|
||||
_id: context.playlistId,
|
||||
recentlyViewed: updatedPlaylist?.recentlyViewed ?? [],
|
||||
} as PlaylistMeta,
|
||||
}) as any
|
||||
);
|
||||
this.bumpRefreshQueryParam();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user