// TopBar — brand + workspace + per-platform credit balances + user. window.TopBar = function TopBar({ onOpenTweaks, credits, user, pendingAccessCount, onOpenAccessRequests, onLogout }) { const c = credits || {}; const label = user?.email || user?.username || user?.user_id || ''; const initials = (label || 'RS') .split(/[^a-zA-Z0-9]+/) .filter(Boolean) .slice(0, 2) .map(part => part[0]) .join('') .toUpperCase() || 'RS'; // Only surface platforms whose balance is known. Backend-less platforms // stay out of the bar until their credit feed lands. const chips = Object.entries(PLATFORMS) .map(([key, p]) => [key, p, c[key]]) .filter(([, , bal]) => typeof bal === "number"); return (
Resilia
⌘K
{user?.is_admin && pendingAccessCount > 0 && ( )} {chips.length > 0 && (
{chips.map(([key, p, bal]) => ( {p.label} {bal.toLocaleString()} ))}
)}
{initials}
{label && {label}}
); };