import {
productionFactsSchema,
type ProductionFacts,
} from "@/lib/schemas";
export function ProductionFactsView({ data }: { data: unknown }) {
const result = productionFactsSchema.safeParse(data);
if (!result.success) {
return (
Could not display this insight (data format issue). Try another card or refresh later.
);
}
const parsed = result.data as ProductionFacts;
return (
{(parsed.budget || parsed.boxOffice) && (
{parsed.budget ? : null}
{parsed.boxOffice ? (
) : null}
)}
{parsed.filmingLocations?.length ? (
Filming locations
{parsed.filmingLocations.map((location) => (
{location}
))}
) : null}
{parsed.facts.map((item, index) => (
{item.category}
{item.fact}
))}
);
}
function Stat({ label, value }: { label: string; value: string }) {
return (
);
}