diff --git a/src/components/homesections/homesections.js b/src/components/homesections/homesections.js index 794422ad1f..b2edfc7136 100644 --- a/src/components/homesections/homesections.js +++ b/src/components/homesections/homesections.js @@ -24,12 +24,14 @@ import ServerConnections from '../ServerConnections'; case 2: return 'resumeaudio'; case 3: - return 'livetv'; + return 'resumebook'; case 4: - return 'nextup'; + return 'livetv'; case 5: - return 'latestmedia'; + return 'nextup'; case 6: + return 'latestmedia'; + case 7: return 'none'; default: return ''; @@ -142,15 +144,17 @@ import ServerConnections from '../ServerConnections'; } else if (section === 'librarybuttons') { loadlibraryButtons(elem, apiClient, user, userSettings, userViews); } else if (section === 'resume') { - loadResumeVideo(elem, apiClient); + return loadResume(elem, apiClient, 'HeaderContinueWatching', 'Video'); } else if (section === 'resumeaudio') { - loadResumeAudio(elem, apiClient); + return loadResume(elem, apiClient, 'HeaderContinueListening', 'Audio'); } else if (section === 'activerecordings') { loadLatestLiveTvRecordings(elem, true, apiClient); } else if (section === 'nextup') { loadNextUp(elem, apiClient); } else if (section === 'onnow' || section === 'livetv') { return loadOnNow(elem, apiClient, user); + } else if (section == 'resumebook') { + return loadResume(elem, apiClient, 'HeaderContinueReading', 'Book'); } else { elem.innerHTML = ''; return Promise.resolve(); @@ -365,58 +369,10 @@ import ServerConnections from '../ServerConnections'; imageLoader.lazyChildren(elem); } - function getContinueWatchingFetchFn(serverId) { - return function () { - const apiClient = ServerConnections.getApiClient(serverId); - const screenWidth = dom.getWindowSize().innerWidth; - - let limit; - if (enableScrollX()) { - limit = 12; - } else { - limit = screenWidth >= 1920 ? 8 : (screenWidth >= 1600 ? 8 : (screenWidth >= 1200 ? 9 : 6)); - limit = Math.min(limit, 5); - } - - const options = { - Limit: limit, - Recursive: true, - Fields: 'PrimaryImageAspectRatio,BasicSyncInfo', - ImageTypeLimit: 1, - EnableImageTypes: 'Primary,Backdrop,Thumb', - EnableTotalRecordCount: false, - MediaTypes: 'Video' - }; - - return apiClient.getResumableItems(apiClient.getCurrentUserId(), options); - }; - } - - function getContinueWatchingItemsHtml(items) { - const cardLayout = false; - return cardBuilder.getCardsHtml({ - items: items, - preferThumb: true, - shape: getThumbShape(), - overlayText: false, - showTitle: true, - showParentTitle: true, - lazy: true, - showDetailsMenu: true, - overlayPlayButton: true, - context: 'home', - centerText: !cardLayout, - allowBottomPadding: false, - cardLayout: cardLayout, - showYear: true, - lines: 2 - }); - } - - function loadResumeVideo(elem, apiClient) { + function loadResume(elem, apiClient, headerText, mediaType) { let html = ''; - html += '