Skip to content

Commit

Permalink
A4A > Migrations: Remove feature flag logic
Browse files Browse the repository at this point in the history
  • Loading branch information
yashwin authored Jan 13, 2025
1 parent 1ceb527 commit 2953316
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const useMainMenuItems = ( path: string ) => {

const menuItems = useMemo( () => {
const isAutomatedReferralsEnabled = config.isEnabled( 'a4a-automated-referrals' );
const isTrackingSiteMigrationsEnabled = config.isEnabled( 'a4a-tracking-site-migrations' );

let referralItems = [] as any[];

Expand Down Expand Up @@ -74,30 +73,18 @@ const useMainMenuItems = ( path: string ) => {
];
}

let migrationMenuItem = {};

if ( isSectionNameEnabled( 'a8c-for-agencies-migrations' ) ) {
migrationMenuItem = isTrackingSiteMigrationsEnabled
? {
icon: moveTo,
path: A4A_MIGRATIONS_LINK,
link: A4A_MIGRATIONS_OVERVIEW_LINK,
title: translate( 'Migrations' ),
trackEventProps: {
menu_item: 'Automattic for Agencies / Migrations',
},
withChevron: true,
}
: {
icon: moveTo,
path: '/',
link: A4A_MIGRATIONS_LINK,
title: translate( 'Migrations' ),
trackEventProps: {
menu_item: 'Automattic for Agencies / Migrations',
},
};
}
const migrationMenuItem = isSectionNameEnabled( 'a8c-for-agencies-migrations' )
? {
icon: moveTo,
path: A4A_MIGRATIONS_LINK,
link: A4A_MIGRATIONS_OVERVIEW_LINK,
title: translate( 'Migrations' ),
trackEventProps: {
menu_item: 'Automattic for Agencies / Migrations',
},
withChevron: true,
}
: {};

return [
{
Expand Down
2 changes: 1 addition & 1 deletion client/a8c-for-agencies/sections/migrations/controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const migrationsOverviewContext: Callback = ( context, next ) => {
context.primary = (
<>
<PageViewTracker title="Migrations > Overview" path={ context.path } />
<MigrationsOverviewV2 isSiteMigrationsEnabled />
<MigrationsOverviewV2 />
</>
);
context.secondary = <MigrationsSidebar path={ context.path } />;
Expand Down
83 changes: 36 additions & 47 deletions client/a8c-for-agencies/sections/migrations/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isEnabled } from '@automattic/calypso-config';
import page from '@automattic/calypso-router';
import {
A4A_MIGRATIONS_LINK,
Expand All @@ -13,50 +12,40 @@ import { makeLayout, render as clientRender } from 'calypso/controller';
import * as controller from './controller';

export default function () {
if ( isEnabled( 'a4a-tracking-site-migrations' ) ) {
page(
A4A_MIGRATIONS_OVERVIEW_LINK,
requireAccessContext,
controller.migrationsOverviewContext,
makeLayout,
clientRender
);
page(
A4A_MIGRATIONS_MIGRATE_TO_PRESSABLE_LINK,
requireAccessContext,
controller.migrateToPressableContext,
makeLayout,
clientRender
);
page(
A4A_MIGRATIONS_MIGRATE_TO_WPCOM_LINK,
requireAccessContext,
controller.migrateToWpcomContext,
makeLayout,
clientRender
);
page(
A4A_MIGRATIONS_COMMISSIONS_LINK,
requireAccessContext,
controller.migrationsCommissionsContext,
makeLayout,
clientRender
);
page(
A4A_MIGRATIONS_PAYMENT_SETTINGS,
requireAccessContext,
controller.migrationsPaymentSettingsContext,
makeLayout,
clientRender
);
page( A4A_MIGRATIONS_LINK, () => page.redirect( A4A_MIGRATIONS_OVERVIEW_LINK ) );
} else {
page(
A4A_MIGRATIONS_LINK,
requireAccessContext,
controller.migrationsContext,
makeLayout,
clientRender
);
}
page(
A4A_MIGRATIONS_OVERVIEW_LINK,
requireAccessContext,
controller.migrationsOverviewContext,
makeLayout,
clientRender
);
page(
A4A_MIGRATIONS_MIGRATE_TO_PRESSABLE_LINK,
requireAccessContext,
controller.migrateToPressableContext,
makeLayout,
clientRender
);
page(
A4A_MIGRATIONS_MIGRATE_TO_WPCOM_LINK,
requireAccessContext,
controller.migrateToWpcomContext,
makeLayout,
clientRender
);
page(
A4A_MIGRATIONS_COMMISSIONS_LINK,
requireAccessContext,
controller.migrationsCommissionsContext,
makeLayout,
clientRender
);
page(
A4A_MIGRATIONS_PAYMENT_SETTINGS,
requireAccessContext,
controller.migrationsPaymentSettingsContext,
makeLayout,
clientRender
);
page( A4A_MIGRATIONS_LINK, () => page.redirect( A4A_MIGRATIONS_OVERVIEW_LINK ) );
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { Button } from '@wordpress/components';
import { useTranslate } from 'i18n-calypso';
import { useCallback } from 'react';
import { CONTACT_URL_FOR_MIGRATION_OFFER_HASH_FRAGMENT } from 'calypso/a8c-for-agencies/components/a4a-contact-support-widget';
import { LayoutWithGuidedTour as Layout } from 'calypso/a8c-for-agencies/components/layout/layout-with-guided-tour';
import LayoutTop from 'calypso/a8c-for-agencies/components/layout/layout-with-payment-notification';
import MobileSidebarNavigation from 'calypso/a8c-for-agencies/components/sidebar/mobile-sidebar-navigation';
Expand All @@ -10,8 +7,6 @@ import LayoutHeader, {
LayoutHeaderTitle as Title,
LayoutHeaderActions as Actions,
} from 'calypso/layout/hosting-dashboard/header';
import { useDispatch } from 'calypso/state';
import { recordTracksEvent } from 'calypso/state/analytics/actions';
import MigrateSiteButton from './migrate-site-button';
import MigrationsBanner from './sections/migrations-banner';
import MigrationsClientRelationship from './sections/migrations-client-relationship';
Expand All @@ -24,39 +19,19 @@ import MigrationsTestimonials from './sections/migrations-testimonials';

import './style.scss';

export default function MigrationsOverviewV2( {
isSiteMigrationsEnabled = false,
}: {
isSiteMigrationsEnabled?: boolean;
} ) {
export default function MigrationsOverviewV2() {
const translate = useTranslate();
const dispatch = useDispatch();

const title = translate( 'Migrations' );

const onMigrateSitesClick = useCallback( () => {
dispatch( recordTracksEvent( 'calypso_a4a_migrations_migrate_sites_button_click' ) );
}, [ dispatch ] );

return (
<Layout className="migrations-overview-v2" title={ title } wide>
<LayoutTop>
<LayoutHeader>
<Title>{ title }</Title>
<Actions>
<MobileSidebarNavigation />

{ isSiteMigrationsEnabled ? (
<MigrateSiteButton />
) : (
<Button
variant="primary"
onClick={ onMigrateSitesClick }
href={ CONTACT_URL_FOR_MIGRATION_OFFER_HASH_FRAGMENT }
>
{ translate( 'Migrate your sites' ) }
</Button>
) }
<MigrateSiteButton />
</Actions>
</LayoutHeader>
</LayoutTop>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import config from '@automattic/calypso-config';
import { useTranslate } from 'i18n-calypso';
import { useCallback } from 'react';
import PageSection from 'calypso/a8c-for-agencies/components/page-section';
import {
A4A_MIGRATIONS_PAYMENT_SETTINGS,
A4A_REFERRALS_PAYMENT_SETTINGS,
} from 'calypso/a8c-for-agencies/components/sidebar-menu/lib/constants';
import { A4A_MIGRATIONS_PAYMENT_SETTINGS } from 'calypso/a8c-for-agencies/components/sidebar-menu/lib/constants';
import FoldableFAQ from 'calypso/components/foldable-faq';
import { useDispatch } from 'calypso/state';
import { recordTracksEvent } from 'calypso/state/analytics/actions';
Expand Down Expand Up @@ -153,11 +149,7 @@ export default function MigrationsFAQs() {
),
PaymentSettingLink: (
<a
href={
config.isEnabled( 'a4a-tracking-site-migrations' )
? A4A_MIGRATIONS_PAYMENT_SETTINGS
: A4A_REFERRALS_PAYMENT_SETTINGS
}
href={ A4A_MIGRATIONS_PAYMENT_SETTINGS }
onClick={ () =>
dispatch(
recordTracksEvent( 'calypso_a4a_migrations_payment_setting_link_click' )
Expand Down
1 change: 0 additions & 1 deletion config/a8c-for-agencies-development.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"a4a-migrations-page-v2": true,
"a8c-for-agencies-agency-tier": true,
"a4a-pressable-referrals": true,
"a4a-tracking-site-migrations": true,
"a4a-updated-add-new-site": true
},
"enable_all_sections": false,
Expand Down
1 change: 0 additions & 1 deletion config/a8c-for-agencies-horizon.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"a4a-migrations-page-v2": true,
"a8c-for-agencies-agency-tier": true,
"a4a-pressable-referrals": true,
"a4a-tracking-site-migrations": true,
"a4a-updated-add-new-site": true
},
"enable_all_sections": false,
Expand Down
3 changes: 1 addition & 2 deletions config/a8c-for-agencies-production.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"a4a-dev-sites": true,
"a4a-migrations-page-v2": true,
"a8c-for-agencies-agency-tier": true,
"a4a-pressable-referrals": true,
"a4a-tracking-site-migrations": true
"a4a-pressable-referrals": true
},
"enable_all_sections": false,
"sections": {
Expand Down
1 change: 0 additions & 1 deletion config/a8c-for-agencies-stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"a4a-migrations-page-v2": true,
"a8c-for-agencies-agency-tier": true,
"a4a-pressable-referrals": true,
"a4a-tracking-site-migrations": true,
"a4a-updated-add-new-site": true
},
"enable_all_sections": false,
Expand Down

0 comments on commit 2953316

Please sign in to comment.