Skip to content
Open
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
1 change: 0 additions & 1 deletion src/ipc-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ type IpcApi = {

interface FeatureFlags {
enableBlueprints: boolean;
streamlineOnboarding: boolean;
}

interface BetaFeatures {
Expand Down
6 changes: 0 additions & 6 deletions src/lib/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ export const FEATURE_FLAGS_DEFINITION: Record< keyof FeatureFlags, FeatureFlagDe
flag: 'enableBlueprints',
default: true,
},
streamlineOnboarding: {
label: 'Streamline Onboarding',
env: 'STREAMLINE_ONBOARDING',
flag: 'streamlineOnboarding',
default: false,
},
} as const;

export const FEATURE_FLAGS: Record< keyof FeatureFlags, FeatureFlagDefinition > =
Expand Down
58 changes: 8 additions & 50 deletions src/modules/sync/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export function ContentTabSync( { selectedSite }: { selectedSite: SiteDetails }
const [ disconnectSite ] = useDisconnectSiteMutation();
const { pushSite, pullSite, isAnySitePulling, isAnySitePushing } = useSyncSites();
const isAnySiteSyncing = isAnySitePulling || isAnySitePushing;
const { streamlineOnboarding } = useFeatureFlags();

const [ selectedRemoteSite, setSelectedRemoteSite ] = useState< SyncSite | null >( null );
const [ pendingModalMode, setPendingModalMode ] = useState< 'push' | 'pull' | null >( null );
Expand Down Expand Up @@ -214,55 +213,14 @@ export function ContentTabSync( { selectedSite }: { selectedSite: SiteDetails }
</div>
) : (
<SiteSyncDescription>
{ streamlineOnboarding ? (
<div className="mt-8 flex flex-wrap gap-4">
<ConnectButton
variant="primary"
icon={ cloudUpload }
connectSite={ () => setPendingModalMode( 'push' ) }
disabled={ isAnySiteSyncing || pendingModalMode !== null }
isBusy={ pendingModalMode === 'push' }
tooltipText={
pendingModalMode === 'pull'
? __( 'Please wait for the current operation to finish.' )
: isAnySiteSyncing
? __(
'Another site is syncing. Please wait for the sync to finish before you publish your site.'
)
: __( 'Publishing your site requires an internet connection.' )
}
>
{ __( 'Publish site' ) }
</ConnectButton>
<ConnectButton
variant="secondary"
connectSite={ () => setPendingModalMode( 'pull' ) }
className={ isAnySiteSyncing ? '' : '!text-a8c-blue-50 !shadow-a8c-blue-50' }
disabled={ isAnySiteSyncing || pendingModalMode !== null }
isBusy={ pendingModalMode === 'pull' }
tooltipText={
pendingModalMode === 'push'
? __( 'Please wait for the current operation to finish.' )
: isAnySiteSyncing
? __(
'Another site is syncing. Please wait for the sync to finish before you pull a site.'
)
: __( 'Importing a remote site requires an internet connection.' )
}
>
{ __( 'Pull site' ) }
</ConnectButton>
</div>
) : (
<div className="mt-8">
<ConnectButton
variant="primary"
connectSite={ () => dispatch( connectedSitesActions.openModal( 'connect' ) ) }
>
{ __( 'Connect site' ) }
</ConnectButton>
</div>
) }
<div className="mt-8">
<ConnectButton
variant="primary"
connectSite={ () => dispatch( connectedSitesActions.openModal( 'connect' ) ) }
>
{ __( 'Connect site' ) }
</ConnectButton>
</div>
</SiteSyncDescription>
) }

Expand Down
45 changes: 0 additions & 45 deletions src/modules/sync/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ describe( 'ContentTabSync', () => {
( useAuth as jest.Mock ).mockReturnValue( createAuthMock( false ) );
( useFeatureFlags as jest.Mock ).mockReturnValue( {
enableBlueprints: true,
streamlineOnboarding: false,
} );
( getIpcApi as jest.Mock ).mockReturnValue( {
authenticate: jest.fn(),
Expand Down Expand Up @@ -258,35 +257,6 @@ describe( 'ContentTabSync', () => {
expect( getIpcApi().authenticate ).toHaveBeenCalled();
} );

it( 'displays publish and import actions to authenticated user', () => {
( useAuth as jest.Mock ).mockReturnValue( createAuthMock( true ) );
( useFeatureFlags as jest.Mock ).mockReturnValue( {
enableBlueprints: true,
streamlineOnboarding: true,
} );
renderWithProvider( <ContentTabSync selectedSite={ selectedSite } /> );
const publishButton = screen.getByRole( 'button', { name: /Publish site/i } );
const importButton = screen.getByRole( 'button', { name: /Pull site/i } );

expect( publishButton ).toBeInTheDocument();
expect( importButton ).toBeInTheDocument();
} );

it( 'opens the site selector modal when clicking "Pull site" button', async () => {
( useAuth as jest.Mock ).mockReturnValue( createAuthMock( true ) );
( useFeatureFlags as jest.Mock ).mockReturnValue( {
enableBlueprints: true,
streamlineOnboarding: true,
} );
setupConnectedSitesMocks( [], [ fakeSyncSite ] );

renderWithProvider( <ContentTabSync selectedSite={ selectedSite } /> );
const pullSiteButton = await screen.findByRole( 'button', { name: 'Pull site' } );
fireEvent.click( pullSiteButton );

expect( await screen.findByTestId( 'sync-sites-modal-selector' ) ).toBeInTheDocument();
} );

it( 'displays the list of connected sites', async () => {
( useAuth as jest.Mock ).mockReturnValue( createAuthMock( true ) );
setupConnectedSitesMocks( [ fakeSyncSite ], [ fakeSyncSite ] );
Expand Down Expand Up @@ -341,21 +311,6 @@ describe( 'ContentTabSync', () => {
expect( createNewSiteButton ).toBeInTheDocument();
} );

it( 'displays publish and import buttons when there are no connected sites', () => {
( useAuth as jest.Mock ).mockReturnValue( createAuthMock( true ) );
( useFeatureFlags as jest.Mock ).mockReturnValue( {
enableBlueprints: true,
streamlineOnboarding: true,
} );
renderWithProvider( <ContentTabSync selectedSite={ selectedSite } /> );

const publishButton = screen.getByRole( 'button', { name: /Publish site/i } );
const importButton = screen.getByRole( 'button', { name: /Pull site/i } );

expect( publishButton ).toBeInTheDocument();
expect( importButton ).toBeInTheDocument();
} );

it( 'displays environment badges for Pressable sites with production, staging and development environments', async () => {
const fakePressableProductionSite: SyncSite = {
id: 6,
Expand Down