@@ -79,7 +79,7 @@ const FULL_VIEWPORT_HEIGHT = '100vh';
79
79
const FULL_HEIGHT = '100%' ;
80
80
81
81
/** Default size for code panel. */
82
- const CODE_PANEL_DEFAULT_SIZE = 400 ;
82
+ const CODE_PANEL_DEFAULT_SIZE = '25%' ;
83
83
84
84
/** Minimum size for code panel. */
85
85
const CODE_PANEL_MIN_SIZE = 100 ;
@@ -167,9 +167,9 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
167
167
const [ shownPythonToolboxCategories , setShownPythonToolboxCategories ] = React . useState < Set < string > > ( new Set ( ) ) ;
168
168
const [ triggerPythonRegeneration , setTriggerPythonRegeneration ] = React . useState ( 0 ) ;
169
169
const [ leftCollapsed , setLeftCollapsed ] = React . useState ( false ) ;
170
- const [ codePanelSize , setCodePanelSize ] = React . useState < number > ( CODE_PANEL_DEFAULT_SIZE ) ;
170
+ const [ codePanelSize , setCodePanelSize ] = React . useState < string | number > ( CODE_PANEL_DEFAULT_SIZE ) ;
171
171
const [ codePanelCollapsed , setCodePanelCollapsed ] = React . useState ( false ) ;
172
- const [ codePanelExpandedSize , setCodePanelExpandedSize ] = React . useState < number > ( CODE_PANEL_DEFAULT_SIZE ) ;
172
+ const [ codePanelExpandedSize , setCodePanelExpandedSize ] = React . useState < string | number > ( CODE_PANEL_DEFAULT_SIZE ) ;
173
173
const [ codePanelAnimating , setCodePanelAnimating ] = React . useState ( false ) ;
174
174
const [ theme , setTheme ] = React . useState ( 'dark' ) ;
175
175
const [ languageInitialized , setLanguageInitialized ] = React . useState ( false ) ;
@@ -391,8 +391,11 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
391
391
setCodePanelSize ( codePanelExpandedSize ) ;
392
392
setCodePanelCollapsed ( false ) ;
393
393
} else {
394
- // Collapse to minimum size
395
- setCodePanelExpandedSize ( codePanelSize ) ;
394
+ // Collapse to minimum size - convert current size to pixels for storage
395
+ const currentSizePx = typeof codePanelSize === 'string'
396
+ ? ( parseFloat ( codePanelSize ) / 100 ) * window . innerWidth
397
+ : codePanelSize ;
398
+ setCodePanelExpandedSize ( currentSizePx ) ;
396
399
setCodePanelSize ( CODE_PANEL_MIN_SIZE ) ;
397
400
setCodePanelCollapsed ( true ) ;
398
401
}
@@ -687,7 +690,7 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
687
690
</ Content >
688
691
< div
689
692
style = { {
690
- width : `${ codePanelSize } px` ,
693
+ width : typeof codePanelSize === 'string' ? codePanelSize : `${ codePanelSize } px` ,
691
694
minWidth : CODE_PANEL_MIN_SIZE ,
692
695
height : '100%' ,
693
696
borderLeft : '1px solid #d9d9d9' ,
@@ -714,7 +717,11 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
714
717
715
718
const handleMouseMove = ( e : MouseEvent ) => {
716
719
const deltaX = startX - e . clientX ;
717
- const newWidth = Math . max ( CODE_PANEL_MIN_SIZE , startWidth + deltaX ) ;
720
+ // Convert startWidth to number if it's a percentage
721
+ const startWidthPx = typeof startWidth === 'string'
722
+ ? ( parseFloat ( startWidth ) / 100 ) * window . innerWidth
723
+ : startWidth ;
724
+ const newWidth = Math . max ( CODE_PANEL_MIN_SIZE , startWidthPx + deltaX ) ;
718
725
setCodePanelSize ( newWidth ) ;
719
726
// Update expanded size if not at minimum
720
727
if ( newWidth > CODE_PANEL_MIN_SIZE ) {
0 commit comments