feat(console): rombak penuh dashboard layout jadi Event Horizon

Layout baru single-screen ops console:
- TopBar 48px (brand monogram, guild, ws status, clock UTC/local, focus mode)
- LeftRail 80px (icon+label nav, signal accent bar, no boxes)
- Hero strip (display headline + mono counters: clean/warned/flagged/ratio)
- EventFeed (vertical timeline of message events, severity dots, no cards)
- NowMarker (inline pulse + cluster band insert per 10 events / 30s)
- RightRail 320px collapsible (ai verdicts / voice / mod queue / socket)
- DashCommandLine bottom 44px (mono prompt, '/' focuses, /mute /jump /find /clear)

Replace Spine + StatusBar lama untuk /dashboard via pathname branch di
(dashboard)/layout.tsx — route lain (messages/voice/media/dll) tetap
pakai ClassicShell, tidak ter-regress.

SSR seed tetap lewat page.tsx (server fetch stats + activity), synthetic
seed events dari daily buckets sampai WS message_created kick in.

WS event mapper: severity di-derive dari ai_status + ai_severity,
excerpt dipotong 140 char, channel tail 4 char.

No card chrome, no shadow, no bento grid, no tab panels.
This commit is contained in:
asepharyana
2026-08-15 16:21:45 +07:00
parent 6c9a91dad4
commit 84757bdcf4
9 changed files with 1346 additions and 239 deletions
@@ -1,5 +1,6 @@
"use client";
import { usePathname } from "next/navigation";
import { Suspense, useEffect, useState } from "react";
import { SWRConfig } from "swr";
import { ChatbotContainer } from "@/components/chatbot/chatbot-container";
@@ -7,11 +8,12 @@ import {
ChatbotProvider,
useChatbot,
} from "@/components/chatbot/chatbot-context";
import { DashLeftRail } from "@/components/layout/dash-left-rail";
import { DashTopBar } from "@/components/layout/dash-top-bar";
import { Spine } from "@/components/layout/spine";
import { StatusBar } from "@/components/layout/status-bar";
import { MiniPlayer } from "@/components/media/mini-player";
import { RouteTransition } from "@/components/motion/route-transition";
import { GuildSelector } from "@/components/shared/guild-selector";
import { MediaPlayerProvider } from "@/lib/hooks/use-media-player";
import { useWebSocket, WsProvider } from "@/lib/ws/context";
@@ -42,12 +44,69 @@ function ChatbotExpressionSync() {
return null;
}
/**
* New Event Horizon shell — used only on /dashboard.
*
* No `Spine`, no `StatusBar`, no padded `<main>`, no 1440px max-width.
* Full-bleed single-screen layout. Other dashboard routes keep the
* classic shell so the rest of the app is untouched.
*/
function ConsoleShell({ children }: { children: React.ReactNode }) {
return (
<div className="flex h-svh w-full flex-col overflow-hidden bg-[var(--color-canvas)]">
<DashTopBar guildName="GMW Console" />
<div className="flex min-h-0 flex-1">
<DashLeftRail />
<main className="min-w-0 flex-1 overflow-hidden">{children}</main>
</div>
</div>
);
}
/**
* Classic shell — used on every other route under /(dashboard).
*/
function ClassicShell({
children,
guildId,
setGuildId,
}: {
children: React.ReactNode;
guildId: string;
setGuildId: (g: string) => void;
}) {
return (
<div className="min-h-svh bg-[var(--color-canvas)] md:pl-[68px]">
<Spine />
<div className="flex min-h-svh flex-col">
<StatusBar guildId={guildId} onGuildChange={(g) => setGuildId(g)} />
<main className="flex flex-1 flex-col gap-4 p-4 pb-24 md:p-6 lg:pb-8">
<div className="mx-auto w-full max-w-[1440px]">
<Suspense
fallback={
<div className="flex h-[60vh] items-center justify-center">
<div className="size-8 animate-spin rounded-full border-2 border-[var(--color-signal)] border-t-transparent" />
</div>
}
>
<RouteTransition>{children}</RouteTransition>
</Suspense>
</div>
</main>
</div>
</div>
);
}
export default function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
const [guildId, setGuildId] = useState("");
const pathname = usePathname();
// Match exact /dashboard or /dashboard/ but not /dashboard/<subroute>
const isConsole = pathname === "/dashboard" || pathname === "/dashboard/";
return (
<SWRConfig
@@ -63,30 +122,15 @@ export default function DashboardLayout({
<ChatbotProvider>
<ChatbotGuildSync guildId={guildId} />
<ChatbotExpressionSync />
<div className="min-h-svh bg-[var(--color-canvas)] md:pl-[68px]">
<Spine />
<div className="flex min-h-svh flex-col">
<StatusBar
guildId={guildId}
onGuildChange={(g) => setGuildId(g)}
/>
<main className="flex flex-1 flex-col gap-4 p-4 pb-24 md:p-6 lg:pb-8">
<div className="mx-auto w-full max-w-[1440px]">
<Suspense
fallback={
<div className="flex h-[60vh] items-center justify-center">
<div className="size-8 animate-spin rounded-full border-2 border-[var(--color-signal)] border-t-transparent" />
</div>
}
>
<RouteTransition>{children}</RouteTransition>
</Suspense>
</div>
</main>
</div>
<MiniPlayer />
<ChatbotContainer />
</div>
{isConsole ? (
<ConsoleShell>{children}</ConsoleShell>
) : (
<ClassicShell guildId={guildId} setGuildId={setGuildId}>
{children}
</ClassicShell>
)}
<MiniPlayer />
<ChatbotContainer />
</ChatbotProvider>
</MediaPlayerProvider>
</WsProvider>