@@ -15,7 +15,7 @@ import { SelectControl, TabPanel } from '@wordpress/components';
1515import { createInterpolateElement } from '@wordpress/element' ;
1616import { sprintf } from '@wordpress/i18n' ;
1717import { useI18n } from '@wordpress/react-i18n' ;
18- import { FormEvent , useCallback , useEffect , useState } from 'react' ;
18+ import { FormEvent , useCallback , useEffect , useMemo , useState } from 'react' ;
1919import Button from 'src/components/button' ;
2020import { ErrorInformation } from 'src/components/error-information' ;
2121import { LearnMoreLink , LearnHowLink } from 'src/components/learn-more' ;
@@ -110,6 +110,11 @@ const EditSiteDetails = ( { currentWpVersion, onSave }: EditSiteDetailsProps ) =
110110 const [ customDomainError , setCustomDomainError ] = useState ( '' ) ;
111111 const [ existingDomainNames , setExistingDomainNames ] = useState < string [ ] > ( [ ] ) ;
112112 const [ enableHttps , setEnableHttps ] = useState ( false ) ;
113+ const [ activeTab , setActiveTab ] = useState ( editModalInitialTab || 'general' ) ;
114+ const isFormTab = useMemo (
115+ ( ) => activeTab === 'general' || activeTab === 'debugging' ,
116+ [ activeTab ]
117+ ) ;
113118
114119 useEffect ( ( ) => {
115120 getIpcApi ( )
@@ -291,14 +296,18 @@ const EditSiteDetails = ( { currentWpVersion, onSave }: EditSiteDetailsProps ) =
291296 >
292297 < form onSubmit = { onSiteEdit } >
293298 < TabPanel
294- className = "w-full [&>[role=tabpanel]]:h-64 [&>[role=tabpanel]]:overflow-auto"
299+ className = { cx (
300+ 'w-full [&>[role=tabpanel]]:overflow-auto' ,
301+ isFormTab ? '[&>[role=tabpanel]]:h-64' : '[&>[role=tabpanel]]:h-80'
302+ ) }
295303 tabs = { [
296304 { name : 'general' , title : __ ( 'General' ) } ,
297305 { name : 'debugging' , title : __ ( 'Debugging' ) } ,
298306 { name : 'skills' , title : __ ( 'Skills' ) } ,
299307 { name : 'instructions' , title : __ ( 'Instructions' ) } ,
300308 ] }
301309 initialTabName = { editModalInitialTab }
310+ onSelect = { ( tabName : string ) => setActiveTab ( tabName ) }
302311 orientation = "horizontal"
303312 >
304313 { ( { name } ) => (
@@ -612,19 +621,21 @@ const EditSiteDetails = ( { currentWpVersion, onSave }: EditSiteDetailsProps ) =
612621 ) }
613622 </ TabPanel >
614623
615- < div className = "flex flex-row justify-end gap-x-5 mt-8 px-8" >
616- < Button onClick = { closeModal } disabled = { isEditingSite } variant = "tertiary" >
617- { __ ( 'Cancel' ) }
618- </ Button >
619- < Button
620- type = "submit"
621- variant = "primary"
622- isBusy = { isEditingSite }
623- disabled = { isEditingSite || isFormUnchanged || hasValidationErrors }
624- >
625- { getEditSiteButtonText ( ) }
626- </ Button >
627- </ div >
624+ { isFormTab && (
625+ < div className = "flex flex-row justify-end gap-x-5 mt-8 px-8" >
626+ < Button onClick = { closeModal } disabled = { isEditingSite } variant = "tertiary" >
627+ { __ ( 'Cancel' ) }
628+ </ Button >
629+ < Button
630+ type = "submit"
631+ variant = "primary"
632+ isBusy = { isEditingSite }
633+ disabled = { isEditingSite || isFormUnchanged || hasValidationErrors }
634+ >
635+ { getEditSiteButtonText ( ) }
636+ </ Button >
637+ </ div >
638+ ) }
628639 < div className = "components-popover__fallback-container" > </ div >
629640 </ form >
630641 </ Modal >
0 commit comments