Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hide manage site button for detached domains #97799

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,22 @@ const DomainOverviewPane = ( {

const PreviewPaneHeaderButtons = ( { focusRef, closeSitePreviewPane }: BtnProps ) => {
const adminButtonRef = useRef< HTMLButtonElement | null >( null );

const mergedRef = useMergeRefs( [ adminButtonRef, focusRef ] );
return (
<>
<Button onClick={ closeSitePreviewPane } className="button item-view__close-button">
{ __( 'Close' ) }
</Button>
<Button
primary
className="button item-preview__admin-button"
href={ adminUrl }
ref={ useMergeRefs( [ adminButtonRef, focusRef ] ) }
>
{ translate( 'Manage site' ) }
</Button>
{ ! site.options?.is_domain_only && (
<Button
primary
className="button item-preview__admin-button"
href={ adminUrl }
ref={ mergedRef }
>
{ translate( 'Manage site' ) }
</Button>
) }
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ describe( 'DomainOverviewPane', () => {
expect( screen.getByText( 'Manage site' ) ).toBeInTheDocument();
} );

it( 'does not show Manage Site button when domain only and unattached', () => {
const siteProps = {
...defaultProps,
site: {
...defaultProps.site,
options: {
...defaultProps.site.options,
is_domain_only: true,
},
},
};
renderComponent( siteProps );
expect( screen.queryByText( 'Manage site' ) ).not.toBeInTheDocument();
} );

it( 'handles tab switching', () => {
renderComponent();
fireEvent.click( screen.getByText( 'Email' ) );
Expand Down
Loading