caelum0x d56639a594
Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

64 lines
3.2 KiB
TypeScript

import type { Metadata } from "next";
import Link from "next/link";
import { headers } from "next/headers";
import { notFound } from "next/navigation";
import { Player } from "@/src/features/ott-player/Player";
import { getRelated, getTitlePage } from "@/src/features/ott-player/api";
import { ottStorefrontLive, ottSurfaceLive } from "@/src/features/ott-player/flags";
import { Offers } from "@/src/features/ott-checkout";
import { Chapters } from "@/src/features/ott-ai";
import { AskVideo } from "@/src/features/ott-discovery";
import { TitleActions } from "@/src/features/ott-auth";
type Params = Promise<{ handle: string; titleId: string }>;
export async function generateMetadata({ params }: Readonly<{ params: Params }>): Promise<Metadata> {
if (!ottStorefrontLive()) return {};
const { handle, titleId } = await params;
const title = await getTitlePage(handle, titleId);
return title ? { title: `${title.title} | ${title.channel.title}`, description: title.synopsis || title.title } : {};
}
export default async function TitleWatchPage({ params }: Readonly<{ params: Params }>) {
if (!ottStorefrontLive()) notFound();
const { handle, titleId } = await params;
const country = (await headers()).get("cf-ipcountry");
const title = await getTitlePage(handle, titleId, country);
if (!title) notFound();
// A related-titles failure never breaks the watch page.
const related = ottSurfaceLive("discovery") ? await getRelated(title.id, country).catch(() => null) : null;
return (
<main className="mx-auto max-w-4xl px-4 py-6">
<Link className="text-sm underline" href={`/c/${encodeURIComponent(handle)}`}>{title.channel.title}</Link>
<h1 className="my-3 text-2xl font-semibold">{title.title}</h1>
{title.available_here ? (
<Player titleId={title.id} poster={title.artwork_url} handle={ottSurfaceLive("viewers") ? handle : undefined} />
) : (
<p role="alert">This title is not available in your country.</p>
)}
{title.access_tier === "paid" && ottSurfaceLive("commerce") ? <Offers handle={handle} titleId={title.id} /> : null}
{ottSurfaceLive("viewers") ? <TitleActions handle={handle} titleId={title.id} /> : null}
{title.synopsis ? <p className="mt-4 text-sm text-muted-foreground">{title.synopsis}</p> : null}
{title.credits && title.credits.length > 0 ? (
<ul aria-label="Cast and crew" className="mt-3 space-y-1 text-sm">
{title.credits.map((c) => <li key={`${c.name}-${c.role}`}>{c.name}, {c.role}</li>)}
</ul>
) : null}
{ottSurfaceLive("ai") ? <Chapters titleId={title.id} /> : null}
{ottSurfaceLive("discovery") ? <AskVideo titleId={title.id} /> : null}
{related && related.results.length > 0 ? (
<section aria-label="More like this" className="mt-6">
<h2 className="mb-2 text-sm font-semibold">More like this</h2>
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-4">
{related.results.map((r) => (
<li key={r.id}>
<Link className="block text-sm underline" href={`/c/${encodeURIComponent(handle)}/${encodeURIComponent(r.id)}`}>{r.title}</Link>
</li>
))}
</ul>
</section>
) : null}
</main>
);
}