// ESTÚDIO — UI compartilhada + Shell. Exporta em window.UI.
(function () {
const { useState } = React;
const D = window.DATA;
// ── Ícone de plataforma ──
const PLAT_SVG = {
instagram: '',
youtube: '',
tiktok: '',
pinterest: '',
linkedin: '',
substack: '',
blog: '',
};
function PlatIcon({ plat, size = 22 }) {
const p = D.plataformas[plat];
if (!p) return null;
const svg = PLAT_SVG[plat];
return React.createElement("span", {
className: "plat-ic", title: p.nome,
style: { width: size, height: size, fontSize: size * 0.42, background: p.cor, color: "#fff" },
dangerouslySetInnerHTML: svg ? { __html: svg } : undefined,
}, svg ? undefined : p.ic);
}
function PlatRow({ plats, size = 22 }) {
return React.createElement("span", { className: "plat-row" }, plats.map((p) => React.createElement(PlatIcon, { key: p, plat: p, size })));
}
// ── Ponto/etiqueta de perfil ──
function PerfilTag({ id, dot }) {
const p = D.perfis[id];
if (!p) return null;
if (dot) return React.createElement("span", { className: "perfil-dot", title: p.nome, style: { background: p.cor } });
return React.createElement("span", { className: "perfil-tag", style: { background: p.cor, color: "#fff" } }, p.nome);
}
// ── Chip genérico ──
function Chip({ children, active, onClick, color }) {
return React.createElement("button", { className: "chip" + (active ? " chip-on" : ""), onClick, style: active && color ? { background: color, borderColor: color, color: "#fff" } : undefined }, children);
}
// ── Badge de energia ──
function EnergiaBadge({ e }) {
const en = D.energias[e];
if (!en) return null;
return React.createElement("span", { className: "ebadge", style: { background: en.cor + "22", color: en.cor } }, en.dot + " " + en.nome);
}
// ── Barra de progresso ──
function Bar({ value, ideal, color = "#FF78B0" }) {
return React.createElement("div", { className: "bar-wrap" },
React.createElement("div", { className: "bar-fill", style: { width: Math.min(value, 100) + "%", background: color } }),
ideal != null && React.createElement("div", { className: "bar-ideal", title: "ideal " + ideal + "%", style: { left: ideal + "%" } })
);
}
// ── Estrelas (ROI editorial) ──
function Stars({ n, max = 5 }) {
return React.createElement("span", { className: "stars" }, Array.from({ length: max }, (_, i) => React.createElement("span", { key: i, className: i < n ? "star on" : "star" }, "★")));
}
// ── Cabeçalho de página ──
function PageHead({ titulo, sub, right }) {
return React.createElement("div", { className: "page-head" },
React.createElement("div", null,
React.createElement("h1", { className: "page-title" }, titulo),
sub && React.createElement("p", { className: "page-sub" }, sub)
),
right && React.createElement("div", { className: "page-head-right" }, right)
);
}
function Card({ children, className = "", ...rest }) {
return React.createElement("div", { className: "card " + className, ...rest }, children);
}
function fmtData(iso) {
if (!iso) return "—";
const [y, m, d] = iso.split("-");
const meses = ["jan", "fev", "mar", "abr", "mai", "jun", "jul", "ago", "set", "out", "nov", "dez"];
return d + " " + meses[+m - 1];
}
function daysDiff(iso) {
if (!iso) return 0;
const [y, m, d] = iso.split("-").map(Number);
const dt = new Date(y, m - 1, d);
const hoje = new Date(); hoje.setHours(0, 0, 0, 0);
return Math.round((dt - hoje) / 86400000);
}
function hojeLabelBR() {
const dias = ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"];
const meses = ["janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"];
const n = new Date();
return dias[n.getDay()] + ", " + n.getDate() + " de " + meses[n.getMonth()] + " de " + n.getFullYear();
}
window.hojeLabelBR = hojeLabelBR;
// ── SIDEBAR ──
const h = React.createElement;
const LORENNA = encodeURI("Dashboard Lorenna.html");
const NAV = [
{ grp: "Visão", items: [["hoje", "Para Hoje", "⚡"], ["dashboard", "Dashboard", "🏠"], ["agentes", "Agentes", "🤖"], ["calendario", "Calendário", "🗓️"], ["kanban", "Produção", "🎬"]] },
{ grp: "Criação", items: [["pautas", "Ideias & Pautas", "💡"], ["prompts", "Prompts", "🤖"], ["repertorio", "Repertório", "📚"], ["experiencias", "Experiências", "✨"], ["conhecimento", "Conhecimento", "🎓"]] },
{ grp: "Base", items: [["perfil", "Sistema da Criadora", "🪞"], ["biblioteca", "Biblioteca", "🗂️"], ["parcerias", "Parcerias", "🤝"], ["aprendizados", "Aprendizados", "📈"]] },
{ grp: "Negócio", items: [["logue", "Agência Logue", "💼"], ["monetizacao", "Monetização", "💰"]] },
{ grp: "Lorenna OS", ext: true, items: [[LORENNA + "#/", "Painel pessoal", "🌸"], [LORENNA + "#/captura", "Baú de Ideias", "🧠"], [LORENNA + "#/tarefas", "Tarefas", "✅"]] },
];
function Sidebar({ rota, setRota, energy, setEnergy, onTrocarPerfil }) {
const ecfg = (window.ENERGY && window.ENERGY[energy]) || null;
const elist = window.ENERGY_LIST || [];
return h("aside", { className: "sidebar" },
h("div", { className: "brand" },
h("div", { className: "brand-mark" }, "L"),
h("div", null,
h("div", { className: "brand-name" }, "Estúdio"),
h("div", { className: "brand-sub" }, "OS de Criação")
)
),
ecfg && h("div", { className: "energy-chip", style: { background: ecfg.color + "1F", borderColor: ecfg.color + "44" } },
h("div", { className: "energy-chip-label" }, "Modo atual"),
h("div", { className: "energy-chip-val", style: { color: ecfg.color } }, h("span", null, ecfg.emoji), " ", ecfg.label)
),
h("nav", { className: "nav" },
NAV.map((g) => h("div", { key: g.grp, className: "nav-grp" + (g.ext ? " nav-grp-ext" : "") },
h("div", { className: "nav-grp-label" }, g.ext ? "↗ " + g.grp : g.grp),
g.items.map(([id, label, ic]) => g.ext
? h("a", { key: id, className: "nav-item nav-ext", href: id }, h("span", { className: "nav-ic" }, ic), h("span", null, label))
: h("button", { key: id, className: "nav-item" + (rota === id ? " nav-on" : ""), onClick: () => setRota(id) }, h("span", { className: "nav-ic" }, ic), h("span", null, label))
)
))
),
ecfg && h("div", { className: "energy-switch" },
h("div", { className: "energy-switch-t" }, "Trocar energia"),
h("div", { className: "energy-switch-grid" }, elist.map((e) => h("button", { key: e.id, className: energy === e.id ? "eon" : "", title: e.label, onClick: () => setEnergy(e.id) }, e.emoji)))
),
h("div", { className: "side-perfis" },
Object.values(D.perfis).map((p) => h("div", { key: p.id, className: "side-perfil" },
h("span", { className: "perfil-dot", style: { background: p.cor } }), h("span", null, p.nome)
)),
onTrocarPerfil && h("button", { className: "side-trocar", onClick: onTrocarPerfil }, "↺ Trocar perfil")
)
);
}
Object.assign(window, { UI: { PlatIcon, PlatRow, PerfilTag, Chip, EnergiaBadge, Bar, Stars, PageHead, Card, fmtData, daysDiff, Sidebar } });
})();