mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Display rewatching list in Next up section on home page
Supports a Rewatching list page as well.
This commit is contained in:
parent
d27bfe9410
commit
a6267aee68
4 changed files with 48 additions and 9 deletions
|
@ -752,7 +752,13 @@ class AppRouter {
|
|||
}
|
||||
|
||||
if (item === 'nextup') {
|
||||
return '#!/list.html?type=nextup&serverId=' + options.serverId;
|
||||
let url = '#!/list.html?type=nextup&serverId=' + options.serverId;
|
||||
|
||||
if (options.rewatching) {
|
||||
url += '&rewatching=' + options.rewatching;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if (item === 'list') {
|
||||
|
|
|
@ -600,7 +600,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();
|
||||
|
@ -613,7 +613,8 @@ import ServerConnections from '../ServerConnections';
|
|||
EnableImageTypes: 'Primary,Backdrop,Banner,Thumb',
|
||||
EnableTotalRecordCount: false,
|
||||
DisableFirstEpisode: false,
|
||||
NextUpDateCutoff: oldestDateForNextUp.toISOString()
|
||||
NextUpDateCutoff: oldestDateForNextUp.toISOString(),
|
||||
Rewatching: rewatching
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -639,21 +640,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">';
|
||||
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>';
|
||||
|
||||
|
@ -673,11 +685,27 @@ 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);
|
||||
|
|
|
@ -256,7 +256,8 @@ import { appRouter } from '../components/appRouter';
|
|||
ImageTypeLimit: 1,
|
||||
EnableImageTypes: 'Primary,Backdrop,Thumb',
|
||||
EnableTotalRecordCount: false,
|
||||
SortBy: sortBy
|
||||
SortBy: sortBy,
|
||||
Rewatching: params.rewatching
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -615,6 +616,9 @@ class ItemsView {
|
|||
}
|
||||
|
||||
if (params.type === 'nextup') {
|
||||
if (params.rewatching === 'true') {
|
||||
return globalize.translate('NextUpRewatching');
|
||||
}
|
||||
return globalize.translate('NextUp');
|
||||
}
|
||||
|
||||
|
|
|
@ -1125,6 +1125,7 @@
|
|||
"NextChapter": "Next chapter",
|
||||
"NextTrack": "Skip to next",
|
||||
"NextUp": "Next Up",
|
||||
"NextUpRewatching": "Rewatching",
|
||||
"No": "No",
|
||||
"NoCreatedLibraries": "Seems like you haven't created any libraries yet. {0}Would you like to create one now?{1}",
|
||||
"None": "None",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue