simplificando app

This commit is contained in:
2026-06-18 17:13:24 +02:00
parent cdf2893b94
commit f977925880
16 changed files with 82 additions and 614 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ const geistMono = Geist_Mono({
export const metadata: Metadata = {
title: "Film Intel",
description: "Advanced movie insight you won't find in one click",
description: "Reliable film age ratings, explained",
};
export default function RootLayout({
-41
View File
@@ -1,41 +0,0 @@
import { notFound } from "next/navigation";
import { MovieHeader } from "@/components/MovieHeader";
import { MovieInsightPanel } from "@/components/MovieInsightPanel";
import { getMovieDetails } from "@/lib/tmdb";
export default async function MoviePage({
params,
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const movieId = Number(id);
if (!Number.isFinite(movieId) || movieId <= 0) {
notFound();
}
let movie;
try {
movie = await getMovieDetails(movieId);
} catch {
notFound();
}
return (
<main className="mx-auto min-h-screen w-full max-w-6xl px-6 py-10">
<div className="space-y-10">
<MovieHeader movie={movie} />
<MovieInsightPanel
movieId={movie.id}
genres={movie.genres.map((genre) => genre.name)}
/>
</div>
<footer className="mt-16 border-t border-stone-200 pt-6 text-center text-xs text-stone-500">
AI-generated content for informational purposes. Verify timestamps on
your copy.
</footer>
</main>
);
}
+5 -36
View File
@@ -1,6 +1,6 @@
"use client";
import { useEffect, useState } from "react";
import { useState } from "react";
import { SearchBar } from "@/components/SearchBar";
import { MovieHeader } from "@/components/MovieHeader";
import { MovieInsightPanel } from "@/components/MovieInsightPanel";
@@ -16,33 +16,6 @@ export default function HomePage() {
const [isLoadingMovie, setIsLoadingMovie] = useState(false);
const [movieError, setMovieError] = useState<string | null>(null);
// Preload a random interesting movie on initial page load to demonstrate the app
useEffect(() => {
const DEMO_IDS = [27205, 157336, 155, 550, 496243, 424]; // Inception, Interstellar, Dark Knight, Fight Club, Parasite, Schindler's List
const loadDemo = async () => {
const id = DEMO_IDS[Math.floor(Math.random() * DEMO_IDS.length)];
try {
const res = await fetch(`/api/movie/${id}`);
if (!res.ok) return;
const details: TmdbMovieDetails = await res.json();
const minimalSearch: TmdbSearchResult = {
id: details.id,
title: details.title,
release_date: details.release_date || "",
poster_path: details.poster_path,
overview: details.overview || "",
};
setSelectedMovie(minimalSearch);
setMovieDetails(details);
} catch {
// silently fall back to empty state if demo preload fails
}
};
if (!selectedMovie) {
void loadDemo();
}
}, []);
const handleSelect = async (movie: TmdbSearchResult) => {
setSelectedMovie(movie);
setMovieDetails(null);
@@ -77,7 +50,7 @@ export default function HomePage() {
Film Intel
</span>
<span className="hidden truncate text-xs text-stone-500 sm:inline">
Movie insight you won&apos;t find in one click
Reliable film ratings, explained
</span>
</div>
@@ -95,9 +68,8 @@ export default function HomePage() {
{!selectedMovie && (
<div className="flex flex-col items-center justify-center py-16 text-center">
<p className="max-w-md text-sm text-stone-600">
Search for any film using the bar above. We&apos;ll generate
ratings explained, skip guides, sensitivity warnings, production
facts, and more.
Search for any film using the bar above. We&apos;ll explain its
age rating and how it differs across countries.
</p>
</div>
)}
@@ -136,10 +108,7 @@ export default function HomePage() {
</div>
)}
<MovieInsightPanel
movieId={selectedMovie.id}
genres={movieDetails?.genres.map((g) => g.name) ?? []}
/>
<MovieInsightPanel movieId={selectedMovie.id} />
</div>
)}
</main>