11import { useState } from 'react' ;
22import {
33 Radar ,
4+ Home as HomeIcon ,
45 LayoutDashboard ,
56 AlertOctagon ,
67 Link as LinkIcon ,
@@ -28,6 +29,7 @@ import { strings, format } from './lib/strings';
2829import { Badge , ReportSelector } from './components' ;
2930import ThemeToggle from './components/ThemeToggle.jsx' ;
3031import Overview from './views/Overview' ;
32+ import Home from './views/Home' ;
3133import Issues from './views/Issues' ;
3234import Links from './views/Links' ;
3335import Redirects from './views/Redirects' ;
@@ -44,6 +46,7 @@ import SqlPlayground from './views/SqlPlayground.jsx';
4446import BrowserMlChat from './components/ml/BrowserMlChat.jsx' ;
4547
4648const VIEW_CONFIG = [
49+ { id : 'home' , component : Home , icon : HomeIcon } ,
4750 { id : 'overview' , component : Overview , icon : LayoutDashboard } ,
4851 { id : 'model-loader' , component : ModelLoader , icon : Sparkles } ,
4952 { id : 'sql-playground' , component : SqlPlayground , icon : Database } ,
@@ -67,7 +70,7 @@ const VIEWS = VIEW_CONFIG.map((v) => ({
6770} ) ) ;
6871
6972function AppContent ( ) {
70- const [ view , setView ] = useState ( 'overview ' ) ;
73+ const [ view , setView ] = useState ( 'home ' ) ;
7174 const [ searchQuery , setSearchQuery ] = useState ( '' ) ;
7275 const [ sidebarOpen , setSidebarOpen ] = useState ( false ) ;
7376 const { data, loading, error } = useReport ( ) ;
@@ -78,8 +81,10 @@ function AppContent() {
7881 closeSidebar ( ) ;
7982 } ;
8083
81- const CurrentView = VIEWS . find ( ( v ) => v . id === view ) ?. component || Overview ;
84+ const CurrentView = VIEWS . find ( ( v ) => v . id === view ) ?. component || Home ;
8285 const isLabView = view === 'model-loader' || view === 'sql-playground' ;
86+ const isHomeView = view === 'home' ;
87+ const showSidebar = ! isHomeView ;
8388 const issueCount = data ?. categories ?. reduce ( ( n , c ) => n + ( c . issues ?. length || 0 ) , 0 ) ?? 0 ;
8489 const securityCount = data ?. security_findings ?. length ?? 0 ;
8590
@@ -113,9 +118,9 @@ function AppContent() {
113118 const sections = [ ...new Set ( VIEWS . map ( ( v ) => v . section ) ) ] ;
114119
115120 return (
116- < div className = " min-h-screen flex bg-brand-900 text-foreground overflow-hidden" >
121+ < div className = { ` min-h-screen bg-brand-900 text-foreground overflow-hidden ${ showSidebar ? 'flex' : 'block' } ` } >
117122 { /* Overlay when sidebar open (full-screen lab views; mobile-only on other views) */ }
118- { sidebarOpen && (
123+ { showSidebar && sidebarOpen && (
119124 < button
120125 type = "button"
121126 aria-label = { strings . app . ariaCloseMenu }
@@ -126,7 +131,7 @@ function AppContent() {
126131 />
127132 ) }
128133
129- < aside
134+ { showSidebar && < aside
130135 className = { `inset-y-0 left-0 w-64 bg-brand-800 border-r border-muted flex flex-col h-screen shrink-0 z-40 shadow-xl print:hidden transition-transform duration-200 ease-out ${
131136 isLabView
132137 ? `fixed ${ sidebarOpen ? 'translate-x-0' : '-translate-x-full' } `
@@ -204,10 +209,10 @@ function AppContent() {
204209 < span > { strings . app . githubLinkLabel } </ span >
205210 </ a >
206211 </ div >
207- </ aside >
212+ </ aside > }
208213
209214 < main className = "flex-1 flex flex-col h-screen overflow-hidden bg-brand-900 relative min-w-0" >
210- { isLabView ? (
215+ { showSidebar && isLabView ? (
211216 < button
212217 type = "button"
213218 aria-label = { strings . app . ariaOpenMenu }
@@ -219,18 +224,20 @@ function AppContent() {
219224 ) : null }
220225 < header
221226 className = { `h-16 border-b border-muted bg-brand-800/80 backdrop-blur-md flex items-center justify-between gap-3 px-4 sm:px-6 shrink-0 z-10 print:hidden ${
222- isLabView ? 'hidden' : ''
227+ isLabView || isHomeView ? 'hidden' : ''
223228 } `}
224229 >
225- < button
226- type = "button"
227- aria-label = { strings . app . ariaOpenMenu }
228- className = "md:hidden p-2 -ml-2 text-muted-foreground hover:text-bright rounded-lg shrink-0"
229- onClick = { ( ) => setSidebarOpen ( true ) }
230- >
231- < Menu className = "h-6 w-6" />
232- </ button >
233- < div className = "flex-1 min-w-0 max-w-xl relative" >
230+ { showSidebar ? (
231+ < button
232+ type = "button"
233+ aria-label = { strings . app . ariaOpenMenu }
234+ className = "md:hidden p-2 -ml-2 text-muted-foreground hover:text-bright rounded-lg shrink-0"
235+ onClick = { ( ) => setSidebarOpen ( true ) }
236+ >
237+ < Menu className = "h-6 w-6" />
238+ </ button >
239+ ) : null }
240+ < div className = { `min-w-0 relative ${ showSidebar ? 'flex-1 max-w-xl' : 'flex-1 max-w-2xl mx-auto' } ` } >
234241 < Search className = "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
235242 < input
236243 type = "text"
@@ -251,10 +258,10 @@ function AppContent() {
251258 id = "viewContainer"
252259 >
253260 < div className = { `fade-in ${ isLabView ? 'flex min-h-0 flex-1 flex-col' : '' } ` } >
254- < CurrentView searchQuery = { searchQuery } />
261+ < CurrentView searchQuery = { searchQuery } onNavigate = { selectView } />
255262 </ div >
256263 </ div >
257- { ! isLabView ? < BrowserMlChat /> : null }
264+ { ! isLabView && ! isHomeView ? < BrowserMlChat /> : null }
258265 </ main >
259266 </ div >
260267 ) ;
0 commit comments