diff --git a/front/src/components/episode.tsx b/front/src/components/episode.tsx index 7bb10b95..4291041a 100644 --- a/front/src/components/episode.tsx +++ b/front/src/components/episode.tsx @@ -42,7 +42,7 @@ export const EpisodeBox = ({ episode, sx }: { episode?: Episode; sx: SxProps }) }; export const EpisodeLine = ({ episode, sx }: { episode?: Episode; sx?: SxProps }) => { - const { t } = useTranslation("browse"); + const { t } = useTranslation("browse"); return ( <> @@ -61,7 +61,13 @@ export const EpisodeLine = ({ episode, sx }: { episode?: Episode; sx?: SxProps } {episode ? displayNumber(episode) : } - + {episode ? ( {episode.name ?? t("show.episodeNoMetadata")} diff --git a/front/src/components/errors.tsx b/front/src/components/errors.tsx index 19fa800b..b57b73d5 100644 --- a/front/src/components/errors.tsx +++ b/front/src/components/errors.tsx @@ -22,7 +22,7 @@ import { Alert, Box, Snackbar, SnackbarCloseReason, Typography, SxProps } from " import { SyntheticEvent, useState } from "react"; import { KyooErrors } from "~/models"; -export const ErrorComponent = ({ errors, sx }: { errors: string[], sx?: SxProps }) => { +export const ErrorComponent = ({ errors, sx }: { errors: string[]; sx?: SxProps }) => { return ( - Error + + Error + {errors.map((x, i) => ( {x} diff --git a/front/src/components/horizontal-list.tsx b/front/src/components/horizontal-list.tsx index 175445bb..d782e079 100644 --- a/front/src/components/horizontal-list.tsx +++ b/front/src/components/horizontal-list.tsx @@ -24,7 +24,15 @@ import { ReactNode, useRef } from "react"; import { Container } from "./container"; import useTranslation from "next-translate/useTranslation"; -export const HorizontalList = ({ title, noContent, children }: { title: string, noContent: string, children: ReactNode[] }) => { +export const HorizontalList = ({ + title, + noContent, + children, +}: { + title: string; + noContent: string; + children: ReactNode[]; +}) => { const { t } = useTranslation("browse"); const ref = useRef(null); const getScrollSize = () => { @@ -41,18 +49,24 @@ export const HorizontalList = ({ title, noContent, children }: { title: string, <> + > {title} - ref.current?.scrollBy({ left: -getScrollSize(), behavior: "smooth" })}> + ref.current?.scrollBy({ left: -getScrollSize(), behavior: "smooth" })} + > - ref.current?.scrollBy({ left: getScrollSize(), behavior: "smooth" })}> + ref.current?.scrollBy({ left: getScrollSize(), behavior: "smooth" })} + > @@ -62,22 +76,22 @@ export const HorizontalList = ({ title, noContent, children }: { title: string, {noContent} - ) : ( - - {children} - + ) : ( + + {children} + )} ); -} +}; diff --git a/front/src/components/navbar.tsx b/front/src/components/navbar.tsx index 6da54820..b10700ed 100644 --- a/front/src/components/navbar.tsx +++ b/front/src/components/navbar.tsx @@ -63,7 +63,7 @@ const KyooTitle = (props: { sx: SxProps }) => { mr: 2, fontFamily: "monospace", fontWeight: 700, - color: "white" + color: "white", }} > Kyoo @@ -112,7 +112,7 @@ export const Navbar = (barProps: AppBarProps) => { - + @@ -125,4 +125,3 @@ Navbar.query = (): QueryIdentifier> => ({ parser: Paged(LibraryP), path: ["libraries"], }); - diff --git a/front/src/components/person.tsx b/front/src/components/person.tsx index 6b26ee9c..ccbf590f 100644 --- a/front/src/components/person.tsx +++ b/front/src/components/person.tsx @@ -26,11 +26,15 @@ export const PersonAvatar = ({ person, sx }: { person?: Person; sx?: SxProps }) if (!person) { return ( - - - + + + + + + + - ) + ); } return ( diff --git a/front/src/models/resources/collection.ts b/front/src/models/resources/collection.ts index d1ccacdc..eb481db7 100644 --- a/front/src/models/resources/collection.ts +++ b/front/src/models/resources/collection.ts @@ -21,7 +21,6 @@ import { z } from "zod"; import { ImagesP, ResourceP } from "../traits"; - export const CollectionP = ResourceP.merge(ImagesP).extend({ /** * The title of this collection. diff --git a/front/src/models/resources/library-item.ts b/front/src/models/resources/library-item.ts index 745ba11c..9469e97d 100644 --- a/front/src/models/resources/library-item.ts +++ b/front/src/models/resources/library-item.ts @@ -38,8 +38,17 @@ export const LibraryItemP = z.preprocess( return x; }, z.union([ + /* + * Either a Show + */ ShowP.and(z.object({ type: z.literal(ItemType.Show) })), + /* + * Or a Movie + */ MovieP.and(z.object({ type: z.literal(ItemType.Movie) })), + /* + * Or a Collection + */ CollectionP.and(z.object({ type: z.literal(ItemType.Collection) })), ]), ); diff --git a/front/src/models/utils.ts b/front/src/models/utils.ts index b791e5f1..8336c64f 100644 --- a/front/src/models/utils.ts +++ b/front/src/models/utils.ts @@ -32,8 +32,7 @@ export const getDisplayDate = (data: Show | Movie) => { return startAir.getFullYear().toString(); } return startAir.getFullYear() + (endAir ? ` - ${endAir.getFullYear()}` : ""); - } - else if (airDate) { + } else if (airDate) { return airDate.getFullYear().toString(); } }; diff --git a/front/src/pages/_app.tsx b/front/src/pages/_app.tsx index 478c7603..d0cdc495 100755 --- a/front/src/pages/_app.tsx +++ b/front/src/pages/_app.tsx @@ -67,9 +67,7 @@ const App = ({ Component, pageProps }: AppProps) => { - - {getLayout()} - + {getLayout()} diff --git a/front/src/pages/browse/index.tsx b/front/src/pages/browse/index.tsx index b636595e..1fc787a2 100644 --- a/front/src/pages/browse/index.tsx +++ b/front/src/pages/browse/index.tsx @@ -247,7 +247,9 @@ const BrowseSettings = ({ const router = useRouter(); const { t } = useTranslation("browse"); - const switchViewTitle = layout === Layout.Grid ? t("browse.switchToList") : t("browse.switchToGrid"); + const switchViewTitle = layout === Layout.Grid + ? t("browse.switchToList") + : t("browse.switchToGrid"); return ( <> diff --git a/front/src/pages/index.tsx b/front/src/pages/index.tsx index 476b0e1a..6eaecdd1 100755 --- a/front/src/pages/index.tsx +++ b/front/src/pages/index.tsx @@ -18,6 +18,6 @@ * along with Kyoo. If not, see . */ -import BrowsePage from "./browse" +import BrowsePage from "./browse"; export default BrowsePage; diff --git a/front/src/pages/movie/[slug].tsx b/front/src/pages/movie/[slug].tsx index 7772be6a..26687366 100644 --- a/front/src/pages/movie/[slug].tsx +++ b/front/src/pages/movie/[slug].tsx @@ -135,7 +135,11 @@ export const ShowHeader = ({ data }: { data?: Show | Movie }) => { {data?.name ?? } {(!data || getDisplayDate(data)) && ( - + {data != undefined ? ( getDisplayDate(data) ) : ( @@ -247,7 +251,6 @@ export const ShowHeader = ({ data }: { data?: Show | Movie }) => { ); }; - export const ShowStaff = ({ slug }: { slug: string }) => { const { items, isError, error } = useInfiniteFetch(ShowStaff.query(slug)); const { t } = useTranslation("browse"); @@ -300,11 +303,6 @@ const MovieDetails: QueryPage<{ slug: string }> = ({ slug }) => { ); }; - -MovieDetails.getFetchUrls = ({ slug }) => [ - query(slug), - ShowStaff.query(slug), - Navbar.query(), -]; +MovieDetails.getFetchUrls = ({ slug }) => [query(slug), ShowStaff.query(slug), Navbar.query()]; export default withRoute(MovieDetails); diff --git a/front/src/utils/link.tsx b/front/src/utils/link.tsx index 77123f81..d3bd1a1c 100644 --- a/front/src/utils/link.tsx +++ b/front/src/utils/link.tsx @@ -19,14 +19,22 @@ */ import { forwardRef, Ref } from "react"; -import NLink, { LinkProps as NLinkProps} from "next/link"; -import { Button as MButton, ButtonProps, Link as MLink, LinkProps as MLinkProps} from "@mui/material"; +import NLink, { LinkProps as NLinkProps } from "next/link"; +import { + Button as MButton, + ButtonProps, + Link as MLink, + LinkProps as MLinkProps, +} from "@mui/material"; type ButtonRef = HTMLButtonElement; type ButtonLinkProps = Omit & Pick; -const NextButton = ({ href, as, prefetch, locale, ...props }: ButtonLinkProps, ref: Ref) => ( +const NextButton = ( + { href, as, prefetch, locale, ...props }: ButtonLinkProps, + ref: Ref, +) => ( @@ -37,10 +45,21 @@ export const ButtonLink = forwardRef(NextButton); type LinkRef = HTMLAnchorElement; type LinkProps = Omit & Pick & - ({ to: NLinkProps["href"], href?: undefined } | { href: NLinkProps["href"], to?: undefined }); + ({ to: NLinkProps["href"]; href?: undefined } | { href: NLinkProps["href"]; to?: undefined }); -const NextLink = ({ href, to, as, prefetch, locale, shallow, replace, ...props }: LinkProps, ref: Ref) => ( - +const NextLink = ( + { href, to, as, prefetch, locale, shallow, replace, ...props }: LinkProps, + ref: Ref, +) => ( + ); diff --git a/front/src/utils/query.ts b/front/src/utils/query.ts index f68f84fe..e627e353 100644 --- a/front/src/utils/query.ts +++ b/front/src/utils/query.ts @@ -61,7 +61,7 @@ const queryFn = async ( } catch (e) { data = { errors: [error] } as KyooErrors; } - console.log("Invalid response:", data) + console.log("Invalid response:", data); throw data as KyooErrors; } @@ -132,7 +132,7 @@ export const useInfiniteFetch = (query: QueryIdentifier) => { queryFn: (ctx) => queryFn(Paged(query.parser), ctx), getNextPageParam: (page: Page) => page?.next || undefined, }); - return {...ret, items: ret.data?.pages.flatMap((x) => x.items)} + return { ...ret, items: ret.data?.pages.flatMap((x) => x.items) }; }; export const fetchQuery = async (queries: QueryIdentifier[]) => {