"use client"; import { useMemo, useState } from "react"; import { useTranslations } from "next-intl"; import { RESOLUTION_ORDER, renderSecondsCost, type SecondsPlan, } from "@/lib/plans-catalog"; interface Props { plans: SecondsPlan[]; } /** * Interactive "how many seconds do I need" helper. The user picks a video length * and resolution; we show the per-render cost (length × resolution multiplier) * and how many such videos each paid plan's monthly seconds would cover. */ export function SecondsCalculator({ plans }: Props) { const t = useTranslations("pricing"); const [length, setLength] = useState(15); const [resolution, setResolution] = useState("720p"); const cost = useMemo( () => renderSecondsCost(length, resolution), [length, resolution] ); const paidPlans = plans.filter((p) => p.priceTomans > 0); return (
{t("calcDesc")}
{t("calcCost")}
{cost}{" "} {t("calcSecondsUnit")}
{t("calcRendersWith")}