// Main app shell — sidebar nav, topbar, page routing, tweaks panel
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "lime",
"dark": false,
"layout": "timeline",
"progress": "day1",
"persona": "eng",
"density": "regular"
}/*EDITMODE-END*/;
const NAV_GROUPS = [
{
label: "Onboarding",
items: [
{ id: "dashboard", label: "Home", icon: "home" },
{ id: "meetings", label: "Meetings", icon: "calendar", badge: "11" },
{ id: "documents", label: "Documents", icon: "doc", badge: "9" },
{ id: "training", label: "Training", icon: "book", dot: true },
],
},
{
label: "Setup",
items: [
{ id: "insurance", label: "Healthcare & insurance", icon: "shield" },
{ id: "payroll", label: "Pay & taxes", icon: "dollar" },
{ id: "equipment", label: "IT & equipment", icon: "laptop" },
{ id: "profile", label: "Profile", icon: "user" },
],
},
];
// Demo mode — no backend on shared hosting, state is in-memory only
window.onboardingAPI = null;
// ── Resolve persona from role string ────────────────────────────────────────
function roleToPersona(role) {
if (!role) return "eng";
const r = role.toLowerCase();
if (r === "design" || r.includes("design")) return "design";
if (r === "sales" || r.includes("sales") || r.includes("account")) return "sales";
return "eng";
}
// ── LoadingScreen ────────────────────────────────────────────────────────────
function LoadingScreen() {
return (
);
}
// ── App ───────────────────────────────────────────────────────────────────────
function App() {
const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
const [page, setPage] = React.useState("dashboard");
const [employee, setEmployee] = React.useState(null);
const [progress, setProgress] = React.useState(null);
const [loading, setLoading] = React.useState(true);
// Read ?id= from URL
const employeeId = React.useMemo(() => {
const params = new URLSearchParams(window.location.search);
return params.get("id");
}, []);
// Static demo mode — no backend calls
React.useEffect(() => { setLoading(false); }, []);
// Derive progress level from completed tasks
const progressLevel = React.useMemo(() => {
if (!progress) return t.progress;
const done = new Set(progress.completed_tasks || []);
// If all 19 tasks done → "done", if any week1/month1 done → "week1", else "day1"
if (done.size >= 19) return "done";
const week1Tasks = ["t8","t9","t10","t11","t12","t13","t14"];
if (week1Tasks.some(id => done.has(id))) return "week1";
return "day1";
}, [progress, t.progress]);
// Active hire name — real employee or demo
const hire = React.useMemo(() => {
if (employee) {
return { name: employee.name, first: employee.first_name };
}
return NEW_HIRE;
}, [employee]);
// Apply theme attrs
React.useEffect(() => {
document.documentElement.dataset.theme = t.dark ? "dark" : "light";
document.documentElement.dataset.accent = t.accent;
document.documentElement.dataset.density = t.density;
}, [t.dark, t.accent, t.density]);
const goto = (p) => {
const map = { meetings: "meetings", documents: "documents", training: "training", insurance: "insurance" };
setPage(map[p] || p);
window.scrollTo({ top: 0, behavior: "instant" });
};
if (loading) return ;
// Signed-docs set from API (used by DocumentsPage)
const savedSignedIds = new Set((progress?.signed_docs) || []);
return (
{/* Sidebar */}
{/* Main */}
{page === "dashboard" && (
)}
{page === "meetings" && }
{page === "documents" && (
)}
{page === "training" && (
)}
{page === "insurance" && (
)}
{page === "profile" && }
{page === "payroll" && }
{page === "equipment" && }
o.color)}
onChange={(v) => {
const map = { "#84cc16": "lime", "#6366f1": "indigo", "#ef6a4d": "coral", "#0891b2": "ocean" };
setTweak("accent", map[v] || "lime");
}}
/>
setTweak("dark", v)}/>
setTweak("density", v)}/>
setTweak("layout", v)}
/>
{!employeeId && (
<>
setTweak("progress", v)}
/>
setTweak("persona", v)}
/>
>
)}
);
}
ReactDOM.createRoot(document.getElementById("root")).render();