mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
- Delete filterable-row, backup-schedule, integrations, and system-health atom files; replace with useState/useTransition + server action calls - Replace /api/explore/discover route with discoverByGenre server action; refactor FilterableTitleRow to call it directly via useTransition - Wrap PagesLayout and AuthLayout children in Suspense to fix dynamic rendering errors during PPR static generation; remove StoreProvider - Sequence ExplorePage session fetch before TMDB calls to prevent build-time requests during static generation - Drop unnecessary "use client" directives from dashboard and person components that have no client-side hooks or browser API usage - Improve Dockerfile: add bun install layer cache mount, copy .next/cache from builder, reorder ENV declarations
30 lines
793 B
TypeScript
30 lines
793 B
TypeScript
"use server";
|
|
|
|
import { requireSession } from "@/lib/auth/session";
|
|
import { discover } from "@/lib/tmdb/client";
|
|
import { tmdbImageUrl } from "@/lib/tmdb/image";
|
|
|
|
export async function discoverByGenre(
|
|
mediaType: "movie" | "tv",
|
|
genreId: number,
|
|
) {
|
|
await requireSession();
|
|
const results = await discover(mediaType, {
|
|
sort_by: "popularity.desc",
|
|
"vote_count.gte": "50",
|
|
with_genres: String(genreId),
|
|
});
|
|
return results.results
|
|
.filter((r) => r.poster_path)
|
|
.map((r) => ({
|
|
tmdbId: r.id,
|
|
type: mediaType,
|
|
title: (r.title ?? r.name) as string,
|
|
posterPath: tmdbImageUrl(r.poster_path, "w500"),
|
|
releaseDate: (r.release_date ?? r.first_air_date ?? null) as
|
|
| string
|
|
| null,
|
|
voteAverage: r.vote_average,
|
|
}));
|
|
}
|