mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 05:05:38 -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>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { IconPlayerPlay } from "@tabler/icons-react";
|
|
import { StarRating } from "@/components/star-rating";
|
|
import { StatusButton } from "@/components/status-button";
|
|
import { useTitleInteraction } from "./title-interaction-provider";
|
|
|
|
export function TitleActions() {
|
|
const {
|
|
titleType,
|
|
userStatus,
|
|
userRating,
|
|
handleStatusChange,
|
|
handleRating,
|
|
handleWatchMovie,
|
|
} = useTitleInteraction();
|
|
|
|
return (
|
|
<div className="flex flex-wrap items-center gap-3">
|
|
<StatusButton
|
|
currentStatus={userStatus ?? null}
|
|
onChange={handleStatusChange}
|
|
/>
|
|
{titleType === "movie" && (
|
|
<button
|
|
type="button"
|
|
onClick={handleWatchMovie}
|
|
className="inline-flex h-9 items-center gap-2 rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-all active:scale-[0.97] hover:shadow-md hover:shadow-primary/20"
|
|
>
|
|
<IconPlayerPlay size={15} />
|
|
Mark Watched
|
|
</button>
|
|
)}
|
|
<div className="flex items-center gap-2">
|
|
<span className="text-xs text-muted-foreground">Rate:</span>
|
|
<StarRating value={userRating ?? 0} onChange={handleRating} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|