Skip to content

Commit

Permalink
Add basic structure for feature recommendations card
Browse files Browse the repository at this point in the history
  • Loading branch information
IanRamosC committed Dec 17, 2024
1 parent 33c7e05 commit 9a70d51
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ const EvaluationRecommendations: FC = () => {
fluid
>
{ recommendedModules.map( module => {
const Card = JetpackModuleToProductCard[ module ];
const moduleName = module.replace( 'feature_', '' );
const Card = JetpackModuleToProductCard[ moduleName ];
return (
Card && (
<Col tagName="li" key={ module } lg={ 4 }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import BoostCard from './boost-card';
import CompleteCard from './complete-card';
import CrmCard from './crm-card';
import GrowthCard from './growth-card';
import NewsletterCard from './newsletter-card';
import ProtectCard from './protect-card';
import RelatedPostsCard from './related-posts-card';
import SearchCard from './search-card';
import SecurityCard from './security-card';
import SiteAcceleratorCard from './site-accelerator-card';
import SocialCard from './social-card';
import StatsCard from './stats-card';
import VideopressCard from './videopress-card';
Expand All @@ -33,4 +36,8 @@ export const JetpackModuleToProductCard: {
extras: null,
scan: null,
creator: null,
// Features:
newsletter: NewsletterCard,
'related-posts': RelatedPostsCard,
'site-accelerator': SiteAcceleratorCard,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';
import type { FC } from 'react';

interface NewsletterCardProps {
admin?: boolean;
recommendation?: boolean;
}

const NewsletterCard: FC< NewsletterCardProps > = ( { admin, recommendation } ) => {
return (
<ProductCard
slug={ PRODUCT_SLUGS.NEWSLETTER }
admin={ admin }
recommendation={ recommendation }
/>
);
};

export default NewsletterCard;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';
import type { FC } from 'react';

interface RelatedPostsCardProps {
admin?: boolean;
recommendation?: boolean;
}

const RelatedPostsCard: FC< RelatedPostsCardProps > = ( { admin, recommendation } ) => {
return (
<ProductCard
slug={ PRODUCT_SLUGS.RELATED_POSTS }
admin={ admin }
recommendation={ recommendation }
/>
);
};

export default RelatedPostsCard;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';
import type { FC } from 'react';

interface SiteAcceleratorCardProps {
admin?: boolean;
recommendation?: boolean;
}

const SiteAcceleratorCard: FC< SiteAcceleratorCardProps > = ( { admin, recommendation } ) => {
return (
<ProductCard
slug={ PRODUCT_SLUGS.SITE_ACCELERATOR }
admin={ admin }
recommendation={ recommendation }
/>
);
};

export default SiteAcceleratorCard;
10 changes: 7 additions & 3 deletions projects/packages/my-jetpack/_inc/data/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,21 @@ export const PRODUCT_SLUGS = {
ANTI_SPAM: 'anti-spam',
BACKUP: 'backup',
BOOST: 'boost',
BRUTE_FORCE: 'brute-force',
CRM: 'crm',
CREATOR: 'creator',
EXTRAS: 'extras',
JETPACK_AI: 'jetpack-ai',
NEWSLETTER: 'newsletter',
PROTECT: 'protect',
RELATED_POSTS: 'related-posts',
SCAN: 'scan',
SEARCH: 'search',
SITE_ACCELERATOR: 'site-accelerator',
SOCIAL: 'social',
SECURITY: 'security',
PROTECT: 'protect',
VIDEOPRESS: 'videopress',
STATS: 'stats',
VIDEOPRESS: 'videopress',
SECURITY: 'security',
GROWTH: 'growth',
COMPLETE: 'complete',
} satisfies Record< string, JetpackModule >;
11 changes: 7 additions & 4 deletions projects/packages/my-jetpack/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ type JetpackModule =
| 'extras'
| 'ai'
| 'jetpack-ai'
| 'protect'
| 'scan'
| 'search'
| 'social'
| 'security'
| 'protect'
| 'videopress'
| 'stats'
| 'videopress'
| 'security'
| 'growth'
| 'complete';
| 'complete'
| 'site-accelerator'
| 'newsletter'
| 'related-posts';

type ThreatItem = {
// Protect API properties (free plan)
Expand Down

0 comments on commit 9a70d51

Please sign in to comment.