CenaForge: primeira versão pública

Gerador de vídeos narrativos (Godot + FFmpeg), painel Next.js, serviço de voz,
Clipador de lives e Publicador para YouTube, TikTok e Instagram.

Inclui a leitura das visualizações dos posts para o Dashboard e o botão
"Publicar no <rede>" nos cartões das publicações.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 16:35:09 -03:00
co-authored by Claude Opus 5.5
commit 84f30bbc2d
484 changed files with 74826 additions and 0 deletions
+141
View File
@@ -0,0 +1,141 @@
"use client";
// Barra lateral: recolhida em 72 px (só ícones) e expandida POR CIMA do conteúdo ao passar o mouse
// ou ao navegar pelo teclado (regras .rail em globals.css). Os rótulos ficam sempre no DOM, então
// leitores de tela os leem mesmo com a barra recolhida.
// Geometria recolhida: cada item tem 48 px (72 − 2×12) e o ícone de 20 px fica em x 26–46, ou seja,
// centrado na barra. Por isso os itens nunca podem crescer com o rótulo: a lista é flex em coluna
// (uma trilha de grid "auto" cresceria até a largura do texto e empurraria o fundo do item ativo
// para fora da barra) e o rótulo pode transbordar, invisível, dentro do item.
// Em tela baixa (1024×768) a barra rola na vertical, para Configurações (no rodapé) não ficar cortada.
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useEffect, useState, type ComponentType } from "react";
import { ChartIcon, CubeIcon, FilmIcon, MicIcon, PublishIcon, ScissorsIcon, SettingsIcon, SparkIcon, TerminalIcon, UsersIcon } from "./icons";
import { LogoMark, Wordmark } from "./logo";
import { getSummary } from "./publishing-client";
import { cx } from "./ui";
type NavItem = { href: string; label: string; hint: string; icon: ComponentType<{ size?: number }> };
/** Contador de "aguardando aprovação" no menu: relê a cada 30 s (só com a aba visível) e ao trocar de página. */
const SUMMARY_POLL_MS = 30_000;
const NAV: NavItem[] = [
{ href: "/dashboard", label: "Dashboard", hint: "O que funciona e o que não", icon: ChartIcon },
{ href: "/", label: "Histórias", hint: "Episódios e votação", icon: FilmIcon },
{ href: "/clipper", label: "Clipador", hint: "Cortes de live", icon: ScissorsIcon },
{ href: "/assets", label: "Assets", hint: "Biblioteca e envios", icon: CubeIcon },
{ href: "/voices", label: "Vozes", hint: "Narração e legenda", icon: MicIcon },
{ href: "/agent", label: "Agente", hint: "Claude e Codex", icon: TerminalIcon },
];
/** Depois do estúdio: onde as histórias vão ao ar. */
const DISTRIBUTION: NavItem[] = [
{ href: "/accounts", label: "Canais de publicação", hint: "YouTube, TikTok e Instagram", icon: UsersIcon },
{ href: "/publishing", label: "Publicações", hint: "Aprovar, agendar, acompanhar", icon: PublishIcon },
];
const SETTINGS: NavItem = { href: "/settings", label: "Configurações", hint: "Horários, apps e navegador", icon: SettingsIcon };
function useAwaitingCount(pathname: string): number | null {
const [count, setCount] = useState<number | null>(null);
useEffect(() => {
let cancelled = false;
const load = async () => {
if (document.visibilityState === "hidden") return;
const r = await getSummary();
if (!cancelled) setCount(r.ok ? r.data.awaitingApproval : null);
};
void load();
const timer = setInterval(load, SUMMARY_POLL_MS);
document.addEventListener("visibilitychange", load);
return () => { cancelled = true; clearInterval(timer); document.removeEventListener("visibilitychange", load); };
}, [pathname]);
return count;
}
function isActive(pathname: string, href: string): boolean {
return href === "/" ? pathname === "/" || pathname.startsWith("/stories") : pathname.startsWith(href);
}
export function Sidebar() {
const pathname = usePathname();
const awaiting = useAwaitingCount(pathname);
return (
<aside aria-label="Navegação"
className="rail fixed inset-y-0 left-0 z-50 flex flex-col overflow-x-hidden overflow-y-auto border-r border-line [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
<Link href="/" className="mx-3 mt-4 mb-6 flex h-12 shrink-0 items-center gap-3 rounded-control px-[0.5rem]">
<LogoMark size={32} className="shrink-0" />
<Wordmark className="rail-label whitespace-nowrap" />
<span className="sr-only">— início</span>
</Link>
{/* Ação principal do produto, sempre à mão */}
<Link href="/#nova-historia"
className="group mx-3 mb-5 flex h-11 min-w-0 shrink-0 items-center gap-3 overflow-hidden rounded-control border border-accent/30 bg-accent-soft px-[0.8125rem] text-accent transition-colors hover:border-accent/60 hover:bg-accent/15">
<SparkIcon size={20} />
<span className="rail-label whitespace-nowrap text-sm font-semibold">Nova história com IA</span>
</Link>
<div className="rail-label mx-6 mb-2 text-eyebrow font-semibold uppercase whitespace-nowrap text-fg-subtle" aria-hidden="true">Estúdio</div>
<nav aria-label="Principal" className="flex flex-col gap-1 px-3">
{NAV.map((item) => <NavLink key={item.href} item={item} active={isActive(pathname, item.href)} />)}
</nav>
{/* Separador: com a barra recolhida, só a linha marca a troca de grupo. */}
<div aria-hidden="true" className="mx-6 mt-5 mb-4 h-px shrink-0 bg-line" />
<div className="rail-label mx-6 mb-2 text-eyebrow font-semibold uppercase whitespace-nowrap text-fg-subtle" aria-hidden="true">Distribuição</div>
<nav aria-label="Distribuição" className="flex flex-col gap-1 px-3">
{DISTRIBUTION.map((item) => (
<NavLink key={item.href} item={item} active={isActive(pathname, item.href)}
count={item.href === "/publishing" ? awaiting : null} countLabel="aguardando aprovação" />
))}
</nav>
<nav aria-label="Ajustes" className="mt-auto flex flex-col gap-1 px-3 pt-4">
<NavLink item={SETTINGS} active={isActive(pathname, SETTINGS.href)} />
</nav>
<div className="mt-3 mb-20 flex items-center gap-3 px-[1.9375rem] text-xs text-fg-subtle">
<span className="relative flex size-2.5 shrink-0" aria-hidden="true">
<span className="absolute inset-0 rounded-full bg-success/40" />
<span className="relative m-[2px] size-1.5 rounded-full bg-success" />
</span>
<span className="rail-label whitespace-nowrap">Painel local · porta 4500</span>
</div>
</aside>
);
}
function NavLink({ item: { href, label, hint, icon: Icon }, active, count = null, countLabel }: {
item: NavItem; active: boolean;
/** Número ao lado do ícone (some quando é 0 ou desconhecido). */
count?: number | null; countLabel?: string;
}) {
const showCount = count !== null && count > 0;
return (
<Link href={href} aria-current={active ? "page" : undefined}
className={cx(
"relative flex h-12 min-w-0 shrink-0 items-center gap-3 overflow-hidden rounded-control px-3.5 transition-colors",
active ? "bg-raised text-fg" : "text-fg-muted hover:bg-raised/70 hover:text-fg",
)}>
<span aria-hidden="true"
className={cx("absolute top-3 bottom-3 left-0 w-[3px] rounded-r-full bg-accent transition-opacity", active ? "opacity-100" : "opacity-0")} />
<span className={cx("relative shrink-0", active && "text-accent")}>
<Icon size={20} />
{/* Com a barra recolhida o número fica no canto do ícone; o texto completo vai para leitores de tela. */}
{showCount && (
<span aria-hidden="true"
className="absolute -top-2 -right-2.5 grid h-4 min-w-4 place-items-center rounded-full bg-accent px-1 text-[0.625rem] leading-none font-bold text-accent-fg tabular-nums">
{count > 99 ? "99+" : count}
</span>
)}
</span>
<span className="rail-label grid min-w-0 whitespace-nowrap leading-tight">
<span className="text-sm font-medium">{label}</span>
<span className="text-[0.6875rem] text-fg-subtle">{hint}</span>
</span>
{showCount && <span className="sr-only">: {count} {countLabel}</span>}
</Link>
);
}