mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Merge pull request #62 from AbdullahDaGoat/modal
Fixed Some shitty code i made initally
This commit is contained in:
commit
2e5598dc59
4 changed files with 12 additions and 25 deletions
|
@ -91,28 +91,14 @@ export function formatTMDBMeta(
|
|||
export function formatTMDBMetaToMediaItem(media: TMDBMediaResult): MediaItem {
|
||||
const type = TMDBMediaToMediaItemType(media.object_type);
|
||||
|
||||
// Define the basic structure of MediaItem
|
||||
const mediaItem: MediaItem = {
|
||||
return {
|
||||
title: media.title,
|
||||
id: media.id.toString(),
|
||||
year: media.original_release_date?.getFullYear() ?? 0,
|
||||
release_date: media.original_release_date,
|
||||
poster: media.poster,
|
||||
type,
|
||||
seasons: undefined,
|
||||
};
|
||||
|
||||
// If it's a TV show, include the seasons information
|
||||
if (type === "show") {
|
||||
const seasons = media.seasons?.map((season) => ({
|
||||
title: season.title,
|
||||
id: season.id.toString(),
|
||||
number: season.season_number,
|
||||
}));
|
||||
mediaItem.seasons = seasons as MWSeasonMeta[];
|
||||
}
|
||||
|
||||
return mediaItem;
|
||||
}
|
||||
|
||||
export function TMDBIdToUrlId(
|
||||
|
|
|
@ -28,6 +28,7 @@ export function EpisodeSelector({
|
|||
language: "en-US",
|
||||
},
|
||||
);
|
||||
// console.log("Fetched season details:", seasonDetails);
|
||||
setSelectedSeason(seasonDetails);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
@ -43,6 +44,7 @@ export function EpisodeSelector({
|
|||
api_key: conf().TMDB_READ_API_KEY,
|
||||
language: "en-US",
|
||||
});
|
||||
// console.log("Fetched show details:", showDetails);
|
||||
setSeasonsData(showDetails.seasons);
|
||||
if (showDetails.seasons[0] === 0) {
|
||||
// Default to first season
|
||||
|
@ -85,16 +87,15 @@ export function EpisodeSelector({
|
|||
episode_number: number;
|
||||
name: string;
|
||||
still_path: string;
|
||||
show_id: number;
|
||||
id: number;
|
||||
id: string;
|
||||
}) => (
|
||||
<Flare.Base
|
||||
key={episode.episode_number}
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/media/tmdb-tv-${tmdbId}-${mediaTitle}/${episode.show_id}/${episode.id}`,
|
||||
)
|
||||
}
|
||||
onClick={() => {
|
||||
const navigateUrl = `/media/tmdb-tv-${tmdbId}-${mediaTitle}/${selectedSeason.id}/${episode.id}`;
|
||||
// console.log("Navigating to:", navigateUrl);
|
||||
navigate(navigateUrl);
|
||||
}}
|
||||
className="group cursor-pointer rounded-xl relative p-[0.65em] bg-background-main transition-colors duration-[0.28s] flex-shrink-0 w-48 sm:w-auto mr-2 sm:mr-0"
|
||||
>
|
||||
<Flare.Light
|
||||
|
@ -109,7 +110,7 @@ export function EpisodeSelector({
|
|||
className="w-full h-auto rounded"
|
||||
/>
|
||||
<p className="text-center text-[0.95em] mt-2">
|
||||
{episode.name}
|
||||
E{episode.episode_number}: {episode.name}
|
||||
</p>
|
||||
</div>
|
||||
</Flare.Base>
|
||||
|
|
|
@ -61,6 +61,7 @@ export function PopupModal({
|
|||
isVisible,
|
||||
onClose,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
// idk just needed to add this line for commit
|
||||
playingTitle,
|
||||
media,
|
||||
}: PopupModalProps) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
export interface MediaItem {
|
||||
seasons: import("c:/Users/huzei/OneDrive/Desktop/Sudo-Flix/src/backend/metadata/types/mw").MWSeasonMeta[];
|
||||
id: string;
|
||||
title: string;
|
||||
year?: number;
|
||||
|
|
Loading…
Reference in a new issue