Skip to content

Commit

Permalink
Revert changes to plan feature list
Browse files Browse the repository at this point in the history
  • Loading branch information
sixhours committed Dec 9, 2024
1 parent 904e0d4 commit 2432245
Showing 1 changed file with 9 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,24 @@ import {
type WPComPlan,
getFeatureByKey,
isMonthly,
PLAN_BUSINESS_MONTHLY,
} from '@automattic/calypso-products';
import { Badge } from '@automattic/components';
import { Plans2023Tooltip } from '@automattic/plans-grid-next';
import { chevronDown, Icon } from '@wordpress/icons';
import { useI18n } from '@wordpress/react-i18n';
import clsx from 'clsx';
import { useTranslate } from 'i18n-calypso';
import React, { useState } from 'react';
import JetpackLogo from 'calypso/components/jetpack-logo';

interface Props {
plan: Plan | JetpackPlan | WPComPlan | undefined;
showFeatures: boolean;
setShowFeatures: ( showFeatures: boolean ) => void;
showVariants?: boolean;
}

export const UpgradePlanFeatureList = ( props: Props ) => {
const { __ } = useI18n();
const translate = useTranslate();
const { plan, showFeatures, setShowFeatures, showVariants } = props;
const { plan, showFeatures, setShowFeatures } = props;
const [ activeTooltipId, setActiveTooltipId ] = useState( '' );

const isMonthlyPlan = plan ? isMonthly( plan.getStoreSlug() ) : false;
Expand All @@ -49,39 +45,6 @@ export const UpgradePlanFeatureList = ( props: Props ) => {
? getFeatureByKey( storageFeature )?.getTitle()
: undefined;

const renderRefundTooltip = () => {
const title =
PLAN_BUSINESS_MONTHLY === plan?.getStoreSlug()
? translate( 'Refundable within {{strong}}7 days{{/strong}}', {
components: {
strong: <strong />,
},
} )
: translate( 'Refundable within {{strong}}14 days{{/strong}}', {
components: {
strong: <strong />,
},
} );

const description =
PLAN_BUSINESS_MONTHLY === plan?.getStoreSlug()
? __( 'Fully refundable within 7 days. No questions asked.' )
: __( 'Fully refundable within 14 days. No questions asked.' );

return (
<li className={ clsx( 'import__upgrade-plan-feature' ) }>
<Plans2023Tooltip
id="feature-refund"
text={ description }
setActiveTooltipId={ setActiveTooltipId }
activeTooltipId={ activeTooltipId }
>
<span>{ title }</span>
</Plans2023Tooltip>
</li>
);
};

return (
<ul className={ clsx( 'import__details-list' ) }>
{ ! showFeatures && (
Expand All @@ -103,13 +66,12 @@ export const UpgradePlanFeatureList = ( props: Props ) => {
setActiveTooltipId={ setActiveTooltipId }
activeTooltipId={ activeTooltipId }
>
<span>{ feature?.getTitle() }</span>
{ i === 0 && <strong>{ feature?.getTitle() }</strong> }
{ i > 0 && <span>{ feature?.getTitle() }</span> }
</Plans2023Tooltip>
</li>
) ) }

{ showVariants && renderRefundTooltip() }

{ jetpackFeatures && jetpackFeatures.length > 0 && (
<>
<li className={ clsx( 'import__upgrade-plan-feature logo' ) }>
Expand All @@ -129,16 +91,12 @@ export const UpgradePlanFeatureList = ( props: Props ) => {
) ) }
</>
) }
{ ! showVariants && (
<>
<li className={ clsx( 'import__upgrade-plan-feature logo' ) }>
<strong>{ __( 'Storage' ) }</strong>
</li>
<li className={ clsx( 'import__upgrade-plan-feature' ) }>
<Badge type="info">{ storageFeatureTitle }</Badge>
</li>
</>
) }
<li className={ clsx( 'import__upgrade-plan-feature logo' ) }>
<strong>{ __( 'Storage' ) }</strong>
</li>
<li className={ clsx( 'import__upgrade-plan-feature' ) }>
<Badge type="info">{ storageFeatureTitle }</Badge>
</li>
</>
) }
</ul>
Expand Down

0 comments on commit 2432245

Please sign in to comment.