Skip to content

Commit ea0556f

Browse files
authored
Hide footer on Skills/Instructions tabs and remove Installed badge (#2926)
- Hide the Edit Site modal footer (Cancel/Save buttons) when the Skills or Instructions tab is active, since those tabs don't use the form submission flow - Remove the `InstalledBadge` component from both the Skills and Instructions panels, as items in the "Installed" section are already visually grouped under the "Installed" header
1 parent 67e9625 commit ea0556f

File tree

3 files changed

+28
-38
lines changed

3 files changed

+28
-38
lines changed

apps/studio/src/components/installed-badge.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

apps/studio/src/components/site-settings-panels.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { moreVertical } from '@wordpress/icons';
33
import { useI18n } from '@wordpress/react-i18n';
44
import { useCallback, useEffect, useMemo, useState } from 'react';
55
import Button from 'src/components/button';
6-
import { InstalledBadge } from 'src/components/installed-badge';
76
import { getIpcApi } from 'src/lib/get-ipc-api';
87
import {
98
INSTRUCTION_FILES,
@@ -115,12 +114,7 @@ export function AgentInstructionsPanel( { siteId }: { siteId: string } ) {
115114
className="flex items-center justify-between px-3 py-2.5 border-b border-frame-border last:border-b-0"
116115
>
117116
<div className="flex-1 min-w-0 pr-3">
118-
<div className="flex items-center gap-2">
119-
<span className="text-sm font-medium text-frame-text">
120-
{ config.displayName }
121-
</span>
122-
<InstalledBadge />
123-
</div>
117+
<div className="text-sm font-medium text-frame-text">{ config.displayName }</div>
124118
<div className="text-xs text-frame-text-secondary">
125119
{ __( config.description ) }
126120
</div>
@@ -317,10 +311,7 @@ export function WordPressSkillsPanel( { siteId }: { siteId: string } ) {
317311
className="flex items-center justify-between px-3 py-2.5 border-b border-frame-border last:border-b-0"
318312
>
319313
<div className="flex-1 min-w-0 pr-3">
320-
<div className="flex items-center gap-2">
321-
<span className="text-sm font-medium text-frame-text">{ skill.displayName }</span>
322-
<InstalledBadge />
323-
</div>
314+
<div className="text-sm font-medium text-frame-text">{ skill.displayName }</div>
324315
<div className="text-xs text-frame-text-secondary">{ skill.description }</div>
325316
</div>
326317
<DropdownMenu

apps/studio/src/modules/site-settings/edit-site-details.tsx

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { SelectControl, TabPanel } from '@wordpress/components';
1515
import { createInterpolateElement } from '@wordpress/element';
1616
import { sprintf } from '@wordpress/i18n';
1717
import { useI18n } from '@wordpress/react-i18n';
18-
import { FormEvent, useCallback, useEffect, useState } from 'react';
18+
import { FormEvent, useCallback, useEffect, useMemo, useState } from 'react';
1919
import Button from 'src/components/button';
2020
import { ErrorInformation } from 'src/components/error-information';
2121
import { 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

Comments
 (0)