Skip to content

Commit

Permalink
refactor(promotion banner): added promotion banner in articles
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldsouzax committed Nov 7, 2023
1 parent e7a6d4e commit a0b09bf
Show file tree
Hide file tree
Showing 22 changed files with 1,024 additions and 177 deletions.
77 changes: 77 additions & 0 deletions apps/research/public/aoc_settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
257 changes: 257 additions & 0 deletions apps/research/public/nn_settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 76 additions & 72 deletions apps/research/public/pro_product.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
185 changes: 185 additions & 0 deletions apps/research/public/pro_settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions apps/research/public/twic_settings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/research/src/components/article/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ArticleRecommendations,
} from './article-body';
import { Divider } from 'antd';
import { TopPromotion } from '../platform';

interface ArticleProps
extends Omit<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const StartTrialCall: React.FC<EndedCallProps> = ({
handleYearlyCheckout={isLoggedOut ? signIn : yearlyCheckout}
isLoading={isLoading}
handleCheckout={isLoggedOut ? signIn : checkout}
label="Start 30-Day Free Trial"
label="Subscribe Now"
isFreeTrial
features={appStructure.payments[productKeys].features}
yearlyPrice={appStructure.payments[productKeys].yearlyPrice}
Expand All @@ -76,7 +76,7 @@ const StartTrialCall: React.FC<EndedCallProps> = ({
Already subscribed?{' '}
<Link
href={{
pathname: `https://${process.env.NEXT_PUBLIC_WEB_DOMAIN}/services/auth/signup`,
pathname: `https://${process.env.NEXT_PUBLIC_WEB_DOMAIN}/services/auth`,
query: { redirect: window.location.href },
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useCustomerCheckout, useProductInfo } from '@/hooks';
import { motion } from 'framer-motion';
import { appStructure } from '@/config';
import { getProductSection, sectionKeys } from '@/utils';
import { TopPromotion } from '@/components';

interface PrivateArticleProps
extends React.PropsWithChildren,
Expand Down Expand Up @@ -102,11 +103,14 @@ const PrivateArticle: React.FC<PrivateArticleProps> = ({
case 'blocked':
return <BlockedCall />;
case 'ended':
if (completePackageStatus.state === 'ended') {
return null;
}
return (
<EndedCall
yearlyCheckout={doProyearlyCheckout}
isLoading={isProMonthlyLoading || isProYearlyLoading}
checkout={doProMonthlyCheckout}
yearlyCheckout={doYearlyCheckOut}
isLoading={isLoading || isYearlyLoading}
checkout={doCheckOut}
isReport={isReport}
/>
);
Expand Down Expand Up @@ -148,19 +152,29 @@ const PrivateArticle: React.FC<PrivateArticleProps> = ({
);

return (
<motion.div
key={productStatus.state}
variants={variants}
animate={'show'}
initial="hide"
style={{
width: '100%',
}}
>
<ActionLayout publicSnippet={publicSnippet}>
{getCallToAction(productStatus.state)}
</ActionLayout>
</motion.div>
<>
<motion.div
key={productStatus.state}
variants={variants}
animate={'show'}
initial="hide"
style={{
width: '100%',
}}
>
<ActionLayout publicSnippet={publicSnippet}>
{completePackageStatus.state === 'ended' && (
<EndedCall
yearlyCheckout={doProyearlyCheckout}
isLoading={isProMonthlyLoading || isProYearlyLoading}
checkout={doProMonthlyCheckout}
isReport={isReport}
/>
)}
{getCallToAction(productStatus.state)}
</ActionLayout>
</motion.div>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ArticleMetaData from '../ArticleMetaData';
import { downloadResource, getProductSection, sectionKeys } from '@/utils';
import { useProductInfo } from '@/hooks';
import { appStructure } from '@/config';
import { TopPromotion } from '@/components';

const { Title, Text } = Typography;
const { useToken } = theme;
Expand All @@ -22,47 +23,77 @@ const ArticleHeader: React.FC<ArticleHeaderProps> = ({
reportDocument,
...metadata
}) => {
const { productStatus, appState } = useProductInfo(
const { productStatus: proProductStatus, appState } = useProductInfo(
appStructure.payments.pro.productId
);
const {
token: { fontSizeSM },
} = useToken();

const productSection = getProductSection(metadata.sectionsCollection);
const productKey = sectionKeys[productSection?.name!] ?? 'pro';
const productSection =
getProductSection(metadata.sectionsCollection)?.name ?? '';
const productKey = sectionKeys[productSection] ?? 'pro';

const { productStatus } = useProductInfo(
appStructure.payments[productKey].productId
);

React.useEffect(() => {
console.log(
!['active', 'ended', 'blocked'].includes(productStatus.state ?? 'loading')
);
console.log(
!['active', 'ended', 'blocked'].includes(
proProductStatus.state ?? 'loading'
)
);
}, [proProductStatus, productStatus]);

return (
<div id="article-header" className={styles.header}>
<ArticleMetaData {...metadata} title={title} />
<Title level={2} style={{ margin: 0, padding: 0 }}>
{title}
</Title>
<Text type="secondary">{subtitle}</Text>
<div className={styles.headerImage}>
<Image src={image.url} style={{ margin: 0 }} alt={image.title ?? ''} />
{image.description && (
<Typography.Text style={{ fontSize: fontSizeSM }} type="secondary">
{image.description}
</Typography.Text>
<>
{!['active', 'ended', 'blocked'].includes(
productStatus.state ?? 'loading'
) &&
!['active', 'ended', 'blocked'].includes(
proProductStatus.state ?? 'loading'
) && <TopPromotion />}
<div id="article-header" className={styles.header}>
<ArticleMetaData {...metadata} title={title} />
<Title level={2} style={{ margin: 0, padding: 0 }}>
{title}
</Title>
<Text type="secondary">{subtitle}</Text>
<div className={styles.headerImage}>
<Image
src={image.url}
style={{ margin: 0 }}
alt={image.title ?? ''}
/>
{image.description && (
<Typography.Text style={{ fontSize: fontSizeSM }} type="secondary">
{image.description}
</Typography.Text>
)}
</div>
{reportDocument && (
<>
{(productStatus.state === 'active' ||
proProductStatus.state === 'active' ||
productKey === 'pro') && (
<Button
type="primary"
onClick={() => downloadResource(reportDocument.url)}
block
size="large"
>
Download Report
</Button>
)}
</>
)}
<Divider style={{ margin: 0 }} />
</div>
{reportDocument && (
<>
{(productStatus.state === 'active' || productKey === 'pro') && (
<Button
type="primary"
onClick={() => downloadResource(reportDocument.url)}
block
size="large"
>
Download Report
</Button>
)}
</>
)}
<Divider style={{ margin: 0 }} />
</div>
</>
);
};

Expand Down
47 changes: 47 additions & 0 deletions apps/research/src/components/platform/BottomPromotion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import * as React from 'react';

import { Button, Divider, Grid, Image, Typography } from 'antd';
import styles from './styles.module.scss';
import Link from 'next/link';

const BottomPromotion: React.FC = () => {
const { lg, xl } = Grid.useBreakpoint();
return (
<Link href={'/pricing'} className={styles.topPromotion}>
<div
id="top-promotion-info"
style={{
backgroundColor: '#202328',
}}
>
<div>
<Typography.Title
style={{
color: 'white',
opacity: 0.85,
margin: 0,
}}
level={lg ? (xl ? 1 : 2) : 3}
>
Digital Assets Research
</Typography.Title>
<Typography.Text
style={{
color: 'white',
opacity: 0.85,
fontSize: lg ? (xl ? 24 : 18) : 16,
}}
>
For Professional and Institutional Investors
</Typography.Text>
</div>
<Link href={'/pricing'}>
<Button size="large">Sign Up Now</Button>
</Link>
</div>
<div />
</Link>
);
};

export default BottomPromotion;
2 changes: 1 addition & 1 deletion apps/research/src/components/platform/PricingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const PricingCard: React.FC<PricingCardProps> = ({
token: { colorInfo },
} = theme.useToken();
return (
<Badge count={badge} offset={[-150, 0]} color="blue">
<Badge count={badge} offset={[-158, 0]} color="blue">
<Card
style={{
width: '100%',
Expand Down
Loading

0 comments on commit a0b09bf

Please sign in to comment.