mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 06:15:39 -04:00
Replace fully client-side dashboard and title detail pages with server component orchestrators that fetch data directly via service functions, eliminating extra network round-trips through API routes. Each section streams independently through its own Suspense boundary. - Extract getUserStats(), getTitleWithChildren(), getRecommendationsForTitle() into service layer; update getNewAvailableFeed() to include tmdbId/voteAverage - Split dashboard into server sections (stats, continue watching, library, recommendations) with client children for animations - Split title page into server hero + client interaction provider with shared context for optimistic mutations across actions and seasons - Add generateMetadata with OG tags, server-side TMDB ID resolution via redirect(), loading.tsx and not-found.tsx for both pages - Add per-section skeleton components, fix ContinueWatchingSkeleton dimensions - Remove 6 unused API routes (feed/*, titles/[id] GET, titles/[id]/recommendations) - Remove components/stats-summary.tsx, add lib/types/title.ts for shared types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
872 B
TypeScript
30 lines
872 B
TypeScript
import { IconSparkles } from "@tabler/icons-react";
|
|
import { getNewAvailableFeed } from "@/lib/services/discovery";
|
|
import { tmdbImageUrl } from "@/lib/tmdb/image";
|
|
import { FeedSection } from "./feed-section";
|
|
import { TitleGrid } from "./title-grid";
|
|
|
|
export async function LibrarySection({ userId }: { userId: string }) {
|
|
const feed = await getNewAvailableFeed(userId);
|
|
if (feed.length === 0) return null;
|
|
|
|
const items = feed.slice(0, 10).map((t) => ({
|
|
id: t.titleId,
|
|
tmdbId: t.tmdbId,
|
|
type: t.type,
|
|
title: t.title,
|
|
posterPath: tmdbImageUrl(t.posterPath, "w500"),
|
|
releaseDate: t.releaseDate ?? t.firstAirDate,
|
|
voteAverage: t.voteAverage,
|
|
}));
|
|
|
|
return (
|
|
<FeedSection
|
|
title="In Your Library"
|
|
icon={<IconSparkles size={20} className="text-primary" />}
|
|
>
|
|
<TitleGrid items={items} />
|
|
</FeedSection>
|
|
);
|
|
}
|