1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

Merge pull request #62 from AbdullahDaGoat/modal

Fixed Some shitty code i made initally
This commit is contained in:
Captain Jack Sparrow 2024-06-22 21:01:54 -04:00 committed by GitHub
commit 2e5598dc59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 25 deletions

View file

@ -91,28 +91,14 @@ export function formatTMDBMeta(
export function formatTMDBMetaToMediaItem(media: TMDBMediaResult): MediaItem { export function formatTMDBMetaToMediaItem(media: TMDBMediaResult): MediaItem {
const type = TMDBMediaToMediaItemType(media.object_type); const type = TMDBMediaToMediaItemType(media.object_type);
// Define the basic structure of MediaItem return {
const mediaItem: MediaItem = {
title: media.title, title: media.title,
id: media.id.toString(), id: media.id.toString(),
year: media.original_release_date?.getFullYear() ?? 0, year: media.original_release_date?.getFullYear() ?? 0,
release_date: media.original_release_date, release_date: media.original_release_date,
poster: media.poster, poster: media.poster,
type, 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( export function TMDBIdToUrlId(

View file

@ -28,6 +28,7 @@ export function EpisodeSelector({
language: "en-US", language: "en-US",
}, },
); );
// console.log("Fetched season details:", seasonDetails);
setSelectedSeason(seasonDetails); setSelectedSeason(seasonDetails);
} catch (err) { } catch (err) {
console.error(err); console.error(err);
@ -43,6 +44,7 @@ export function EpisodeSelector({
api_key: conf().TMDB_READ_API_KEY, api_key: conf().TMDB_READ_API_KEY,
language: "en-US", language: "en-US",
}); });
// console.log("Fetched show details:", showDetails);
setSeasonsData(showDetails.seasons); setSeasonsData(showDetails.seasons);
if (showDetails.seasons[0] === 0) { if (showDetails.seasons[0] === 0) {
// Default to first season // Default to first season
@ -85,16 +87,15 @@ export function EpisodeSelector({
episode_number: number; episode_number: number;
name: string; name: string;
still_path: string; still_path: string;
show_id: number; id: string;
id: number;
}) => ( }) => (
<Flare.Base <Flare.Base
key={episode.episode_number} key={episode.episode_number}
onClick={() => onClick={() => {
navigate( const navigateUrl = `/media/tmdb-tv-${tmdbId}-${mediaTitle}/${selectedSeason.id}/${episode.id}`;
`/media/tmdb-tv-${tmdbId}-${mediaTitle}/${episode.show_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" 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 <Flare.Light
@ -109,7 +110,7 @@ export function EpisodeSelector({
className="w-full h-auto rounded" className="w-full h-auto rounded"
/> />
<p className="text-center text-[0.95em] mt-2"> <p className="text-center text-[0.95em] mt-2">
{episode.name} E{episode.episode_number}: {episode.name}
</p> </p>
</div> </div>
</Flare.Base> </Flare.Base>

View file

@ -61,6 +61,7 @@ export function PopupModal({
isVisible, isVisible,
onClose, onClose,
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
// idk just needed to add this line for commit
playingTitle, playingTitle,
media, media,
}: PopupModalProps) { }: PopupModalProps) {

View file

@ -1,5 +1,4 @@
export interface MediaItem { export interface MediaItem {
seasons: import("c:/Users/huzei/OneDrive/Desktop/Sudo-Flix/src/backend/metadata/types/mw").MWSeasonMeta[];
id: string; id: string;
title: string; title: string;
year?: number; year?: number;