@@ -22,20 +22,6 @@ const UploadIcon = () => (
2222 </ svg >
2323) ;
2424
25- function getSSEStatusClass ( status : ExportedSSE [ "status" ] ) : string {
26- switch ( status ) {
27- case "connected" :
28- return "success" ;
29- case "error" :
30- return "error" ;
31- case "connecting" :
32- return "pending" ;
33- case "disconnected" :
34- default :
35- return "neutral" ;
36- }
37- }
38-
3925function getSSEDuration ( sub : ExportedSSE ) : string {
4026 if ( sub . status === "connecting" ) return "connecting..." ;
4127
@@ -56,27 +42,38 @@ const ImportTraceRow: Component<{
5642 const isAborted = ( ) => ! ! response ( ) ?. aborted ;
5743 const hasError = ( ) => ! ! response ( ) ?. error && ! isAborted ( ) ;
5844
59- const statusClass = ( ) => {
60- if ( isAborted ( ) ) return "aborted" ;
61- if ( hasError ( ) ) return "error" ;
62- return "success" ;
63- } ;
64-
6545 const parsed = ( ) => parseQueryKey ( props . trace . queryKey ) ;
6646 const timestamp = ( ) => formatTime ( props . trace . timestamp ) ;
6747
68- const statusBorderClass = ( ) => {
69- const cls = statusClass ( ) ;
70- if ( cls === "error" ) return "border-l-spoosh-error" ;
71- if ( cls === "aborted" ) return "border-l-spoosh-warning" ;
72- return "border-l-spoosh-success" ;
48+ const cardClasses = ( ) => {
49+ const base = "px-3 py-2 cursor-pointer border-l-2 transition-all" ;
50+
51+ // Error state styling
52+ if ( hasError ( ) ) {
53+ if ( props . isSelected ) {
54+ return `${ base } bg-spoosh-error/15 border-l-spoosh-error shadow-[inset_0_0_0_1px_rgba(248,81,73,0.3)]` ;
55+ }
56+ return `${ base } bg-spoosh-error/5 border-l-spoosh-error hover:bg-spoosh-error/10` ;
57+ }
58+
59+ // Aborted state styling
60+ if ( isAborted ( ) ) {
61+ if ( props . isSelected ) {
62+ return `${ base } bg-spoosh-warning/15 border-l-spoosh-warning shadow-[inset_0_0_0_1px_rgba(210,153,34,0.3)]` ;
63+ }
64+ return `${ base } bg-spoosh-warning/5 border-l-spoosh-warning hover:bg-spoosh-warning/10` ;
65+ }
66+
67+ // Success/normal state styling
68+ if ( props . isSelected ) {
69+ return `${ base } bg-spoosh-primary/15 border-l-spoosh-primary shadow-[inset_0_0_0_1px_rgba(88,166,255,0.3)]` ;
70+ }
71+
72+ return `${ base } border-l-transparent hover:bg-spoosh-surface` ;
7373 } ;
7474
7575 return (
76- < div
77- class = { `px-3 py-2 cursor-pointer border-b border-spoosh-border border-l-2 hover:bg-spoosh-hover transition-colors ${ statusBorderClass ( ) } ${ props . isSelected ? "bg-spoosh-hover" : "" } ` }
78- onClick = { ( ) => props . onSelect ( props . trace . id ) }
79- >
76+ < div class = { cardClasses ( ) } onClick = { ( ) => props . onSelect ( props . trace . id ) } >
8077 < div class = "flex items-center gap-2 mb-1" >
8178 < span
8279 class = { `px-1.5 py-0.5 text-2xs font-semibold rounded uppercase method-${ props . trace . method } ` }
@@ -107,23 +104,50 @@ const ImportSSERow: Component<{
107104 isSelected : boolean ;
108105 onSelect : ( id : string ) => void ;
109106} > = ( props ) => {
110- const statusClass = ( ) => getSSEStatusClass ( props . sub . status ) ;
111107 const duration = ( ) => getSSEDuration ( props . sub ) ;
112108 const timestamp = ( ) => formatTime ( props . sub . timestamp ) ;
113109
114- const statusBorderClass = ( ) => {
115- const cls = statusClass ( ) ;
116- if ( cls === "error" ) return "border-l-spoosh-error" ;
117- if ( cls === "pending" ) return "border-l-spoosh-primary" ;
118- if ( cls === "success" ) return "border-l-spoosh-success" ;
119- return "border-l-spoosh-text-muted" ;
110+ const hasError = ( ) => props . sub . status === "error" ;
111+ const isConnecting = ( ) => props . sub . status === "connecting" ;
112+ const isConnected = ( ) => props . sub . status === "connected" ;
113+
114+ const cardClasses = ( ) => {
115+ const base = "px-3 py-2 cursor-pointer border-l-2 transition-all" ;
116+
117+ // Error state styling
118+ if ( hasError ( ) ) {
119+ if ( props . isSelected ) {
120+ return `${ base } bg-spoosh-error/15 border-l-spoosh-error shadow-[inset_0_0_0_1px_rgba(248,81,73,0.3)]` ;
121+ }
122+ return `${ base } bg-spoosh-error/5 border-l-spoosh-error hover:bg-spoosh-error/10` ;
123+ }
124+
125+ // Connecting state styling
126+ if ( isConnecting ( ) ) {
127+ if ( props . isSelected ) {
128+ return `${ base } bg-spoosh-primary/15 border-l-spoosh-primary shadow-[inset_0_0_0_1px_rgba(88,166,255,0.3)]` ;
129+ }
130+ return `${ base } border-l-spoosh-primary hover:bg-spoosh-surface` ;
131+ }
132+
133+ // Connected state styling (active connections)
134+ if ( isConnected ( ) ) {
135+ if ( props . isSelected ) {
136+ return `${ base } bg-spoosh-success/15 border-l-spoosh-success shadow-[inset_0_0_0_1px_rgba(63,185,80,0.3)]` ;
137+ }
138+ return `${ base } border-l-spoosh-success hover:bg-spoosh-surface` ;
139+ }
140+
141+ // Disconnected/normal state styling
142+ if ( props . isSelected ) {
143+ return `${ base } bg-spoosh-primary/15 border-l-spoosh-primary shadow-[inset_0_0_0_1px_rgba(88,166,255,0.3)]` ;
144+ }
145+
146+ return `${ base } border-l-transparent hover:bg-spoosh-surface` ;
120147 } ;
121148
122149 return (
123- < div
124- class = { `px-3 py-2 cursor-pointer border-b border-spoosh-border border-l-2 hover:bg-spoosh-hover transition-colors ${ statusBorderClass ( ) } ${ props . isSelected ? "bg-spoosh-hover" : "" } ` }
125- onClick = { ( ) => props . onSelect ( props . sub . id ) }
126- >
150+ < div class = { cardClasses ( ) } onClick = { ( ) => props . onSelect ( props . sub . id ) } >
127151 < div class = "flex items-center gap-2 mb-1" >
128152 < span class = "px-1.5 py-0.5 text-2xs font-semibold rounded uppercase method-sse" >
129153 SSE
@@ -171,26 +195,28 @@ export const ImportList: Component<ImportListProps> = (props) => {
171195 </ div >
172196 }
173197 >
174- < For each = { reversedItems ( ) } >
175- { ( item ) => (
176- < Show
177- when = { item . type === "sse" }
178- fallback = {
179- < ImportTraceRow
180- trace = { item as ExportedTrace }
198+ < div class = "divide-y divide-spoosh-border" >
199+ < For each = { reversedItems ( ) } >
200+ { ( item ) => (
201+ < Show
202+ when = { item . type === "sse" }
203+ fallback = {
204+ < ImportTraceRow
205+ trace = { item as ExportedTrace }
206+ isSelected = { item . id === props . selectedId }
207+ onSelect = { props . onSelect }
208+ />
209+ }
210+ >
211+ < ImportSSERow
212+ sub = { item as ExportedSSE }
181213 isSelected = { item . id === props . selectedId }
182214 onSelect = { props . onSelect }
183215 />
184- }
185- >
186- < ImportSSERow
187- sub = { item as ExportedSSE }
188- isSelected = { item . id === props . selectedId }
189- onSelect = { props . onSelect }
190- />
191- </ Show >
192- ) }
193- </ For >
216+ </ Show >
217+ ) }
218+ </ For >
219+ </ div >
194220 </ Show >
195221 </ div >
196222 ) ;
0 commit comments