- lib/live-data.ts: Shared TypeScript client for blackroad-live-data Worker - components/live-stats.tsx: LiveStatsBar, RecentRepos, AgentStatusGrid components - app/page.tsx: Import LiveStatsBar in main page header Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
import { useRouter } from 'next/navigation';
|
|
import { useAuthStore } from '@/stores/auth-store';
|
|
import { useWorkspaceStore } from '@/stores/workspace-store';
|
|
import Sidebar from '@/components/Sidebar';
|
|
import AppHeader from '@/components/AppHeader';
|
|
|
|
export default function AppLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const router = useRouter();
|
|
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
|
|
const fetchWorkspaces = useWorkspaceStore((state) => state.fetchWorkspaces);
|
|
|
|
useEffect(() => {
|
|
if (!isAuthenticated) {
|
|
router.push('/login');
|
|
} else {
|
|
fetchWorkspaces();
|
|
}
|
|
}, [isAuthenticated, router, fetchWorkspaces]);
|
|
|
|
if (!isAuthenticated) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-screen overflow-hidden">
|
|
<Sidebar />
|
|
<div className="flex flex-1 flex-col overflow-hidden">
|
|
<AppHeader />
|
|
<main className="flex-1 overflow-y-auto bg-black">
|
|
{children}
|
|
</main>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|