@@ -79,7 +79,7 @@ const FULL_VIEWPORT_HEIGHT = '100vh';
7979const FULL_HEIGHT = '100%' ;
8080
8181/** Default size for code panel. */
82- const CODE_PANEL_DEFAULT_SIZE = 400 ;
82+ const CODE_PANEL_DEFAULT_SIZE = '25%' ;
8383
8484/** Minimum size for code panel. */
8585const CODE_PANEL_MIN_SIZE = 100 ;
@@ -167,9 +167,9 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
167167 const [ shownPythonToolboxCategories , setShownPythonToolboxCategories ] = React . useState < Set < string > > ( new Set ( ) ) ;
168168 const [ triggerPythonRegeneration , setTriggerPythonRegeneration ] = React . useState ( 0 ) ;
169169 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 ) ;
171171 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 ) ;
173173 const [ codePanelAnimating , setCodePanelAnimating ] = React . useState ( false ) ;
174174 const [ theme , setTheme ] = React . useState ( 'dark' ) ;
175175 const [ languageInitialized , setLanguageInitialized ] = React . useState ( false ) ;
@@ -391,8 +391,11 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
391391 setCodePanelSize ( codePanelExpandedSize ) ;
392392 setCodePanelCollapsed ( false ) ;
393393 } 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 ) ;
396399 setCodePanelSize ( CODE_PANEL_MIN_SIZE ) ;
397400 setCodePanelCollapsed ( true ) ;
398401 }
@@ -687,7 +690,7 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
687690 </ Content >
688691 < div
689692 style = { {
690- width : `${ codePanelSize } px` ,
693+ width : typeof codePanelSize === 'string' ? codePanelSize : `${ codePanelSize } px` ,
691694 minWidth : CODE_PANEL_MIN_SIZE ,
692695 height : '100%' ,
693696 borderLeft : '1px solid #d9d9d9' ,
@@ -714,7 +717,11 @@ const AppContent: React.FC<AppContentProps> = ({ project, setProject }): React.J
714717
715718 const handleMouseMove = ( e : MouseEvent ) => {
716719 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 ) ;
718725 setCodePanelSize ( newWidth ) ;
719726 // Update expanded size if not at minimum
720727 if ( newWidth > CODE_PANEL_MIN_SIZE ) {
0 commit comments