mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
feat: Implement nextup for custom home
This commit is contained in:
@@ -308,10 +308,10 @@ export default function index() {
|
|||||||
const section = settings.home?.sections[key];
|
const section = settings.home?.sections[key];
|
||||||
ss.push({
|
ss.push({
|
||||||
title: key,
|
title: key,
|
||||||
queryKey: ["home", key, user?.Id],
|
queryKey: ["home", key],
|
||||||
queryFn: async () =>
|
queryFn: async () => {
|
||||||
(
|
if (section.items) {
|
||||||
await getItemsApi(api).getItems({
|
const response = await getItemsApi(api).getItems({
|
||||||
userId: user?.Id,
|
userId: user?.Id,
|
||||||
limit: section.items?.limit || 25,
|
limit: section.items?.limit || 25,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
@@ -320,8 +320,21 @@ export default function index() {
|
|||||||
sortOrder: section.items?.sortOrder,
|
sortOrder: section.items?.sortOrder,
|
||||||
filters: section.items?.filters,
|
filters: section.items?.filters,
|
||||||
parentId: section.items?.parentId,
|
parentId: section.items?.parentId,
|
||||||
})
|
});
|
||||||
).data.Items || [],
|
return response.data.Items || [];
|
||||||
|
} else if (section.nextUp) {
|
||||||
|
const response = await getTvShowsApi(api).getNextUp({
|
||||||
|
userId: user?.Id,
|
||||||
|
fields: ["MediaSourceCount"],
|
||||||
|
limit: section.items?.limit || 25,
|
||||||
|
enableImageTypes: ["Primary", "Backdrop", "Thumb"],
|
||||||
|
enableResumable: section.items?.enableResumable || false,
|
||||||
|
enableRewatching: section.items?.enableRewatching || false,
|
||||||
|
});
|
||||||
|
return response.data.Items || [];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
type: "ScrollingCollectionList",
|
type: "ScrollingCollectionList",
|
||||||
orientation: section?.orientation || "vertical",
|
orientation: section?.orientation || "vertical",
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ export type Home = {
|
|||||||
export type HomeSection = {
|
export type HomeSection = {
|
||||||
orientation?: "horizontal" | "vertical";
|
orientation?: "horizontal" | "vertical";
|
||||||
items?: HomeSectionItemResolver;
|
items?: HomeSectionItemResolver;
|
||||||
|
nextUp?: HomeSectionNextUpResolver;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HomeSectionItemResolver = {
|
export type HomeSectionItemResolver = {
|
||||||
@@ -92,6 +93,13 @@ export type HomeSectionItemResolver = {
|
|||||||
filters?: Array<ItemFilter>;
|
filters?: Array<ItemFilter>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type HomeSectionNextUpResolver = {
|
||||||
|
parentId?: string;
|
||||||
|
limit?: number;
|
||||||
|
enableResumable?: boolean;
|
||||||
|
enableRewatching?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export type Settings = {
|
export type Settings = {
|
||||||
home?: Home | null;
|
home?: Home | null;
|
||||||
autoRotate?: boolean;
|
autoRotate?: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user