diff --git a/front/packages/ui/src/home/index.tsx b/front/packages/ui/src/home/index.tsx index cd578825..b59f5a7c 100644 --- a/front/packages/ui/src/home/index.tsx +++ b/front/packages/ui/src/home/index.tsx @@ -24,6 +24,7 @@ import { Header } from "./header"; import { DefaultLayout } from "../layout"; import { ScrollView, View } from "react-native"; import { GenreGrid } from "./genre"; +import { Recommanded } from "./recommanded"; export const HomePage: QueryPage<{}, Genre> = ({ randomItems }) => { return ( @@ -41,9 +42,14 @@ export const HomePage: QueryPage<{}, Genre> = ({ randomItems }) => { /> )} - {randomItems.map((x) => ( - - ))} + {/* */} + {randomItems.filter((_, i) => i < 2).map((x) => + , + )} + + {randomItems.filter((_, i) => i >= 2).map((x) => + , + )} ); }; @@ -55,4 +61,5 @@ HomePage.getLayout = { Layout: DefaultLayout, props: { transparent: true } }; HomePage.getFetchUrls = () => [ Header.query(), ...Object.values(Genre).map((x) => GenreGrid.query(x)), + Recommanded.query(), ]; diff --git a/front/packages/ui/src/home/recommanded.tsx b/front/packages/ui/src/home/recommanded.tsx new file mode 100644 index 00000000..834d7bfe --- /dev/null +++ b/front/packages/ui/src/home/recommanded.tsx @@ -0,0 +1,107 @@ +/* + * Kyoo - A portable and vast media library solution. + * Copyright (c) Kyoo. + * + * See AUTHORS.md and LICENSE file in the project root for full license information. + * + * Kyoo is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * Kyoo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kyoo. If not, see . + */ + +import { + ItemKind, + KyooImage, + LibraryItem, + LibraryItemP, + Page, + Paged, + QueryIdentifier, + getDisplayDate, +} from "@kyoo/models"; +import { Container, H3, ImageBackground, P, Poster, SubP, ts } from "@kyoo/primitives"; +import { useTranslation } from "react-i18next"; +import { View } from "react-native"; +import { percent, useYoshiki } from "yoshiki/native"; +import { Fetch, WithLoading } from "../fetch"; + +export const ItemDetails = ({ + isLoading, + name, + tagline, + subtitle, + overview, + poster, + ...props +}: WithLoading<{ + name: string; + tagline: string | null; + subtitle: string; + poster: KyooImage | null; + overview: string | null; +}>) => { + const { css } = useYoshiki(); + + return ( + theme.variant.background }, props)}> + +

{name}

+ {subtitle && {subtitle}} +
+ + {tagline &&

{tagline}

} + {overview && {overview}} +
+
+ ); +}; + +export const Recommanded = () => { + const { t } = useTranslation(); + const { css } = useYoshiki(); + + return ( + +

{t("home.recommanded")}

+ + {(x, i) => ( + + )} + +
+ ); +}; + +Recommanded.query = (): QueryIdentifier> => ({ + parser: Paged(LibraryItemP) as any, + path: ["items"], + params: { + sortBy: "random", + limit: 6, + }, +}); diff --git a/front/translations/en.json b/front/translations/en.json index 170e3511..e0b62987 100644 --- a/front/translations/en.json +++ b/front/translations/en.json @@ -1,4 +1,8 @@ { + "home": { + "recommanded": "Recommanded", + "info": "See more" + }, "show": { "play": "Play", "trailer": "Play Trailer", diff --git a/front/translations/fr.json b/front/translations/fr.json index c480a589..231330e4 100644 --- a/front/translations/fr.json +++ b/front/translations/fr.json @@ -1,4 +1,8 @@ { + "home": { + "recommanded": "Recommandé", + "info": "Voir plus" + }, "show": { "play": "Lecture", "trailer": "Jouer le trailer",