Clipador: subpáginas, jogos, idioma por canal e juiz com Gemini e IA reserva

- Clipador em subpáginas (Cortes, Sessões, Fontes, Jogos, Ajustes) com moldura comum, lista + diálogo
  dos cortes e submenu na barra lateral.
- Perfis de jogo (o que a IA sabe de cada jogo), parar pausa o monitor e idioma por fonte e por canal
  de publicação (migração v9: accounts.language).
- Juiz: Gemini CLI como terceiro provedor e IA reserva por chamada — se a IA escolhida cair por cota,
  login, chave ou rede, a próxima da ordem de Configurações → IA responde (com pausa da que caiu).
  Lê data/ai/settings.json e o cofre data/ai/vault.bin (DPAPI) escritos pelo painel; contrato em doc/ia.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 01:51:12 -03:00
co-authored by Claude Opus 5.5
parent 2d8b1a582d
commit 0567c7454a
55 changed files with 6514 additions and 2506 deletions
+49 -5
View File
@@ -10,12 +10,20 @@
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useEffect, useState, type ComponentType } from "react";
import { CLIPPER_SECTIONS, activeSection } from "./clipper-shell";
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 }> };
type SubItem = { href: string; label: string; icon?: ComponentType<{ size?: number }> };
type NavItem = {
href: string; label: string; hint: string; icon: ComponentType<{ size?: number }>;
/** Subpáginas: aparecem abaixo do item, só com a barra expandida e o item ativo (regra .rail-sub em globals.css). */
children?: SubItem[];
/** Qual subitem está ativo para um caminho (padrão: o próprio href). */
activeChild?: (pathname: string) => string | null;
};
/** 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;
@@ -23,7 +31,11 @@ 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: "/clipper", label: "Clipador", hint: "Cortes de live", icon: ScissorsIcon,
children: CLIPPER_SECTIONS.map((s) => ({ href: s.href, label: s.label, icon: s.icon })),
activeChild: (pathname) => activeSection(pathname)?.href ?? null,
},
{ href: "/characters", label: "Personagens", hint: "Elenco reaproveitável", icon: UsersIcon },
{ href: "/assets", label: "Assets", hint: "Biblioteca e envios", icon: CubeIcon },
{ href: "/voices", label: "Vozes", hint: "Narração e legenda", icon: MicIcon },
@@ -108,14 +120,18 @@ export function Sidebar() {
);
}
function NavLink({ item: { href, label, hint, icon: Icon }, active, count = null, countLabel }: {
function NavLink({ item, 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 { href, label, hint, icon: Icon, children } = item;
const pathname = usePathname();
const showCount = count !== null && count > 0;
return (
<Link href={href} aria-current={active ? "page" : undefined}
// Com subpáginas: o item principal marca a seção; o subitem marca a página (aria-current fica no subitem).
const activeChild = active && children ? item.activeChild?.(pathname) ?? null : null;
const link = (
<Link href={href} aria-current={active && !children ? "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",
@@ -139,4 +155,32 @@ function NavLink({ item: { href, label, hint, icon: Icon }, active, count = null
{showCount && <span className="sr-only">: {count} {countLabel}</span>}
</Link>
);
if (!children || !active) return link;
return (
<div className="grid">
{link}
{/* Subpáginas: abrem com a barra (altura animada por grid-template-rows); recolhida, não ocupam espaço. */}
<div className="rail-sub">
<ul className="min-h-0 overflow-hidden" aria-label={`Seções de ${label}`}>
{children.map((c) => {
const on = activeChild === c.href;
const SubIcon = c.icon;
return (
<li key={c.href}>
<Link href={c.href} aria-current={on ? "page" : undefined}
className={cx("relative flex h-8 items-center gap-2.5 rounded-control py-1 pr-3 pl-[2.75rem] text-[0.8125rem] whitespace-nowrap transition-colors",
on ? "bg-raised/60 font-semibold text-fg" : "text-fg-subtle hover:bg-raised/40 hover:text-fg")}>
{/* Mesmo ícone da sub-navegação do topo do Clipador; sem ícone, um ponto. */}
{SubIcon
? <span aria-hidden="true" className={cx("flex shrink-0", on ? "text-accent" : "text-fg-subtle")}><SubIcon size={15} /></span>
: <span aria-hidden="true" className={cx("size-1.5 shrink-0 rounded-full", on ? "bg-accent" : "bg-line-strong")} />}
<span className="rail-label">{c.label}</span>
</Link>
</li>
);
})}
</ul>
</div>
</div>
);
}