From f438e80d3a83082833fa46184fd573ff27ac42b0 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Wed, 6 Dec 2023 23:36:32 +0100 Subject: [PATCH] Add login button instead of watchlist when user is not login --- front/packages/ui/src/home/watchlist.tsx | 95 +++++++++++++----------- front/translations/en.json | 3 +- front/translations/fr.json | 3 +- 3 files changed, 57 insertions(+), 44 deletions(-) diff --git a/front/packages/ui/src/home/watchlist.tsx b/front/packages/ui/src/home/watchlist.tsx index f2462674..11d845d1 100644 --- a/front/packages/ui/src/home/watchlist.tsx +++ b/front/packages/ui/src/home/watchlist.tsx @@ -24,6 +24,7 @@ import { WatchlistKind, WatchlistP, getDisplayDate, + useAccount, } from "@kyoo/models"; import { useYoshiki } from "yoshiki/native"; import { ItemGrid } from "../browse/grid"; @@ -31,56 +32,66 @@ import { InfiniteFetch } from "../fetch-infinite"; import { useTranslation } from "react-i18next"; import { Header } from "./genre"; import { EpisodeBox, episodeDisplayNumber } from "../details/episode"; +import { View } from "react-native"; +import { Button, P, ts } from "@kyoo/primitives"; export const WatchlistList = () => { const { t } = useTranslation(); const { css } = useYoshiki(); + const account = useAccount(); return ( <>
- - (x.kind === WatchlistKind.Show && x.watchStatus?.nextEpisode) || (x.isLoading && i % 2) - ? "episode" - : "item" - } - empty={t("home.none")} - > - {(x, i) => { - const episode = x.kind === WatchlistKind.Show ? x.watchStatus?.nextEpisode : null; - return (x.kind === WatchlistKind.Show && x.watchStatus?.nextEpisode) || - (x.isLoading && i % 2) ? ( - - ) : ( - - ); - }} - + {account ? ( + + (x.kind === WatchlistKind.Show && x.watchStatus?.nextEpisode) || (x.isLoading && i % 2) + ? "episode" + : "item" + } + empty={t("home.none")} + > + {(x, i) => { + const episode = x.kind === WatchlistKind.Show ? x.watchStatus?.nextEpisode : null; + return (x.kind === WatchlistKind.Show && x.watchStatus?.nextEpisode) || + (x.isLoading && i % 2) ? ( + + ) : ( + + ); + }} + + ) : ( + +

{t("home.watchlistLogin")}

+