From cef7a64017fb0af13aa443b0220ef208a0283426 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 16 Feb 2026 12:29:11 +0100 Subject: [PATCH] Properly use nextup in the home --- api/src/controllers/entries.ts | 2 +- api/src/controllers/profiles/nextup.ts | 11 +++- front/src/ui/home/index.tsx | 15 ++--- front/src/ui/home/news.tsx | 26 ++++----- front/src/ui/home/nextup.tsx | 66 +++++++++++++++++++++ front/src/ui/home/watchlist.tsx | 80 -------------------------- 6 files changed, 96 insertions(+), 104 deletions(-) create mode 100644 front/src/ui/home/nextup.tsx delete mode 100644 front/src/ui/home/watchlist.tsx diff --git a/api/src/controllers/entries.ts b/api/src/controllers/entries.ts index 6b1d0ffc..5c1c0d80 100644 --- a/api/src/controllers/entries.ts +++ b/api/src/controllers/entries.ts @@ -135,7 +135,7 @@ const newsSort: Sort = { ], }; -const entryRelations = { +export const entryRelations = { translations: () => { const { pk, language, ...trans } = getColumns(entryTranslations); return db diff --git a/api/src/controllers/profiles/nextup.ts b/api/src/controllers/profiles/nextup.ts index c2ffffbe..d27b6122 100644 --- a/api/src/controllers/profiles/nextup.ts +++ b/api/src/controllers/profiles/nextup.ts @@ -6,6 +6,7 @@ import { entries } from "~/db/schema"; import { watchlist } from "~/db/schema/watchlist"; import { getColumns } from "~/db/utils"; import { Entry } from "~/models/entry"; +import { Show } from "~/models/show"; import { AcceptLanguage, createPage, @@ -21,6 +22,7 @@ import { desc } from "~/models/utils/descriptions"; import { entryFilters, entryProgressQ, + entryRelations, entryVideosQ, getEntryTransQ, mapProgress, @@ -71,7 +73,7 @@ export const nextup = new Elysia({ tags: ["profiles"] }) query: { sort, filter, query, limit, after }, headers: { "accept-language": languages, ...headers }, request: { url }, - jwt: { sub }, + jwt: { sub, settings }, }) => { const langs = processLanguages(languages); const transQ = getEntryTransQ(langs); @@ -102,6 +104,11 @@ export const nextup = new Elysia({ tags: ["profiles"] }) seasonNumber: sql`${seasonNumber}`, episodeNumber: sql`${episodeNumber}`, name: sql`${transQ.name}`, + + show: sql`${entryRelations.show({ + languages: langs, + preferOriginal: settings.preferOriginal, + })}`, }) .from(entries) .innerJoin(watchlist, eq(watchlist.nextEntry, entries.pk)) @@ -134,7 +141,7 @@ export const nextup = new Elysia({ tags: ["profiles"] }) "accept-language": AcceptLanguage({ autoFallback: true }), }), response: { - 200: Page(Entry), + 200: Page(t.Intersect([Entry, t.Object({ show: Show })])), }, }, ); diff --git a/front/src/ui/home/index.tsx b/front/src/ui/home/index.tsx index 72a6cc78..ebeade48 100644 --- a/front/src/ui/home/index.tsx +++ b/front/src/ui/home/index.tsx @@ -8,9 +8,9 @@ import { HeaderBackground, useScrollNavbar } from "../navbar"; import { GenreGrid } from "./genre"; import { Header } from "./header"; import { NewsList } from "./news"; +import { NextupList } from "./nextup"; import { Recommended } from "./recommended"; import { VerticalRecommended } from "./vertical"; -import { WatchlistList } from "./watchlist"; export const HomePage = () => { const genres = shuffle(Object.values(Genre.enum)); @@ -50,7 +50,7 @@ export const HomePage = () => { )} Loader={Header.Loader} /> - + {genres .filter((_, i) => i < 2) @@ -64,10 +64,11 @@ export const HomePage = () => { ))} - {/* - TODO: Lazy load those items - {randomItems.filter((_, i) => i >= 6).map((x) => )} - */} + {genres + .filter((_, i) => i >= 6) + .map((x) => ( + + ))} ); @@ -75,7 +76,7 @@ export const HomePage = () => { HomePage.queries = (randomItems: Genre[]) => [ Header.query(), - WatchlistList.query(), + NextupList.query(), NewsList.query(), ...randomItems.filter((_, i) => i < 6).map((x) => GenreGrid.query(x)), Recommended.query(), diff --git a/front/src/ui/home/news.tsx b/front/src/ui/home/news.tsx index f8241bc0..b504f5b2 100644 --- a/front/src/ui/home/news.tsx +++ b/front/src/ui/home/news.tsx @@ -15,20 +15,18 @@ export const NewsList = () => { query={NewsList.query()} layout={{ ...EntryBox.layout, layout: "horizontal" }} Empty={} - Render={({ item }) => { - return ( - - ); - }} + Render={({ item }) => ( + + )} Loader={EntryBox.Loader} /> diff --git a/front/src/ui/home/nextup.tsx b/front/src/ui/home/nextup.tsx new file mode 100644 index 00000000..fede9cc2 --- /dev/null +++ b/front/src/ui/home/nextup.tsx @@ -0,0 +1,66 @@ +import { useTranslation } from "react-i18next"; +import { View } from "react-native"; +import { EntryBox, entryDisplayNumber } from "~/components/entries"; +import { ItemGrid } from "~/components/items"; +import { Entry } from "~/models"; +import { Button, Link, P } from "~/primitives"; +import { useAccount } from "~/providers/account-context"; +import { InfiniteFetch, type QueryIdentifier } from "~/query"; +import { EmptyView } from "~/ui/empty-view"; +import { Header } from "./genre"; + +export const NextupList = () => { + const { t } = useTranslation(); + const account = useAccount(); + + if (!account) { + return ( + <> +
+ +

{t("home.watchlistLogin")}

+