import type { BaseItemDto } from '@jellyfin/sdk/lib/generated-client/models/base-item-dto'; import type { UserDto } from '@jellyfin/sdk/lib/generated-client/models/user-dto'; import type { ApiClient } from 'jellyfin-apiclient'; import { appRouter } from 'components/router/appRouter'; import cardBuilder from 'components/cardbuilder/cardBuilder'; import layoutManager from 'components/layoutManager'; import ServerConnections from 'components/ServerConnections'; import globalize from 'scripts/globalize'; import { getBackdropShape } from 'utils/card'; import type { SectionContainerElement, SectionOptions } from './section'; function getOnNowFetchFn( serverId: string ) { return function () { const apiClient = ServerConnections.getApiClient(serverId); return apiClient.getLiveTvRecommendedPrograms({ userId: apiClient.getCurrentUserId(), IsAiring: true, limit: 24, ImageTypeLimit: 1, EnableImageTypes: 'Primary,Thumb,Backdrop', EnableTotalRecordCount: false, Fields: 'ChannelInfo,PrimaryImageAspectRatio' }); }; } function getOnNowItemsHtmlFn( { enableOverflow }: SectionOptions ) { return (items: BaseItemDto[]) => ( cardBuilder.getCardsHtml({ items: items, preferThumb: 'auto', inheritThumb: false, shape: (enableOverflow ? 'autooverflow' : 'auto'), showParentTitleOrTitle: true, showTitle: true, centerText: true, coverImage: true, overlayText: false, allowBottomPadding: !enableOverflow, showAirTime: true, showChannelName: false, showAirDateTime: false, showAirEndTime: true, defaultShape: getBackdropShape(enableOverflow), lines: 3, overlayPlayButton: true }) ); } function buildSection( elem: HTMLElement, serverId: string, options: SectionOptions ) { let html = ''; elem.classList.remove('padded-left'); elem.classList.remove('padded-right'); elem.classList.remove('padded-bottom'); elem.classList.remove('verticalSection'); html += '