Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

feat(releases-page): Downloads Grid#912

Merged
benhalverson merged 4 commits into
nodejs:masterfrom
jemjam:feature-releases-page
Sep 9, 2020
Merged

feat(releases-page): Downloads Grid#912
benhalverson merged 4 commits into
nodejs:masterfrom
jemjam:feature-releases-page

Conversation

@jemjam

@jemjam jemjam commented Sep 7, 2020

Copy link
Copy Markdown
Contributor

Downloads Grid

Adds some styling to the downloads grid at the top of the Download page.

A huge acknowledgement to @saulonunesdev for putting together these
templates initially in #547. The PR looked great but ended up with some
additional content that needed to be refactored out. This commit
restores the work he put in to update the Downloads page components.

Description

  • Adds all the Download templates that were green from Downloads Page #547
  • Other files that had various differences were left out

Related Issues

  • Addresses #261
  • Also note: related work is going on for the downloads table (the bottom half of the page) in #840

A huge acknowledgement to @saulonunesdev for putting together these
templates initially. The PR looked great but ended up with some
additional content that needed to be refactored out. This commit
restores the work he put in to update the Downloads page.

- Add all the Download templates that were green from original PR
- Add to the style tokens
@jemjam

jemjam commented Sep 7, 2020

Copy link
Copy Markdown
Contributor Author

/preview

@github-actions

github-actions Bot commented Sep 7, 2020

Copy link
Copy Markdown

Please find a preview at: https://staging.nodejs.dev/912/

@jemjam

jemjam commented Sep 7, 2020

Copy link
Copy Markdown
Contributor Author

Direct link for your reference: https://staging.nodejs.dev/912/download

I didn't link the download page in the header yet since it makes sense to wait until we finalize the rest of the downloads table below first.

@benhalverson

Copy link
Copy Markdown
Member

Thanks for the effort @JemJem
Any idea on why it's defaulting to the source code selection when I'm on a Mac?
Here's a screenshot of the log
Screen Shot 2020-09-07 at 3 50 03 PM

👍 on not making the /download public yet

@benhalverson benhalverson added the MVP Highest priority label Sep 7, 2020
@jemjam

jemjam commented Sep 8, 2020

Copy link
Copy Markdown
Contributor Author

that's odd: I also tested on a mac, and it highlighted the mac installer as expected for me. Not totally sure on that front.

I didn't write the logic for which group to highlight initially, but I noticed there were those logs in there. I'm sure there's a hook nearby to troubleshoot. (If anyone else is exploring this, please let me know if you run into the same issues and if you have any troubleshooting notes you can add.)

@mikeesto

mikeesto commented Sep 8, 2020

Copy link
Copy Markdown
Member

I'm also on a mac and what I have found is that:

  1. Navigating to https://staging.nodejs.dev/912/download/ correctly identifies the mac installer.
  2. If you first go to https://staging.nodejs.dev/912 and then change the URL to navigate to https://staging.nodejs.dev/912/download it defaults to selecting source code

@miguelc1221

miguelc1221 commented Sep 9, 2020

Copy link
Copy Markdown

Hey, I looked into this and it seems like it only breaks when the trailing "/" is not in the url https://staging.nodejs.dev/912/download and It does a redirect back to https://staging.nodejs.dev/912/download/ (with slash). Now i am not sure how gatsby works since this is the first time ever using it, but i suspect navigator is not available after that redirect (SSR?). If this is the case then the default selected os won't change when the userOS is retrieved.

  const [selected, setSelected] = useState(
    !(['WIN', 'MAC', 'MOBILE'].indexOf(userOS) >= 0) ? 'SOURCECODE' : userOS
  );

once the component is mounted, one would need a useEffect to change that default value. The following seems to fix this issue. This is usually a common pitfall when setting state based on props.

  const [selected, setSelected] = useState('');

  useEffect(() => {
    setSelected(
      !(['WIN', 'MAC', 'MOBILE'].indexOf(userOS) >= 0) ? 'SOURCECODE' : userOS
    );
  }, [userOS]);

You can test it by running npm run serve and using a Hard Reload.

@benhalverson

Copy link
Copy Markdown
Member

Yep @miguelc1221 This fixes it. I tried a "production" build locally using gatsby build and ran a python server to load the files locally. Thanks for the help 👍

@jemjam

jemjam commented Sep 9, 2020

Copy link
Copy Markdown
Contributor Author

Nice! Really appreciate the distributed troubleshooting on this, your useEffect approach is a great solution. I'm going to add this.

A fix proposed on the PR to address an issue where the download userOs
wouldn't update correctly. useEffect ensures the component will render
again correctly when the prop changes.
@benhalverson benhalverson added the create-preview Generate preview on staging.nodejs.dev label Sep 9, 2020
@github-actions github-actions Bot removed the create-preview Generate preview on staging.nodejs.dev label Sep 9, 2020
@github-actions

github-actions Bot commented Sep 9, 2020

Copy link
Copy Markdown

Please find a preview at: https://staging.nodejs.dev/912/

@benhalverson benhalverson linked an issue Sep 9, 2020 that may be closed by this pull request
@saulonunesdev

Copy link
Copy Markdown

Thanks @jemjam for having the time to make this work <3

@saulonunesdev saulonunesdev mentioned this pull request Sep 9, 2020
@designMoreWeb

Copy link
Copy Markdown
Contributor

image

For some reason I am getting this when trying to preview

@ahtee

ahtee commented Sep 9, 2020

Copy link
Copy Markdown

[Edit: Removed image]

For some reason I am getting this when trying to preview

Is this error from clicking https://staging.nodejs.dev/912/ ? I just tried on mobile iPhone XR and it works, including going to the /downloads page

@miguelc1221

Copy link
Copy Markdown

[Edit: Removed image]
For some reason I am getting this when trying to preview

Is this error from clicking https://staging.nodejs.dev/912/ ? I just tried on mobile iPhone XR and it works, including going to the /downloads page

It's working fine for me too.

@miguelc1221

Copy link
Copy Markdown

Nice! Really appreciate the distributed troubleshooting on this, your useEffect approach is a great solution. I'm going to add this.

No problem! Glad I could help!

@benhalverson benhalverson merged commit 5deaef9 into nodejs:master Sep 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

MVP Highest priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Releases Page: Download Grid

7 participants