Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
John Corser committed Jan 2, 2025
1 parent c40297e commit 366cddf
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 16 deletions.
11 changes: 7 additions & 4 deletions src/components/pages/GenreReviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ export default function GenreReviewPage() {
setIsLoading(true);
try {
const movies = await listMovies();
setMovies(movies.filter((movie) => !hiddenIds.includes(movie.id)));
setMovies(
movies.filter((movie) => !hiddenIds.includes(movie.id ?? "")),
);
const shows = await listShows();
setShows(
shows
.map((show) => show.item)
.filter((show) => !hiddenIds.includes(show.id)),
.filter((show) => !hiddenIds.includes(show.id ?? "")),
);
} catch (error) {
showBoundary(error);
Expand Down Expand Up @@ -60,6 +62,7 @@ export default function GenreReviewPage() {
const allGenres = movies.flatMap((movie) => movie.genres).filter((g) => g);
const genreCounts = allGenres.reduce(
(counts, genre) => {
if (!genre) return counts;
counts[genre] = (counts[genre] || 0) + 1;
return counts;
},
Expand Down Expand Up @@ -104,8 +107,8 @@ export default function GenreReviewPage() {
key={generateGuid()}
item={movie}
onHide={() => {
setCachedHiddenId(movie.id);
setHiddenIds([...hiddenIds, movie.id]);
setCachedHiddenId(movie.id ?? "");
setHiddenIds([...hiddenIds, movie.id ?? ""]);
}}
/>
))}
Expand Down
8 changes: 5 additions & 3 deletions src/components/pages/MoviesReviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default function MoviesReviewPage() {
setIsLoading(true);
try {
const movies = await listMovies();
setMovies(movies.filter((movie) => !hiddenIds.includes(movie.id)));
setMovies(
movies.filter((movie) => !hiddenIds.includes(movie.id ?? "")),
);
} catch (error) {
showBoundary(error);
} finally {
Expand Down Expand Up @@ -65,8 +67,8 @@ export default function MoviesReviewPage() {
key={generateGuid()}
item={movie}
onHide={() => {
setCachedHiddenId(movie.id);
setHiddenIds([...hiddenIds, movie.id]);
setCachedHiddenId(movie.id ?? "");
setHiddenIds([...hiddenIds, movie.id ?? ""]);
}}
/>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/MoviesReviewPage/ActorCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function ActorCard({
useEffect(() => {
const fetchImageUrl = async () => {
try {
const url = await getImageUrlById(details.Id);
const url = await getImageUrlById(details.Id ?? "");
setImageUrl(url);
} catch (error) {
console.error("Failed to fetch image URL:", error);
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/MoviesReviewPage/MovieCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function MovieCard({
useEffect(() => {
const fetchImageUrl = async () => {
try {
const url = await getImageUrlById(item.id);
const url = await getImageUrlById(item.id ?? "");
setImageUrl(url);
} catch (error) {
console.error("Failed to fetch image URL:", error);
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/OldestMoviePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function OldestMoviePage() {
try {
const movies = await listMovies();
movies.sort((a, b) => {
const aDate = new Date(a.date);
const bDate = new Date(b.date);
const aDate = new Date(a.date ?? new Date());
const bDate = new Date(b.date ?? new Date());
return aDate.getTime() - bDate.getTime();
});
const m = movies.find((s) => s);
Expand Down
6 changes: 3 additions & 3 deletions src/components/pages/ShowReviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function ShowReviewPage() {
try {
const shows = await listShows();
const filteredShows = shows.filter(
(show) => !hiddenIds.includes(show.item.id),
(show) => !hiddenIds.includes(show.item.id ?? ""),
);
setShows(filteredShows);
} catch (e) {
Expand Down Expand Up @@ -97,8 +97,8 @@ export default function ShowReviewPage() {
episodeCount={show.episodeCount}
playbackTime={show.playbackTime}
onHide={() => {
setCachedHiddenId(show.item.id);
setHiddenIds([...hiddenIds, show.item.id]);
setCachedHiddenId(show.item.id ?? "");
setHiddenIds([...hiddenIds, show.item.id ?? ""]);
}}
/>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/jellyfin-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const authenticateByUserName = async (

try {
// Authentication state is persisted on the api object
const authenticated = await api.authenticateUserByName(username, password);
await api.authenticateUserByName(username, password);
} catch (error) {
console.error("Connection failed:", error);
alert(error);
Expand Down
4 changes: 3 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
const rootElement = document.getElementById("root");
if (!rootElement) throw new Error("Failed to find the root element");

createRoot(document.getElementById("root")).render(
createRoot(rootElement).render(
<StrictMode>
<App />
</StrictMode>,
Expand Down

0 comments on commit 366cddf

Please sign in to comment.