Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 8 additions & 29 deletions src/components/content-tab-sync.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useOffline } from '../hooks/use-offline';
import { getIpcApi } from '../lib/get-ipc-api';
import { ArrowIcon } from './arrow-icon';
import Button from './button';
import { ConnectButton, CreateButton } from './connect-create-buttons';
import { ConnectButton } from './connect-create-buttons';
import offlineIcon from './offline-icon';
import { SyncConnectedSites } from './sync-connected-sites';
import { SyncSitesModalSelector } from './sync-sites-modal-selector';
Expand Down Expand Up @@ -52,30 +52,6 @@ function SiteSyncDescription( { children }: PropsWithChildren ) {
);
}

function CreateConnectSite( {
openSitesSyncSelector,
selectedSite,
}: {
className?: string;
openSitesSyncSelector: () => void;
selectedSite: SiteDetails;
} ) {
const { __ } = useI18n();

return (
<div className="mt-8">
<div className="flex gap-4">
<ConnectButton
variant="primary"
connectSite={ openSitesSyncSelector }
disableConnectButtonStyle={ true }
/>
<CreateButton variant="secondary" selectedSite={ selectedSite } />
</div>
</div>
);
}

function NoAuthSyncTab() {
const isOffline = useOffline();
const { __ } = useI18n();
Expand Down Expand Up @@ -178,10 +154,13 @@ export function ContentTabSync( { selectedSite }: { selectedSite: SiteDetails }
/>
) : (
<SiteSyncDescription>
<CreateConnectSite
openSitesSyncSelector={ () => setIsSyncSitesSelectorOpen( true ) }
selectedSite={ selectedSite }
/>
<div className="mt-8">
<ConnectButton
variant="primary"
connectSite={ () => setIsSyncSitesSelectorOpen( true ) }
disableConnectButtonStyle={ true }
/>
</div>
</SiteSyncDescription>
) }

Expand Down
13 changes: 0 additions & 13 deletions src/components/tests/content-tab-sync.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,6 @@ describe( 'ContentTabSync', () => {
expect( getIpcApi().openURL ).toHaveBeenCalled();
} );

it( 'displays create new site button to authenticated user', () => {
( useAuth as jest.Mock ).mockReturnValue( { isAuthenticated: true, authenticate: jest.fn() } );
renderWithProvider( <ContentTabSync selectedSite={ selectedSite } /> );
const createSiteButton = screen.getByRole( 'button', { name: /Create new site/i } );
fireEvent.click( createSiteButton );

expect( screen.getByText( 'Sync with' ) ).toBeInTheDocument();
expect( createSiteButton ).toBeInTheDocument();
expect( getIpcApi().openURL ).toHaveBeenCalledWith(
'https://wordpress.com/setup/new-hosted-site?ref=studio&section=studio-sync&showDomainStep&studioSiteId=site-id'
);
} );

it( 'displays connect site button to authenticated user', () => {
( useAuth as jest.Mock ).mockReturnValue( { isAuthenticated: true, authenticate: jest.fn() } );
renderWithProvider( <ContentTabSync selectedSite={ selectedSite } /> );
Expand Down