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

Plans Grid: enable accordion view as non-experimental #47491

Merged
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 @@ -19,7 +19,6 @@ import './styles.scss';
const PlanStep: React.FunctionComponent< LaunchStepProps > = ( { onPrevStep, onNextStep } ) => {
const domain = useSelect( ( select ) => select( LAUNCH_STORE ).getSelectedDomain() );
const LaunchStep = useSelect( ( select ) => select( LAUNCH_STORE ).getLaunchStep() );
const { isExperimental } = useSelect( ( select ) => select( LAUNCH_STORE ).getState() );

const { updatePlan, setStep } = useDispatch( LAUNCH_STORE );

Expand Down Expand Up @@ -68,7 +67,7 @@ const PlanStep: React.FunctionComponent< LaunchStepProps > = ( { onPrevStep, onN
}
: undefined
}
isExperimental={ isExperimental }
isAccordion
selectedFeatures={ selectedFeatures }
locale={ window.wpcomEditorSiteLaunch?.locale || 'en' }
/>
Expand Down
43 changes: 17 additions & 26 deletions client/landing/gutenboarding/hooks/use-step-navigation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* External dependencies
*/
import { isEnabled } from 'calypso/config';
import { useHistory } from 'react-router-dom';
import { useSelect, useDispatch } from '@wordpress/data';
import { useI18n } from '@automattic/react-i18n';
Expand Down Expand Up @@ -32,34 +31,26 @@ export default function useStepNavigation(): { goBack: () => void; goNext: () =>
const currentStep = useCurrentStep();
const { i18nLocale } = useI18n();

// If the user enters a site title on Intent Capture step we are showing Domains step next.
// Else, we're showing Domains step before Plans step.
let steps: StepType[];

// If site title is skipped, we're showing Domains step before Features step. If not, we are showing Domains step next.
steps = hasSiteTitle()
? [ Step.IntentGathering, Step.Domains, Step.DesignSelection, Step.Style, Step.Plans ]
: [ Step.IntentGathering, Step.DesignSelection, Step.Style, Step.Domains, Step.Plans ];

// When feature picker experiment is enabled, if site title is skipped, we're showing Domains step before Features step.
if ( isEnabled( 'gutenboarding/feature-picker' ) ) {
steps = hasSiteTitle()
? [
Step.IntentGathering,
Step.Domains,
Step.DesignSelection,
Step.Style,
Step.Features,
Step.Plans,
]
: [
Step.IntentGathering,
Step.DesignSelection,
Step.Style,
Step.Domains,
Step.Features,
Step.Plans,
];
}
? [
Step.IntentGathering,
Step.Domains,
Step.DesignSelection,
Step.Style,
Step.Features,
Step.Plans,
]
: [
Step.IntentGathering,
Step.DesignSelection,
Step.Style,
Step.Domains,
Step.Features,
Step.Plans,
];

// @TODO: move site creation to a separate hook or an action on the ONBOARD store
const currentUser = useSelect( ( select ) => select( USER_STORE ).getCurrentUser() );
Expand Down
7 changes: 1 addition & 6 deletions client/landing/gutenboarding/onboarding-block/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as React from 'react';
import { Redirect, Switch, Route, useLocation } from 'react-router-dom';
import type { BlockEditProps } from '@wordpress/blocks';
import { useSelect } from '@wordpress/data';
import { isEnabled } from 'calypso/config';

/**
* Internal dependencies
Expand Down Expand Up @@ -100,11 +99,7 @@ const OnboardingEdit: React.FunctionComponent< BlockEditProps< Attributes > > =
</Route>

<Route path={ makePath( Step.Features ) }>
{ canUseStyleStep() && isEnabled( 'gutenboarding/feature-picker' ) ? (
<Features />
) : (
redirectToLatestStep
) }
{ canUseStyleStep() ? <Features /> : redirectToLatestStep }
</Route>

<Route path={ makePath( Step.Domains ) }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import * as React from 'react';
import { isEnabled } from 'calypso/config';
import { useHistory } from 'react-router-dom';
import { useSelect, useDispatch } from '@wordpress/data';
import { useI18n } from '@automattic/react-i18n';
Expand Down Expand Up @@ -107,7 +106,7 @@ const PlansStep: React.FunctionComponent< Props > = ( { isModal } ) => {
currentDomain={ domain }
onPlanSelect={ handlePlanSelect }
onPickDomainClick={ handlePickDomain }
isExperimental={ isEnabled( 'gutenboarding/feature-picker' ) }
isAccordion
selectedFeatures={ selectedFeatures }
locale={ locale }
/>
Expand Down
10 changes: 4 additions & 6 deletions packages/plans-grid/src/plans-grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface Props {
onPickDomainClick?: () => void;
currentDomain?: DomainSuggestions.DomainSuggestion;
disabledPlans?: { [ planSlug: string ]: string };
isExperimental?: boolean;
isAccordion?: boolean;
locale: string;
}

Expand All @@ -44,20 +44,18 @@ const PlansGrid: React.FunctionComponent< Props > = ( {
onPlanSelect,
onPickDomainClick,
disabledPlans,
isExperimental,
isAccordion,
locale,
} ) => {
// Note: isExperimental prop would be always false until "gutenboarding/feature-picker" feature flag is enabled
// and Gutenboarding flow is started with ?latest query param
isExperimental && debug( 'PlansGrid experimental version is active' );
isAccordion && debug( 'PlansGrid accordion version is active' );

return (
<div className="plans-grid">
{ header && <div className="plans-grid__header">{ header }</div> }

<div className="plans-grid__table">
<div className="plans-grid__table-container">
{ isExperimental ? (
{ isAccordion ? (
<PlansAccordion
selectedFeatures={ selectedFeatures }
selectedPlanSlug={ currentPlan?.storeSlug ?? '' }
Expand Down