Skip to content

Commit

Permalink
Revert "[NASAA-203/204] - Create AmpExperiment component, add top sto…
Browse files Browse the repository at this point in the history
…ries experiment to PS articles"
  • Loading branch information
HarveyPeachey authored Oct 21, 2024
1 parent e9c6b27 commit bc34ea3
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 503 deletions.
86 changes: 0 additions & 86 deletions src/app/components/AmpExperiment/index.test.tsx

This file was deleted.

50 changes: 0 additions & 50 deletions src/app/components/AmpExperiment/index.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions src/app/components/AmpExperiment/types.d.ts

This file was deleted.

20 changes: 2 additions & 18 deletions src/app/pages/ArticlePage/ArticlePage.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,14 @@ export default {
paddingBottom: `${spacings.QUADRUPLE}rem`,
},
}),
featuresSection: ({ spacings, mq }: Theme) =>
css({
marginBottom: `${spacings.TRIPLE}rem`,

[mq.GROUP_4_MIN_WIDTH]: {
marginBottom: `${spacings.FULL}rem`,
padding: `${spacings.DOUBLE}rem`,
},
}),
topStoriesSection: ({ spacings, mq }: Theme) =>
topStoriesAndFeaturesSection: ({ spacings, mq }: Theme) =>
css({
marginBottom: `${spacings.TRIPLE}rem`,

[mq.GROUP_4_MIN_WIDTH]: {
display: 'block',
marginBottom: `${spacings.FULL}rem`,
padding: `${spacings.DOUBLE}rem`,
},
'[amp-x-topStoriesExperiment="show_at_halfway"] &': {
display: 'none',
[mq.GROUP_4_MIN_WIDTH]: {
display: 'block',
marginBottom: `${spacings.FULL}rem`,
padding: `${spacings.DOUBLE}rem`,
},
},
}),
};
33 changes: 5 additions & 28 deletions src/app/pages/ArticlePage/ArticlePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,20 @@ import {
import { ServiceContext } from '../../contexts/ServiceContext';
import RelatedContentSection from '../../components/RelatedContentSection';
import Disclaimer from '../../components/Disclaimer';

import SecondaryColumn from './SecondaryColumn';

import styles from './ArticlePage.styles';
import { ComponentToRenderProps, TimeStampProps } from './types';
import AmpExperiment from '../../components/AmpExperiment';
import {
experimentTopStoriesConfig,
getExperimentTopStories,
ExperimentTopStories,
} from './experimentTopStories/helpers';

const ArticlePage = ({ pageData }: { pageData: Article }) => {
const { isApp, pageType, service, isAmp, id } = useContext(RequestContext);

const { isApp, pageType, service } = useContext(RequestContext);
const {
articleAuthor,
isTrustProjectParticipant,
showRelatedTopics,
brandName,
} = useContext(ServiceContext);

const { enabled: preloadLeadImageToggle } = useToggle('preloadLeadImage');

const {
Expand Down Expand Up @@ -137,16 +131,6 @@ const ArticlePage = ({ pageData }: { pageData: Article }) => {
...(isCPS && { pageTitle: `${atiAnalytics.pageTitle} - ${brandName}` }),
};

const topStoriesContent = pageData?.secondaryColumn?.topStories;
const { shouldEnableExperimentTopStories, transformedBlocks } =
getExperimentTopStories({
blocks,
topStoriesContent,
isAmp,
service,
id,
});

const componentsToRender = {
visuallyHiddenHeadline,
headline: headings,
Expand Down Expand Up @@ -190,10 +174,6 @@ const ArticlePage = ({ pageData }: { pageData: Article }) => {
<Disclaimer {...props} increasePaddingOnDesktop={false} />
),
podcastPromo: () => (podcastPromoEnabled ? <InlinePodcastPromo /> : null),
experimentTopStories: () =>
topStoriesContent ? (
<ExperimentTopStories topStoriesContent={topStoriesContent} />
) : null,
};

const visuallyHiddenBlock = {
Expand All @@ -203,8 +183,8 @@ const ArticlePage = ({ pageData }: { pageData: Article }) => {
};

const articleBlocks = startsWithHeading
? transformedBlocks
: [visuallyHiddenBlock, ...transformedBlocks];
? blocks
: [visuallyHiddenBlock, ...blocks];

const promoImageBlocks =
pageData?.promo?.images?.defaultPromoImage?.blocks ?? [];
Expand All @@ -226,9 +206,6 @@ const ArticlePage = ({ pageData }: { pageData: Article }) => {

return (
<div css={styles.pageWrapper}>
{shouldEnableExperimentTopStories && (
<AmpExperiment experimentConfig={experimentTopStoriesConfig} />
)}
<ATIAnalytics atiData={atiData} />
<ChartbeatAnalytics
sectionName={pageData?.relatedContent?.section?.name}
Expand Down
7 changes: 5 additions & 2 deletions src/app/pages/ArticlePage/SecondaryColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ const SecondaryColumn = ({ pageData }: { pageData: Article }) => {
return (
<div css={styles.secondaryColumn}>
{topStoriesContent && (
<div css={styles.topStoriesSection} data-testid="top-stories">
<div
css={styles.topStoriesAndFeaturesSection}
data-testid="top-stories"
>
<TopStoriesSection content={topStoriesContent} />
</div>
)}
{featuresContent && (
<div css={styles.featuresSection} data-testid="features">
<div css={styles.topStoriesAndFeaturesSection} data-testid="features">
<FeaturesAnalysis
content={featuresContent}
parentColumns={{}}
Expand Down
109 changes: 0 additions & 109 deletions src/app/pages/ArticlePage/experimentTopStories/helpers.test.tsx

This file was deleted.

Loading

0 comments on commit bc34ea3

Please sign in to comment.