-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
76 lines (70 loc) · 2.58 KB
/
Copy pathApp.tsx
File metadata and controls
76 lines (70 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { useEffect } from 'react'
import 'sonner/dist/styles.css'
import { Toaster } from 'sonner'
import { useStore } from './stores/useStore'
import { Sidebar } from './components/Sidebar'
import { SessionList } from './components/SessionList'
import { SessionDetail } from './components/SessionDetail'
import { TerminalPanel } from './components/TerminalPanel'
import { SettingsModal } from './components/SettingsModal'
import { ConfirmModal } from './components/ConfirmModal'
export function App() {
const loadSessions = useStore(s => s.loadSessions)
const loadProjectNames = useStore(s => s.loadProjectNames)
const loadInstalledTerminals = useStore(s => s.loadInstalledTerminals)
const showTerminal = useStore(s => s.showTerminal)
const terminalFullscreen = useStore(s => s.terminalFullscreen)
const theme = useStore(s => s.theme)
const detailSession = useStore(s => s.detailSession)
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme)
}, [])
useEffect(() => {
loadSessions()
loadProjectNames()
loadInstalledTerminals()
const unsub = window.api.onIndexReady(() => {
loadSessions()
loadProjectNames()
})
return unsub
}, [])
return (
<>
{terminalFullscreen && showTerminal ? (
<div className="flex h-screen flex-col">
<TerminalPanel fullscreen />
<SettingsModal />
<ConfirmModal />
</div>
) : (
<div className="flex h-screen flex-col">
<div className="flex flex-1 overflow-hidden">
<Sidebar />
<div className="relative flex-1 overflow-hidden">
<div
className="absolute inset-0 flex flex-col transition-transform duration-200 ease-[cubic-bezier(0.4,0,0.2,1)]"
style={{ transform: detailSession ? 'translateX(-30px)' : 'translateX(0)', opacity: detailSession ? 0 : 1, pointerEvents: detailSession ? 'none' : 'auto', zIndex: detailSession ? 0 : 1 }}
>
<SessionList />
</div>
{detailSession && (
<div
key={detailSession.id}
className="absolute inset-0 flex flex-col animate-slide-in"
style={{ zIndex: 2 }}
>
<SessionDetail />
</div>
)}
</div>
</div>
{showTerminal && <TerminalPanel />}
<SettingsModal />
<ConfirmModal />
</div>
)}
<Toaster position="top-center" richColors duration={2000} visibleToasts={3} offset="80px" />
</>
)
}