Skip to content
Open
12 changes: 12 additions & 0 deletions client/components/mma/MMAPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ const DeliveryRecordsProblemConfirmation = lazy(() =>
})),
);

const SavedArticles = lazy(() =>
import(
/* webpackChunkName: "SavedArticles" */ './savedArticles/SavedArticles'
).then(({ SavedArticles }) => ({ default: SavedArticles })),
);

const EmailAndMarketing = lazy(() =>
import(
/* webpackChunkName: "EmailAndMarketing" */ './identity/emailAndMarketing/EmailAndMarketing'
Expand Down Expand Up @@ -319,6 +325,12 @@ const MMARouter = () => {
path="/email-prefs"
element={<EmailAndMarketing />}
/>
{featureSwitches.savedArticles && (
<Route
path="/saved-articles"
element={<SavedArticles />}
/>
)}
<Route
path="/public-settings"
element={<PublicProfile />}
Expand Down
5 changes: 5 additions & 0 deletions client/components/mma/MMAPageSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ const MMALocationObjectArr: LocationObject[] = [
path: '/email-prefs',
selectedNavItem: NAV_LINKS.emailPrefs,
},
{
title: 'Saved articles',
path: '/saved-articles',
selectedNavItem: NAV_LINKS.savedArticles,
},
{
title: 'Edit your profile',
path: '/public-settings',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO
13 changes: 13 additions & 0 deletions client/components/mma/savedArticles/SavedArticles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NAV_LINKS } from '../../shared/nav/NavConfig';
import { PageContainer } from '../Page';

export const SavedArticles = () => {
return (
<PageContainer
selectedNavItem={NAV_LINKS.savedArticles}
pageTitle={NAV_LINKS.savedArticles.title}
>
<p>There is nothing to see here yet</p>
</PageContainer>
);
};
8 changes: 4 additions & 4 deletions client/components/shared/nav/DropdownNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ export const DropdownNav = () => {
</button>

<ul css={dropdownNavCss(showMenu, isHelpCentre)}>
{Object.values(NAV_LINKS).map(
(navItem: MenuSpecificNavItem) => (
{Object.values(NAV_LINKS)
.filter((navItem) => !navItem.isExcludedByFeatureSwitch)
.map((navItem: MenuSpecificNavItem) => (
<li key={navItem.title}>
<a href={navItem.link} css={dropdownNavItemCss}>
{navItem.icon && (
Expand Down Expand Up @@ -242,8 +243,7 @@ export const DropdownNav = () => {
</span>
</a>
</li>
),
)}
))}
</ul>
</nav>
);
Expand Down
1 change: 1 addition & 0 deletions client/components/shared/nav/LeftSideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const LeftSideNav = (props: LeftSideNavProps) => (
<ul css={leftNavCss}>
{Object.values(NAV_LINKS)
.filter((navItem) => !navItem.isDropDownExclusive)
.filter((navItem) => !navItem.isExcludedByFeatureSwitch)
.map((navItem: MenuSpecificNavItem) => (
<li
css={leftNavItemCss(props.selectedNavItem === navItem)}
Expand Down
9 changes: 9 additions & 0 deletions client/components/shared/nav/NavConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { conf } from '../../../../server/config';
import { featureSwitches } from '../../../../shared/featureSwitches';
import { AccountOverviewIcon } from '../../mma/shared/assets/AccountOverviewIcon';
import { CreditCardIcon } from '../../mma/shared/assets/CreditCardIcon';
import { EmailPrefsIcon } from '../../mma/shared/assets/EmailPrefIcon';
Expand All @@ -20,13 +21,15 @@ export interface NavItem {

export interface MenuSpecificNavItem extends NavItem {
isDropDownExclusive?: boolean;
isExcludedByFeatureSwitch?: boolean;
}

interface NavLinks {
accountOverview: MenuSpecificNavItem;
billing: MenuSpecificNavItem;
profile: MenuSpecificNavItem;
settings: MenuSpecificNavItem;
savedArticles: MenuSpecificNavItem;
Comment thread
vlbee marked this conversation as resolved.
emailPrefs: MenuSpecificNavItem;
help: MenuSpecificNavItem;
comments: MenuSpecificNavItem;
Expand Down Expand Up @@ -60,6 +63,12 @@ export const NAV_LINKS: NavLinks = {
local: true,
icon: ProfileIcon,
},
savedArticles: {
title: 'Saved articles',
link: '/saved-articles',
local: true,
isExcludedByFeatureSwitch: !featureSwitches.savedArticles,
},
emailPrefs: {
title: 'Emails & marketing',
link: '/email-prefs',
Expand Down
40 changes: 40 additions & 0 deletions cypress/integration/parallel-6/savedArticles.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { featureSwitches } from '../../../shared/featureSwitches';

if (!featureSwitches.savedArticles) {
Comment thread
vlbee marked this conversation as resolved.
Outdated
describe('Feature Switch OFF: Saved Articles', () => {
beforeEach(() => {
cy.session('auth', () => {
cy.setCookie('gu-cmp-disabled', 'true');
});
});

it('redirects to account overview homepage from /saved-articles route ', () => {
cy.visit('/saved-articles');

cy.url().should('not.contain', '/saved-articles');

// check Navigation/Page Title
cy.findAllByText('Account overview').should(
'have.length.at.least',
1,
);
cy.findAllByText('Saved articles').should('have.length', 0);
Comment thread
vlbee marked this conversation as resolved.
});
});
}

if (featureSwitches.savedArticles) {
describe('Feature Switch ON: Saved Article', () => {
beforeEach(() => {
cy.session('auth', () => {
cy.setCookie('gu-cmp-disabled', 'true');
});
});

it('displays Saved Article page', () => {
cy.visit('/saved-articles');

cy.findAllByText('Saved articles').should('have.length', 2);
Comment thread
vlbee marked this conversation as resolved.
});
});
}
Comment thread
vlbee marked this conversation as resolved.
Outdated
1 change: 1 addition & 0 deletions shared/featureSwitches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ export const featureSwitches: Record<string, boolean> = {
cancellationProductSwitch: false,
accountOverviewNewLayout: false,
productSwitching: true,
savedArticles: false,
Comment thread
vlbee marked this conversation as resolved.
};