/* Waypath Platform — premium shell. Floating composer · status groups · slide-in inspector. */ const { Btn, Arr, Row, CustomerRow, GroupH, Subhead, CustomerInspector, OppInspector, FirstRunView, ThreadView, ReportsView, STATUSES, AsciiStatus, Ticker, AtmosField, ThreadBg, StrengthStrip, TickStrip } = window.WP_VIEWS; const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "scenario": "active", "destination": "today", "showInspector": true, "accent": "#ff5a1f" }/*EDITMODE-END*/; /* ───────── topbar ───────── */ function Topbar({ crumbs }) { return (
WAYPATHacme
{crumbs.map((c, i) => ( {i > 0 ? / : null} {c.label} ))} {crumbs[crumbs.length - 1] && crumbs[crumbs.length - 1].id ? ( {crumbs[crumbs.length - 1].id} ) : null}
SIG 4/8 ? Signal strength
Live readout of inbound buying-intent signals across your active accounts. Tall vermillion bars are hot signals firing right now; muted bars are background noise. 4/8 = 4 hot signals in the last 60s.
Search⌘ K
5agents sc
); } /* ───────── rail ───────── */ function Rail({ dest, setDest, scenario, onDemo }) { const nav = [ { id: "today", label: "Today", count: "12", k: "T", icon: ( ) }, { id: "pipeline", label: "Pipeline", count: "42", k: "P", icon: ( ) }, { id: "customers", label: "Customers", count: "2.1k", k: "C", icon: ( ) }, { id: "atlas", label: "Atlas", count: "ATL-01", k: "A", icon: ( ) } ]; return ( ); } /* ───────── floating composer ───────── */ function Composer({ suggestions, onSend, onSuggest, contextLabel }) { const [val, setVal] = useState(""); const ref = useRef(null); const send = () => { if (val.trim()) { onSend(val); setVal(""); } }; useEffect(() => { const focus = (e) => { if ((e.metaKey || e.ctrlKey) && e.key === "/") { e.preventDefault(); ref.current && ref.current.focus(); } }; window.addEventListener("keydown", focus); return () => window.removeEventListener("keydown", focus); }, []); return (
Orchestrator · {contextLabel}
{suggestions.slice(0, 3).map((s, i) => ( ))}
setVal(e.target.value)} onKeyDown={e => { if (e.key === "Enter") { e.preventDefault(); send(); } }} placeholder="ask the agent — who should I reach out to today, or @customer · /playbook" />
); } /* ───────── inspector wrapper ───────── */ function Inspector({ scenario, selected, onFire, onOpenCustomer, onClose }) { if (scenario === "drill" || (selected && selected.id && selected.id.startsWith("CST"))) { return ; } if (selected && selected.id && selected.id.startsWith("OPP")) { return ; } return null; } /* ───────── list pane with status groups ───────── */ function ListPane({ dest, view, selected, setSelected }) { const filterFn = (o) => { if (view === "all") return true; if (dest === "customers") { if (view === "high") return o.health > 75; if (view === "warm") return o.health >= 50 && o.health <= 75; return o.health < 50; } return o.stage === view; }; if (dest === "customers") { const custs = window.WP_DATA.customers.filter(filterFn); const groups = { "Healthy": custs.filter(c => c.health > 75), "Watch": custs.filter(c => c.health >= 50 && c.health <= 75), "At-risk": custs.filter(c => c.health < 50) }; return (
{Object.entries(groups).map(([k, list]) => list.length ? ( {list.map((c, i) => ( ))} ) : null )}
); } const opps = window.WP_DATA.opps.filter(filterFn); const groups = [ { id: "high", label: "In progress", meta: "agents firing now", list: opps.filter(o => o.stage === "high") }, { id: "warm", label: "Ready for review", meta: "awaiting your call", list: opps.filter(o => o.stage === "warm") }, { id: "cool", label: "Cooling", meta: "low signal", list: opps.filter(o => o.stage === "cool") } ]; return (
{groups.map(g => g.list.length ? ( {g.list.map((o, i) => ( ))} ) : null )}
); } /* ───────── APP ───────── */ function App() { const [t, setTweak] = useTweaks(TWEAK_DEFAULTS); const [scenario, setScenario] = useState(t.scenario || "active"); const [dest, setDest] = useState(t.destination || "today"); const [view, setView] = useState("all"); const [selected, setSelected] = useState(window.WP_DATA.opps[0]); const [inspectorOpen, setInspectorOpen] = useState(t.showInspector !== false); const [todayTab, setTodayTab] = useState("queue"); useEffect(() => { setScenario(t.scenario); }, [t.scenario]); useEffect(() => { setDest(t.destination); }, [t.destination]); useEffect(() => { document.documentElement.style.setProperty("--orange", t.accent); document.documentElement.style.setProperty("--signal", t.accent); }, [t.accent]); // drill scenario → force Sarah Chen + inspector useEffect(() => { if (scenario === "drill") { setDest("customers"); setTweak("destination", "customers"); const sarah = window.WP_DATA.customers.find(c => c.id === "CST-217"); setSelected(sarah); setInspectorOpen(true); } }, [scenario]); /* keyboard nav */ useEffect(() => { const handler = (e) => { if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA") return; const list = dest === "customers" ? window.WP_DATA.customers : window.WP_DATA.opps; const idx = list.findIndex(x => x.id === (selected && selected.id)); if (e.key === "j") { e.preventDefault(); setSelected(list[Math.min(list.length - 1, idx + 1)]); setInspectorOpen(true); } if (e.key === "k") { e.preventDefault(); setSelected(list[Math.max(0, idx - 1)]); setInspectorOpen(true); } if (e.key === "t") { setDest("today"); setTweak("destination", "today"); goToScenario("active"); } if (e.key === "r" && dest === "today") { setTodayTab(tt => tt === "reports" ? "queue" : "reports"); setInspectorOpen(false); } if (e.key === "p") { setDest("pipeline"); setTweak("destination", "pipeline"); goToScenario("active"); } if (e.key === "c") { setDest("customers"); setTweak("destination", "customers"); goToScenario("active"); } if (e.key === "a") { setDest("atlas"); setTweak("destination", "atlas"); goToScenario("active"); setInspectorOpen(false); } if (e.key === "d") { goToScenario("firstrun"); } if (e.key === "Escape") { setInspectorOpen(false); } }; window.addEventListener("keydown", handler); return () => window.removeEventListener("keydown", handler); }, [selected, dest]); const suggestions = useMemo(() => { if (scenario === "reply") return [ { label: "Draft 3", k: "D" }, { label: "Show reasoning", k: "R" }, { label: "Fire all", k: "⏎" } ]; if (dest === "pipeline") return [ { label: "Most urgent", k: "1" }, { label: "What's cooling", k: "2" }, { label: "Fire high-conf", k: "3" } ]; if (dest === "atlas") return [ { label: "Find dead ends", k: "1" }, { label: "Cluster by stage", k: "2" }, { label: "Isolate Sarah Chen", k: "3" } ]; if (dest === "customers") return [ { label: "Who's at risk", k: "1" }, { label: "Ready to expand", k: "2" }, { label: "New this week", k: "3" } ]; if (dest === "today" && todayTab === "reports") return [ { label: "Open most recent", k: "1" }, { label: "What changed today", k: "2" }, { label: "Email me the digest", k: "3" } ]; return [ { label: "Reach out today", k: "1", q: "today" }, { label: "What moved overnight", k: "2" }, { label: "Draft 3 outreaches", k: "3" } ]; }, [scenario, dest, todayTab]); const goToScenario = (s) => { setScenario(s); setTweak("scenario", s); }; const handleSelect = (item) => { setSelected(item); setInspectorOpen(true); }; const handleSuggest = (s) => goToScenario("reply"); const handleSend = () => goToScenario("reply"); const onFire = () => goToScenario("reply"); const onOpenCustomer = () => { setDest("customers"); setTweak("destination", "customers"); const sarah = window.WP_DATA.customers.find(c => c.id === "CST-217"); setSelected(sarah); setInspectorOpen(true); goToScenario("drill"); }; const onClose = () => setInspectorOpen(false); const crumbs = useMemo(() => { if (scenario === "firstrun") return [{ label: "First run" }]; if (scenario === "reply") return [ { label: "Today" }, { label: "Agent thread", id: "RPL-088" } ]; const dl = dest === "today" ? "Today" : dest === "pipeline" ? "Pipeline" : dest === "customers" ? "Customers" : dest === "atlas" ? "Atlas" : "Today"; if (dest === "atlas") return [{ label: "Atlas", id: "ATL-01" }]; if (dest === "today" && todayTab === "reports") return [{ label: "Today" }, { label: "Reports" }]; if (selected && selected.id && inspectorOpen) return [ { label: dl }, { label: selected.name || selected.who.split(" · ")[0], id: selected.id } ]; return [{ label: dl }]; }, [scenario, dest, selected, inspectorOpen, todayTab]); const contextLabel = { firstrun: "first-run", active: dest === "today" && todayTab === "reports" ? "today · reports" : dest === "today" ? "today" : dest === "pipeline" ? "pipeline" : dest === "customers" ? "customers" : dest === "atlas" ? "atlas · ATL-01" : "today", drill: "customer · CST-217", reply: "agent thread" }[scenario]; const showInspector = inspectorOpen && selected && dest !== "atlas" && !(dest === "today" && todayTab === "reports") && (scenario === "active" || scenario === "drill"); return (
{ setDest(d); setTweak("destination", d); goToScenario("active"); if (d === "atlas") setInspectorOpen(false); }} onDemo={() => goToScenario("firstrun")} />
{scenario === "reply" ?
: null} {scenario === "firstrun" ?
: null} {scenario === "firstrun" ? ( <>
) : scenario === "reply" ? ( <>
goToScenario("active")} onFire={onFire} /> ) : dest === "atlas" ? ( ) : dest === "today" && todayTab === "reports" ? ( <> {/* future: open report inspector */}} /> ) : ( <> )}
{showInspector ? ( ) : null} setTweak("scenario", v)} /> { setTweak("destination", v); setTweak("scenario", "active"); }} /> setInspectorOpen(v)} /> setTweak("accent", v)} />
); } ReactDOM.createRoot(document.getElementById("root")).render();