@@ -2,16 +2,28 @@ import { useState, useEffect, useRef } from 'react';
22import { Repo , LogEntry } from './types' ;
33import { Dashboard } from './Dashboard' ;
44import { Settings } from './Settings' ;
5+ import { Logs } from './Logs' ;
56import { Sidebar } from './components/Sidebar' ;
67import { Footer } from './components/Footer' ;
78
9+ import { Moon , Sun } from 'lucide-react' ;
10+ import { Button } from './components/ui/Button' ;
11+
812const App = ( ) => {
9- const [ activeTab , setActiveTab ] = useState < 'dashboard' | 'settings' > ( 'dashboard' ) ;
13+ const [ activeTab , setActiveTab ] = useState < 'dashboard' | 'logs' | ' settings'> ( 'dashboard' ) ;
1014 const [ repos , setRepos ] = useState < Repo [ ] > ( [ ] ) ;
1115 const [ logs , setLogs ] = useState < LogEntry [ ] > ( [ ] ) ;
16+ const [ theme , setTheme ] = useState < 'dark' | 'light' > ( 'dark' ) ;
1217
1318 const logsEndRef = useRef < HTMLDivElement > ( null ) ;
1419
20+ useEffect ( ( ) => {
21+ document . documentElement . classList . toggle ( 'light' , theme === 'light' ) ;
22+ document . documentElement . classList . toggle ( 'dark' , theme === 'dark' ) ;
23+ } , [ theme ] ) ;
24+
25+ const toggleTheme = ( ) => setTheme ( prev => prev === 'dark' ? 'light' : 'dark' ) ;
26+
1527 const addLog = ( msg : string , type : LogEntry [ 'type' ] = 'info' ) => {
1628 const entry : LogEntry = {
1729 id : Date . now ( ) + Math . random ( ) ,
@@ -141,15 +153,18 @@ const App = () => {
141153 return (
142154 < div className = "flex flex-col h-screen bg-background text-foreground" >
143155 { /* Custom Title Bar */ }
144- < div className = "flex items-center justify-between h-8 border-b border-border flex-shrink-0 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60" >
145- < div className = "flex items-center px-3 gap-2 drag-region h-full flex-grow" >
146- < svg xmlns = "http://www.w3.org/2000/svg" width = "24" height = "24" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" strokeWidth = "2" strokeLinecap = "round" strokeLinejoin = "round" className = "w-4 h-4" > < path d = "M21 12a9 9 0 1 1-6.219-8.56" /> </ svg >
147- < span className = "font-semibold text-xs" > Git Watcher Pro</ span >
156+ < div className = "flex items-center justify-between h-9 border-b border-border flex-shrink-0 bg-muted/20 backdrop-blur supports-[backdrop-filter]:bg-background/60 select-none " >
157+ < div className = "flex items-center px-4 gap-2 drag-region h-full flex-grow" >
158+ < svg xmlns = "http://www.w3.org/2000/svg" width = "24" height = "24" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" strokeWidth = "2" strokeLinecap = "round" strokeLinejoin = "round" className = "w-4 h-4 text-primary " > < path d = "M21 12a9 9 0 1 1-6.219-8.56" /> </ svg >
159+ < span className = "font-medium text-xs tracking-wide opacity-80 " > Git Watcher Pro</ span >
148160 </ div >
149- < div className = "flex items-center h-full no-drag-region" >
150- < div className = "w-10 h-full flex items-center justify-center text-sm hover:bg-accent transition-colors cursor-default" onClick = { ( ) => window . electronAPI ?. minimize ( ) } > ─</ div >
151- < div className = "w-10 h-full flex items-center justify-center text-sm hover:bg-accent transition-colors cursor-default" onClick = { ( ) => window . electronAPI ?. maximize ( ) } > □</ div >
152- < div className = "w-10 h-full flex items-center justify-center text-sm hover:bg-destructive hover:text-destructive-foreground transition-colors cursor-default" onClick = { ( ) => window . electronAPI ?. close ( ) } > ✕</ div >
161+ < div className = "flex items-center h-full no-drag-region pr-1" >
162+ < Button variant = "ghost" size = "icon" onClick = { toggleTheme } className = "w-7 h-7 mr-2 hover:bg-accent/50" >
163+ { theme === 'dark' ? < Sun className = "w-3.5 h-3.5" /> : < Moon className = "w-3.5 h-3.5" /> }
164+ </ Button >
165+ < div className = "w-10 h-7 rounded-sm flex items-center justify-center text-xs hover:bg-accent transition-colors cursor-default" onClick = { ( ) => window . electronAPI ?. minimize ( ) } > ─</ div >
166+ < div className = "w-10 h-7 rounded-sm flex items-center justify-center text-xs hover:bg-accent transition-colors cursor-default" onClick = { ( ) => window . electronAPI ?. maximize ( ) } > □</ div >
167+ < div className = "w-10 h-7 rounded-sm flex items-center justify-center text-xs hover:bg-destructive hover:text-destructive-foreground transition-colors cursor-default" onClick = { ( ) => window . electronAPI ?. close ( ) } > ✕</ div >
153168 </ div >
154169 </ div >
155170
@@ -159,16 +174,20 @@ const App = () => {
159174 { activeTab === 'dashboard' && (
160175 < Dashboard
161176 repos = { repos }
162- logs = { logs }
163- logsEndRef = { logsEndRef }
164177 onToggleAutoPull = { toggleAutoPull }
165178 onManualPull = { handleManualPull }
166179 onManualPush = { handleManualPush }
167180 onDeleteRepo = { handleDeleteRepo }
168- onClearLogs = { handleClearLogs }
169181 onAddRepo = { handleAddRepo }
170182 />
171183 ) }
184+ { activeTab === 'logs' && (
185+ < Logs
186+ logs = { logs }
187+ logsEndRef = { logsEndRef }
188+ onClearLogs = { handleClearLogs }
189+ />
190+ ) }
172191 { activeTab === 'settings' && < Settings /> }
173192 </ main >
174193 </ div >
0 commit comments