feat(channel): page details chaine multi-providers avec onglets et infinite scroll
CI / build-and-test (push) Successful in 13m34s
CI / build-and-test (push) Successful in 13m34s
- Strategy Pattern front: ChannelProviderInterface + 6 providers (yt/dm/tw/pt/od/ru) + factory (ids longs/courts) - ChannelContentService: cache par onglet/tri/recherche (TTL 5min), pagination nextPage - ChannelPage: header (banniere/avatar/subs/description ...plus), tabs dynamiques par capabilities, grilles videos/shorts 9:16/playlists/live, recherche debounced, tri recent/populaire, infinite scroll IntersectionObserver, skeletons/empty/error - Backend: GET /api/channels/:provider/:id/content (videos/shorts/playlists/live) natif par provider
This commit is contained in:
@@ -15,7 +15,17 @@
|
||||
|
||||
/** @typedef {'yt'|'dm'|'tw'|'pt'|'od'|'ru'} ProviderId */
|
||||
|
||||
/** @type {Record<ProviderId, { id: ProviderId, label: string, search: (q: string, opts: { limit: number, page?: number }) => Promise<Suggestion[]> }>} */
|
||||
import channelRegistry from './channel-registry.mjs';
|
||||
|
||||
/**
|
||||
* @typedef {Object} ProviderAdapter
|
||||
* @property {ProviderId} id
|
||||
* @property {string} label
|
||||
* @property {(q: string, opts: { limit: number, page?: number, sort?: string }) => Promise<Suggestion[]>} search
|
||||
* @property {(externalId: string, ctx?: any) => Promise<any=} } [fetchChannelById]
|
||||
*/
|
||||
|
||||
/** @type {Record<ProviderId, ProviderAdapter>} */
|
||||
export const providerRegistry = {
|
||||
/** @type {any} */ yt: (await import('./youtube.mjs')).default,
|
||||
/** @type {any} */ dm: (await import('./dailymotion.mjs')).default,
|
||||
@@ -25,6 +35,13 @@ export const providerRegistry = {
|
||||
/** @type {any} */ ru: (await import('./rumble.mjs')).default,
|
||||
};
|
||||
|
||||
for (const [pid, adapter] of Object.entries(providerRegistry)) {
|
||||
const channelAdapter = channelRegistry[/** @type {ProviderId} */(pid)];
|
||||
if (channelAdapter && typeof channelAdapter.fetchChannelById === 'function' && !adapter.fetchChannelById) {
|
||||
adapter.fetchChannelById = channelAdapter.fetchChannelById;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate and normalize a comma separated providers list
|
||||
* @param {string} input
|
||||
|
||||
Reference in New Issue
Block a user