1
1
import React , { useState , useCallback , useEffect } from "react" ;
2
2
import type * as Monaco from "monaco-editor" ;
3
3
import { useKeyPressEvent } from "react-use" ;
4
- import { Database , Play , Save , Settings , ChevronRight , ChevronDown , Server , Table , Plus , X , PanelLeftClose , PanelLeft , CheckCircle2 , Clock } from "lucide-react" ;
4
+ import { Database , Play , Save , Settings , ChevronRight , ChevronDown , Server , Table , Plus , X , CheckCircle2 , Clock } from "lucide-react" ;
5
5
import Editor from "@monaco-editor/react" ;
6
6
import { Button } from "@/components/ui/button" ;
7
7
import { ResizeHandle } from "@/components/resize-handle" ;
@@ -72,7 +72,7 @@ function ServerSidebar({
72
72
const connectionStatus = status [ projectId ] ;
73
73
const projectSchemas = schemas [ projectId ] || [ ] ;
74
74
const isProjectExpanded = expandedProjects [ projectId ] ?? ( connectionStatus === ProjectConnectionStatus . Connected ) ;
75
-
75
+
76
76
return (
77
77
< div key = { projectId } >
78
78
{ /* Server/Project Level */ }
@@ -104,17 +104,21 @@ function ServerSidebar({
104
104
{ isProjectExpanded && (
105
105
< div >
106
106
{ /* Database Level */ }
107
- < button
108
- onClick = { ( ) => onConnect ( projectId ) }
107
+ < div
109
108
className = { cn (
110
109
"flex w-full items-center gap-2 px-2 py-1.5 text-left text-sm hover:bg-sidebar-accent" ,
111
- "transition-colors rounded-sm"
110
+ "transition-colors rounded-sm cursor-pointer "
112
111
) }
113
112
style = { { paddingLeft : "20px" } }
114
113
>
115
- < span className = "w-3" />
116
- < span className = "text-muted-foreground" > < Database className = "h-4 w-4" /> </ span >
117
- < span className = "flex-1 font-mono text-xs" > { details [ 3 ] } </ span >
114
+ < button
115
+ onClick = { ( ) => onConnect ( projectId ) }
116
+ className = "flex items-center gap-2 flex-1"
117
+ >
118
+ < span className = "w-3" />
119
+ < span className = "text-muted-foreground" > < Database className = "h-4 w-4" /> </ span >
120
+ < span className = "font-mono text-xs" > { details [ 3 ] } </ span >
121
+ </ button >
118
122
< div className = "flex gap-1" >
119
123
< Button
120
124
variant = "ghost"
@@ -133,7 +137,7 @@ function ServerSidebar({
133
137
< X className = "h-3 w-3" />
134
138
</ Button >
135
139
</ div >
136
- </ button >
140
+ </ div >
137
141
138
142
{ /* Schema Level */ }
139
143
{ connectionStatus === ProjectConnectionStatus . Connected && projectSchemas . map ( ( schema ) => {
@@ -206,7 +210,7 @@ function ServerSidebar({
206
210
}
207
211
208
212
export default function App ( ) {
209
- const [ sidebarOpen , setSidebarOpen ] = useState ( true ) ;
213
+ const sidebarOpen = true ;
210
214
const [ sidebarWidth , setSidebarWidth ] = useState ( 280 ) ;
211
215
const [ editorHeight , setEditorHeight ] = useState ( 50 ) ;
212
216
const [ connectionModalOpen , setConnectionModalOpen ] = useState ( false ) ;
@@ -539,15 +543,6 @@ export default function App() {
539
543
</ div >
540
544
541
545
< div className = "flex flex-1 overflow-hidden" >
542
- < Button
543
- variant = "ghost"
544
- size = "icon"
545
- className = "absolute left-2 top-16 z-10 h-8 w-8"
546
- onClick = { ( ) => setSidebarOpen ( ! sidebarOpen ) }
547
- >
548
- { sidebarOpen ? < PanelLeftClose className = "h-4 w-4 text-white" /> : < PanelLeft className = "h-4 w-4 text-white" /> }
549
- </ Button >
550
-
551
546
{ sidebarOpen && (
552
547
< >
553
548
< div style = { { width : `${ sidebarWidth } px` } } className = "flex-shrink-0" >
@@ -608,12 +603,18 @@ export default function App() {
608
603
</ Button >
609
604
</ div >
610
605
{ /* SQL Editor */ }
611
- < div className = "relative flex-1 overflow-hidden bg-[var(--color-editor-bg)]" >
612
- < div className = "absolute inset-0 overflow-auto" >
606
+ < div className = "relative flex-1 overflow-hidden bg-[var(--color-editor-bg)]" suppressHydrationWarning >
607
+ < div className = "absolute inset-0 overflow-auto bg-[#1e1e1e] " >
613
608
< Editor
614
609
height = "100%"
615
610
defaultLanguage = "pgsql"
616
611
language = "pgsql"
612
+ theme = "vs-dark"
613
+ loading = {
614
+ < div className = "flex h-full w-full items-center justify-center bg-[#1e1e1e]" >
615
+ < span className = "text-muted-foreground text-sm" > Loading editor...</ span >
616
+ </ div >
617
+ }
617
618
beforeMount = { registerContextAwareCompletions }
618
619
options = { {
619
620
automaticLayout : true ,
0 commit comments