1- import { Fragment , useEffect , useMemo , useState } from "react" ;
1+ import { Fragment , useEffect , useMemo , useState } from "react" ;
22import { StreamDetail } from "./StreamDetail" ;
33import { ScalarSpecInline } from "./ScalarSpecInline" ;
44import { applyKindCanonicalization } from "../lib/streamKind" ;
@@ -11,9 +11,6 @@ const kindOptions: StreamKind[] = [
1111 "Common" ,
1212 "IsothermalFixed" ,
1313 "IsothermalVariable" ,
14- "MVR" ,
15- "MHP" ,
16- "RankineCycle" ,
1714] ;
1815const thermalOptions : ThermalKind [ ] = [ "hot" , "cold" ] ;
1916const flowUnits = [ "mol/s" , "kmol/h" , "kmol/s" ] as const ;
@@ -54,21 +51,22 @@ export function StreamTable(props: {
5451 } , [ visibleColumns ] ) ;
5552
5653 const panelSurface = "bg-white text-neutral-900 dark:bg-neutral-950/60 dark:text-neutral-100" ;
57- const stickyBg = "bg-white dark:bg-neutral-950/60 " ;
58- const headerBg = "bg-gray-50 dark:bg-neutral-900/60 " ;
54+ const stickyBg = "bg-white dark:bg-neutral-950" ;
55+ const headerBg = "bg-gray-50 dark:bg-neutral-900" ;
5956 const borderTone = "border-gray-200 dark:border-neutral-800" ;
6057 const cellTone = "border-neutral-300 bg-white text-neutral-900 placeholder:text-gray-400 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-100 dark:placeholder:text-neutral-600" ;
6158 const summaryColMinWidthPx = 184 ;
6259 const cellPad = "px-[0.375rem] py-[0.45rem]" ;
6360 const colW = {
61+ expand : "40px" ,
6462 name : "96px" ,
6563 type : "80px" ,
6664 kind : "120px" ,
67- actions : "120px " ,
65+ actions : "80px " ,
6866 } as const ;
6967 const fixedColsPx = ( s : string ) => ( s . endsWith ( "rem" ) ? Number . parseFloat ( s ) * 16 : Number . parseFloat ( s ) || 0 ) ;
70- const fixedMinWidthPx = fixedColsPx ( colW . name ) + fixedColsPx ( colW . type ) + fixedColsPx ( colW . kind ) + fixedColsPx ( colW . actions ) ;
71- const tableMinWidthPx = fixedMinWidthPx + ( 3 + extraColumns . length ) * summaryColMinWidthPx ;
68+ const fixedMinWidthPx = fixedColsPx ( colW . expand ) + fixedColsPx ( colW . name ) + fixedColsPx ( colW . type ) + fixedColsPx ( colW . kind ) ;
69+ const tableMinWidthPx = fixedMinWidthPx + ( 3 + extraColumns . length ) * summaryColMinWidthPx + fixedColsPx ( colW . actions ) ;
7270
7371 function applySpecUpdate ( s : StreamRowUI , key : "F" | "Tin" | "Tout" , nextSpec : ScalarSpecUI ) : StreamRowUI {
7472 let spec = nextSpec ;
@@ -94,6 +92,7 @@ export function StreamTable(props: {
9492 style = { { minWidth : `${ tableMinWidthPx } px` } }
9593 >
9694 < colgroup >
95+ < col style = { { width : colW . expand } } />
9796 < col style = { { width : colW . name } } />
9897 < col style = { { width : colW . type } } />
9998 < col style = { { width : colW . kind } } />
@@ -105,7 +104,8 @@ export function StreamTable(props: {
105104 </ colgroup >
106105 < thead className = { headerBg } >
107106 < tr className = "text-left" >
108- < th className = { `${ cellPad } sticky left-0 z-20 ${ headerBg } ` } > Name</ th >
107+ < th className = { `${ cellPad } sticky left-0 z-20 ${ headerBg } ` } > </ th >
108+ < th className = { `${ cellPad } sticky left-0 z-20 ${ headerBg } ` } style = { { left : colW . expand } } > Name</ th >
109109 < th className = { `${ cellPad } ${ headerBg } ` } > Type</ th >
110110 < th className = { `${ cellPad } ${ headerBg } ` } > Kind</ th >
111111 < th className = { `${ cellPad } ${ headerBg } ` } style = { { minWidth : `${ summaryColMinWidthPx } px` } } > F</ th >
@@ -114,7 +114,7 @@ export function StreamTable(props: {
114114 { extraColumns . map ( ( col ) => (
115115 < th key = { col . key } className = { `${ cellPad } ${ headerBg } ` } style = { { minWidth : `${ summaryColMinWidthPx } px` } } > { col . label } </ th >
116116 ) ) }
117- < th className = { `${ cellPad } sticky right-0 z-20 ${ headerBg } ` } > Actions </ th >
117+ < th className = { `${ cellPad } ${ headerBg } ` } > </ th >
118118 </ tr >
119119 </ thead >
120120 < tbody >
@@ -126,6 +126,23 @@ export function StreamTable(props: {
126126 < Fragment key = { s . id } >
127127 < tr className = { `${ active ? activeRow : baseRow } align-top` } >
128128 < td className = { `${ cellPad } sticky left-0 z-10 ${ stickyBg } ${ active ? activeRow : "" } ` } >
129+ < button
130+ className = "px-2 py-1 border rounded tone-button-muted"
131+ onClick = { ( e ) => {
132+ e . stopPropagation ( ) ;
133+ setExpanded ( ( prev ) => {
134+ const next = new Set ( prev ) ;
135+ if ( next . has ( s . id ) ) next . delete ( s . id ) ;
136+ else next . add ( s . id ) ;
137+ return next ;
138+ } ) ;
139+ } }
140+ title = { active ? "Collapse" : "Expand details" }
141+ >
142+ { active ? "▾" : "▸" }
143+ </ button >
144+ </ td >
145+ < td className = { `${ cellPad } sticky left-0 z-10 ${ stickyBg } ${ active ? activeRow : "" } ` } style = { { left : colW . expand } } >
129146 < input
130147 className = { `control-h w-full border rounded px-2 py-1 ${ cellTone } ` }
131148 value = { s . name }
@@ -206,23 +223,8 @@ export function StreamTable(props: {
206223 </ td >
207224 ) ) }
208225
209- < td className = { ` ${ cellPad } sticky right-0 z-10 ${ stickyBg } ${ active ? activeRow : "" } ` } >
226+ < td className = { cellPad } >
210227 < div className = "flex items-center gap-2" >
211- < button
212- className = "px-2 py-1 border rounded tone-button-muted"
213- onClick = { ( e ) => {
214- e . stopPropagation ( ) ;
215- setExpanded ( ( prev ) => {
216- const next = new Set ( prev ) ;
217- if ( next . has ( s . id ) ) next . delete ( s . id ) ;
218- else next . add ( s . id ) ;
219- return next ;
220- } ) ;
221- } }
222- title = { active ? "Collapse" : "Expand details" }
223- >
224- { active ? "▾" : "▸" }
225- </ button >
226228 < button
227229 className = "px-2 py-1 border rounded tone-button-muted"
228230 onClick = { ( e ) => {
@@ -253,7 +255,7 @@ export function StreamTable(props: {
253255 </ tr >
254256 { active ? (
255257 < tr className = "bg-white dark:bg-neutral-950" >
256- < td className = { `p-0 border-t ${ borderTone } ` } colSpan = { 7 + extraColumns . length } >
258+ < td className = { `p-0 border-t ${ borderTone } ` } colSpan = { 8 + extraColumns . length } >
257259 < div className = "sticky left-0 w-full max-w-[calc(100vw-2rem)]" >
258260 < StreamDetail
259261 stream = { s }
@@ -269,7 +271,7 @@ export function StreamTable(props: {
269271 } ) }
270272 { streams . length === 0 ? (
271273 < tr >
272- < td className = "p-3 text-gray-500 dark:text-neutral-400" colSpan = { 7 + extraColumns . length } > No streams. Add one.</ td >
274+ < td className = "p-3 text-gray-500 dark:text-neutral-400" colSpan = { 8 + extraColumns . length } > No streams. Add one.</ td >
273275 </ tr >
274276 ) : null }
275277 </ tbody >
0 commit comments