1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #3367 from SenorSmartyPants/Rewatch

Display rewatching list in Next up section on home page
This commit is contained in:
Bill Thornton 2022-02-21 12:35:35 -05:00 committed by GitHub
commit 270501e4f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 9 deletions

View file

@ -752,7 +752,13 @@ class AppRouter {
}
if (item === 'nextup') {
return '#!/list.html?type=nextup&serverId=' + options.serverId;
url = '#!/list.html?type=nextup&serverId=' + options.serverId;
if (options.rewatching) {
url += '&rewatching=' + options.rewatching;
}
return url;
}
if (item === 'list') {

View file

@ -596,7 +596,7 @@ import ServerConnections from '../ServerConnections';
});
}
function getNextUpFetchFn(serverId, userSettings) {
function getNextUpFetchFn(serverId, userSettings, rewatching) {
return function () {
const apiClient = ServerConnections.getApiClient(serverId);
const oldestDateForNextUp = new Date();
@ -609,7 +609,8 @@ import ServerConnections from '../ServerConnections';
EnableImageTypes: 'Primary,Backdrop,Banner,Thumb',
EnableTotalRecordCount: false,
DisableFirstEpisode: false,
NextUpDateCutoff: oldestDateForNextUp.toISOString()
NextUpDateCutoff: oldestDateForNextUp.toISOString(),
Rewatching: rewatching
});
};
}
@ -635,21 +636,32 @@ import ServerConnections from '../ServerConnections';
};
}
function loadNextUp(elem, apiClient, userSettings) {
function renderNextUpSection(elem, apiClient, userSettings, rewatching) {
let html = '';
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
if (!layoutManager.tv) {
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl('nextup', {
serverId: apiClient.serverId()
serverId: apiClient.serverId(),
rewatching: rewatching
}) + '" class="button-flat button-flat-mini sectionTitleTextButton">';
html += '<h2 class="sectionTitle sectionTitle-cards">';
html += globalize.translate('NextUp');
if (rewatching) {
html += globalize.translate('NextUpRewatching');
} else {
html += globalize.translate('NextUp');
}
html += '</h2>';
html += '<span class="material-icons chevron_right"></span>';
html += '</a>';
} else {
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('NextUp') + '</h2>';
html += '<h2 class="sectionTitle sectionTitle-cards">';
if (rewatching) {
html += globalize.translate('NextUpRewatching');
} else {
html += globalize.translate('NextUp');
}
html += '</h2>';
}
html += '</div>';
@ -669,11 +681,26 @@ import ServerConnections from '../ServerConnections';
elem.innerHTML = html;
const itemsContainer = elem.querySelector('.itemsContainer');
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId(), userSettings);
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId(), userSettings, rewatching);
itemsContainer.getItemsHtml = getNextUpItemsHtmlFn(userSettings.useEpisodeImagesInNextUpAndResume());
itemsContainer.parentContainer = elem;
}
function loadNextUp(elem, apiClient, userSettings) {
elem.classList.remove('verticalSection');
for (let i = 0; i <= 1; i++) {
const frag = document.createElement('div');
frag.classList.add('verticalSection');
frag.classList.add('hide');
elem.appendChild(frag);
// 0 pass is regular next up
// 1 pass is rewatching next up
renderNextUpSection(frag, apiClient, userSettings, i == 1);
}
}
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
return function () {
const apiClient = ServerConnections.getApiClient(serverId);