Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dynamic landing pages #1143

Merged
merged 70 commits into from
Nov 17, 2023
Merged

feat: Dynamic landing pages #1143

merged 70 commits into from
Nov 17, 2023

Conversation

jcbcapps
Copy link
Contributor

@jcbcapps jcbcapps commented Nov 3, 2023

SC-2617

Proposed changes

  • adds in page navigation component to Landing Page
  • adds [article] folder with index.tsx under src/pages/landing
  • adds unit tests
  • styles responsive layout, dark mode, and visual formatting
  • adds labels to the article portion of the getLandingPage query
  • adds styles for sticky header
  • adds in page navigation to storybook
  • updates styling of docs accordion to match figma
  • updates styling of background fills to match figma

Reviewer notes

E2E tests: https://github.com/USSF-ORBIT/ussf-portal/pull/332

Setup

Start the system

yarn services:up
yarn dev
cd ../ussf-portal-cms
yarn dev

Login to the portal http://localhost:3000

Start storybook

yarn storybook

Login to storybook http://localhost:6006, though the command above should open it for you


Code review steps

As the original developer, I have

  • Met the acceptance criteria
  • Created new stories in Storybook if applicable
  • Created/modified automated unit tests in Jest
  • Created/modified automated E2E tests
  • Followed guidelines for zero-downtime deploys, if applicable
  • Use ANDI to check for basic a11y issues

As a reviewer, I have

Check out our How to review a pull request document.


Screenshots

image image

Copy link

This pull request has been linked to Shortcut Story #2617: Add Landing Page to Portal.

Comment on lines +29 to +30
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const pageContent = (): any => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content prop for the InPageNavigation component expects a type of Element & string for some reason that I don't understand. I tried to remedy this a few other ways, but nothing else worked so I added this any and explicitly ignored the type.

Comment on lines +100 to +102
{articles.length >= 1 && (
<ArticleList articles={articles} landingPage={true} />
)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I had to do a bit of prop drilling here. The landingPage prop gets passed down to ArticleListItem and is used to link to the dynamic path for an article that is related to a landing page. I did this to save a bit of time on what would probably need to be a larger refactor. Let me know if you see a better solution!

Comment on lines -11 to +12
searchQuery?: string
searchDisplay?: boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prop wasn't being used, so I changed it to be a boolean that we can use to toggle the display of the Search component

Comment on lines +23 to +32
{ path: '/', label: 'Service portal home' },
{ path: '/landing', label: 'Landing pages' },
{
path: `/landing/${breadcrumbNavItems[2]}`,
label: `${breadcrumbNavItems[2].toUpperCase()}`,
},
{
path: `/landing/${breadcrumbNavItems[2]}/${breadcrumbNavItems[3]}`,
label: `${breadcrumbNavItems[3]}`,
current: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it would be fine to hardcode the array positions here for now, but we could write some logic to make it a bit more dynamic in the future if need be.

@@ -18,6 +18,7 @@ const LandingPageArticle = ({
return (
<>
<PageHeader searchDisplay={false}>
<h1>{breadcrumbNavItems[2].toUpperCase()}</h1>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about adding this h1 here, but I thought displaying what landing page the article is nested under could be beneficial.

Comment on lines 76 to +80
{category === 'InternalNews' ? (
<Category category={CONTENT_CATEGORIES.NEWS} />
) : (
) : category !== 'LandingPage' ? (
<Tag className={`${tagStyles.Category}`}>{category}</Tag>
)}
) : null}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When looking at an article nested under a landing page, the LandingPage category was being shown. I thought that might be confusing for the user so I added this to hide it.

@shkeating
Copy link
Contributor

@jcbcapps to do: add page titles to all pages involved in this. We want to set it to the name of the landing page, not the default of USSF Portal

image

@shkeating shkeating marked this pull request as ready for review November 16, 2023 19:34
@shkeating shkeating requested review from a team as code owners November 16, 2023 19:34
Copy link
Contributor

@shkeating shkeating left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shauna and anna approval attained in design <> eng sync today

@AnnaGingle AnnaGingle assigned AnnaGingle and unassigned AnnaGingle Nov 16, 2023
Copy link
Contributor

@gidjin gidjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +148 to +158
const session = await getSession(context.req, context.res)
const user = session?.passport?.user

if (!user) {
return {
redirect: {
destination: '/login',
permanent: false,
},
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Did we need to do a redirect here? Asking since I don't know that we do it elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I don't think we do. I'm currently working on adding tests on another branch and I can remove this there.

@mergify mergify bot merged commit 6bd7236 into main Nov 17, 2023
@mergify mergify bot deleted the sc-2617/dynamic-landing-pages branch November 17, 2023 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants