# New downloads page for downloaded TV-Series

- Renamed downloads.tsx to index.tsx
- Added new downloads/series.tsx page
- Downloading now saves series primary image
- Downloads index page now shows series primary image with downloaded episode counter
- Updated EpisodeCard.tsx to display more information
- Moved season dropdown from SeasonPicker.tsx into its own component SeasonDropdown.tsx
- Updated navigation in DownloadItem.tsx to direct to series page when a downloaded episode is clicked
This commit is contained in:
herrrta
2024-11-30 13:35:10 -05:00
parent 3d8875208f
commit 7eb7d17fa9
11 changed files with 369 additions and 160 deletions

21
utils/download.ts Normal file
View File

@@ -0,0 +1,21 @@
import {getPrimaryImageUrlById} from "@/utils/jellyfin/image/getPrimaryImageUrlById";
import {BaseItemDto} from "@jellyfin/sdk/lib/generated-client";
import useImageStorage from "@/hooks/useImageStorage";
import {apiAtom} from "@/providers/JellyfinProvider";
import {useAtom} from "jotai";
import {storage} from "@/utils/mmkv";
const useDownloadHelper = () => {
const [api] = useAtom(apiAtom);
const {saveImage} = useImageStorage();
const saveSeriesPrimaryImage = async (item: BaseItemDto) => {
if (item.Type === "Episode" && item.SeriesId && !storage.getString(item.SeriesId)) {
await saveImage(item.SeriesId, getPrimaryImageUrlById({ api, id: item.SeriesId }))
}
}
return { saveSeriesPrimaryImage }
}
export default useDownloadHelper;