Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Some shitty code i made initally #62

Merged
merged 5 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions src/backend/metadata/tmdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
17 changes: 9 additions & 8 deletions src/components/media/ModalEpisodeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function EpisodeSelector({
language: "en-US",
},
);
// console.log("Fetched season details:", seasonDetails);
setSelectedSeason(seasonDetails);
} catch (err) {
console.error(err);
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion src/components/media/PopupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@
export function PopupModal({
isVisible,
onClose,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars

Check failure on line 63 in src/components/media/PopupModal.tsx

View workflow job for this annotation

GitHub Actions / Run Linters

Delete `·`
// idk just needed to add this line for commit
playingTitle,

Check warning on line 65 in src/components/media/PopupModal.tsx

View workflow job for this annotation

GitHub Actions / Build project

'playingTitle' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 65 in src/components/media/PopupModal.tsx

View workflow job for this annotation

GitHub Actions / Run Linters

'playingTitle' is defined but never used. Allowed unused args must match /^_/u
media,
}: PopupModalProps) {
const modalRef = useRef<HTMLDivElement>(null);
Expand Down
1 change: 0 additions & 1 deletion src/utils/mediaTypes.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading