Skip to content

feat: use new design for FileContributors#14898

Merged
wackerow merged 39 commits into
ethereum:devfrom
JoeChenJ:Use_new_design_for_FileContributors
May 20, 2025
Merged

feat: use new design for FileContributors#14898
wackerow merged 39 commits into
ethereum:devfrom
JoeChenJ:Use_new_design_for_FileContributors

Conversation

@JoeChenJ
Copy link
Copy Markdown
Contributor

@JoeChenJ JoeChenJ commented Feb 13, 2025

Description

Use new design for FileContributors

Related Issue

#8024 & #14473

@github-actions github-actions Bot added content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project translation 🌍 This is related to our Translation Program labels Feb 13, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 13, 2025

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit f24d9a3
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/682bbd42596bda0008d7f12e
😎 Deploy Preview https://deploy-preview-14898--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 49 (🔴 down 6 from production)
Accessibility: 94 (no change from production)
Best Practices: 91 (🔴 down 8 from production)
SEO: 98 (🔴 down 2 from production)
PWA: 59 (🟢 up 1 from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

Hey @konopkja, could you take a look at this?

Let me know if anything needs improvement!

@konopkja
Copy link
Copy Markdown
Contributor

Screenshot 2025-02-14 at 9 09 23

looks awesome!

I think this gap could be 50% of what it is now, but overall its great!


I noticed that the component is only visible on desktop, do you intend on preparing it for mobile also? I think there is enough space

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

Screenshot 2025-02-14 at 9 09 23

looks awesome!

I think this gap could be 50% of what it is now, but overall its great!

I noticed that the component is only visible on desktop, do you intend on preparing it for mobile also? I think there is enough space

@konopkja Sure, I'll work on this soon!

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

Hey @konopkja , I’ve adjusted the gap and made the updates for mobile. I also want to point out a few additional changes I made that you might not notice:

  1. I added a “Translator” tag next to the Crowdin contributors.

  2. I changed the redirect logic for Crowdin contributors — they now link to their Crowdin profiles instead of GitHub.

  3. On pages with Crowdin contributors, the modal now displays both Crowdin and GitHub contributors (it used to show only one or the other).

Could you take a look at those as well and let me know if everything looks fine? Appreciate your feedback!

@konopkja
Copy link
Copy Markdown
Contributor

Hey @konopkja , I’ve adjusted the gap and made the updates for mobile. I also want to point out a few additional changes I made that you might not notice:

  1. I added a “Translator” tag next to the Crowdin contributors.
  2. I changed the redirect logic for Crowdin contributors — they now link to their Crowdin profiles instead of GitHub.
  3. On pages with Crowdin contributors, the modal now displays both Crowdin and GitHub contributors (it used to show only one or the other).

Could you take a look at those as well and let me know if everything looks fine? Appreciate your feedback!

Hey @JoeChenJ it looks perfect! Really appreciate this particular contribution <3

@konopkja
Copy link
Copy Markdown
Contributor

shall we discuss extending this component to other pages outside developer docs or would it be better tackled in another PR?

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

shall we discuss extending this component to other pages outside developer docs or would it be better tackled in another PR?

I think it would be best to merge this PR first, and then we can extend it in another one, as it might take a bit more time

@JoeChenJ JoeChenJ marked this pull request as ready for review February 14, 2025 12:42
@JoeChenJ
Copy link
Copy Markdown
Contributor Author

Hey @konopkja, I've made some progress on the extension—the component is now available at the end of the markdown pages.

Since this PR is still open, I've pushed the changes here!

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

619627a370888e52a2a691864f1191f
bb3ae600388010b97db61d4c09deb6e
Hey @konopkja for React pages, does placing the component here look good to you?

@nloureiro
Copy link
Copy Markdown
Contributor

@JoeChenJ, great contribution! Thank you

From my side, this component should always be at the end of the content, before the callouts and widgets.

I would add a border-top to it. See if this screenshot helps.

Screen Shot 2025-02-17 12 35 45 AM

Are you thinking of all content pages? Something like all pages minus (homepage & Hubpages). Is this the goal?

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

@nloureiro thank you for the guidance! Adding a border-top looks much better.

I was planning to add this component on every page, but not sure if it fits well across all designs. Do you think we should exclude certain pages? Would love to get your thought on it!

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

Screenshot 2025-02-20 at 11 09 03 guess its ok, but why is the line in dark mode so strong? noticed some other components have stronger border in ur PR also while in prod are weaker.

should be "background medium token" which should be "#333333"

That's wierld, I think the changes in #14931 lead to this problem

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

should be fine now

@corwintines corwintines self-assigned this Mar 24, 2025
Copy link
Copy Markdown
Member

@corwintines corwintines left a comment

Choose a reason for hiding this comment

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

Great job on this so far @JoeChenJ!

I just have a couple changes, and one note.

I think for consistency sake across the site, we should have this above the feedback card. I think the pages I noticed where it wasn't and it looked odd for me was:

  • /what-is-ethereum
  • /run-a-node
  • /get-eth
  • /gas
  • /wallets

There may have been some conflicting feedback on this before, but chatted with @nloureiro and @konopkja today to confirm this.

Thats the main design change for this, but I have one note to add to let you know about. We will be bringing in #15114 shortly, which changes the path for these react pages. I want to bring that PR in first, and then check if we need to make any changes to the getPageContributorInfo function in @/lib/utils/contributors.ts.

Overall, this is great and excited to get this in. For me just the little design cleanup, and then spot checking the functionality after that other PR is brought in.

@wackerow
Copy link
Copy Markdown
Member

Second that...

Will try to help add clarity on the changes the above PR will bring.

Page components are getting moved to a new location, but also being split into two files. One will be the base page (server component), and the other will contain any client-side logic.

By example, let's look at the bug-bounty page:

  • Existing location would be at src/pages/[locale]/bug-bounty.tsx
  • With the App Router changes coming, this file is moved to app/[locale]/bug-bounty/page.tsx.
  • Simultaneously, the component logic has been extracted to app/[locale]/bug-bounty/_components/bug-bounty.tsx.

@pettinarip Correct me if I'm wrong, but to my understand the existing page components (src/pages/[locale]/bug-bounty.tsx) was git mv'd to the _components subdirectory (app/[locale]/bug-bounty/_components/bug-bounty.tsx) so the history came with it... and the page.tsx component was created new... as such, it should be sufficient to merge the git commit history from these two new files to get the correct resulting list of contributors.

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

Second that...

Will try to help add clarity on the changes the above PR will bring.

Page components are getting moved to a new location, but also being split into two files. One will be the base page (server component), and the other will contain any client-side logic.

By example, let's look at the bug-bounty page:

  • Existing location would be at src/pages/[locale]/bug-bounty.tsx
  • With the App Router changes coming, this file is moved to app/[locale]/bug-bounty/page.tsx.
  • Simultaneously, the component logic has been extracted to app/[locale]/bug-bounty/_components/bug-bounty.tsx.

@pettinarip Correct me if I'm wrong, but to my understand the existing page components (src/pages/[locale]/bug-bounty.tsx) was git mv'd to the _components subdirectory (app/[locale]/bug-bounty/_components/bug-bounty.tsx) so the history came with it... and the page.tsx component was created new... as such, it should be sufficient to merge the git commit history from these two new files to get the correct resulting list of contributors.

Unfortunately, the commit history didn't carry over to the new path, if we merge app/[locale]/bug-bounty/page.tsx and app/[locale]/bug-bounty/_components/bug-bounty.tsx, we are only getting history starting from #15114 🫠

@JoeChenJ JoeChenJ force-pushed the Use_new_design_for_FileContributors branch 2 times, most recently from 1240255 to 0319ac9 Compare March 31, 2025 17:09
@konopkja konopkja added the high priority This has a high priority label Apr 23, 2025
Copy link
Copy Markdown
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

From a design / UI side this looks great..

From a data side, the GitHub API does not seem to be returning quite what we need here.

During the "app router" migration we used git mv to bring the git commit history along with the file, but we're not actually using the true git history here (since that isn't available to Netlify during build) but instead we're hitting the GitHub API, which does not seem to be bringing the commit history we need.

I think we need to figure that out a big more before we display this component with a bunch of inaccurate information.


One nuance to the API, it doesn't seem to bring git history when a file is move... you have to query for that old path. So as part of this we may (unfortunately) need to check src/pages/[locale]/<pagename>.tsx as well, for example:

https://api.github.com/repos/ethereum/ethereum-org-website/commits?path=src%2Fpages%2F%5Blocale%5D%2Fbug-bounty.tsx&sha=master

https://api.github.com/repos/ethereum/ethereum-org-website/commits?path=src%2Fpages%2F%5Blocale%5D%2Frun-a-node.tsx&sha=master

... but again, the data returned isn't even correct... for example, I originally built the run-a-node.tsx page, but the above query returns only a few commits by Pablo.

cc: @pettinarip we may need to figure out another way to index this information 🤔

@JoeChenJ
Copy link
Copy Markdown
Contributor Author

From a design / UI side this looks great..

From a data side, the GitHub API does not seem to be returning quite what we need here.

During the "app router" migration we used git mv to bring the git commit history along with the file, but we're not actually using the true git history here (since that isn't available to Netlify during build) but instead we're hitting the GitHub API, which does not seem to be bringing the commit history we need.

I think we need to figure that out a big more before we display this component with a bunch of inaccurate information.

One nuance to the API, it doesn't seem to bring git history when a file is move... you have to query for that old path. So as part of this we may (unfortunately) need to check src/pages/[locale]/<pagename>.tsx as well, for example:

https://api.github.com/repos/ethereum/ethereum-org-website/commits?path=src%2Fpages%2F%5Blocale%5D%2Fbug-bounty.tsx&sha=master

https://api.github.com/repos/ethereum/ethereum-org-website/commits?path=src%2Fpages%2F%5Blocale%5D%2Frun-a-node.tsx&sha=master

... but again, the data returned isn't even correct... for example, I originally built the run-a-node.tsx page, but the above query returns only a few commits by Pablo.

cc: @pettinarip we may need to figure out another way to index this information 🤔

FYI if we query all of the following paths:

  • src/pages/[locale]/<pagename>.tsx
  • src/pages/<pagename>.tsx
  • app/[locale]/<pagename>/page.tsx
  • app/[locale]/<pagename>/_components/<pagename>.tsx

we can generally reconstruct the full commit history. For example:

That said, I'm wondering is there a more sustainable way to trace file history across renames/moves?

Copy link
Copy Markdown
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

Ah, great catch @JoeChenJ!! Thanks for this reminder that there are even more paths we need to check... I found that there are actually two more missing from that list (the same two src paths but for when we nested an index):

  • src/pages/[locale]/<pagename>/index.tsx
  • src/pages/<pagename>/index.tsx

So, I went ahead and pulled these SIX paths out into a separate function so we can pass a pagePath and get the list of paths that we need to fetch... then it uses a reducer to fetch each one and spread it into a single array.

image

^ Testing locally this is working great now, pulling alll the contributors for all the React pages, which was my primary blocker.... approving and pulling this in, thanks again for the help!

Copy link
Copy Markdown
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

All the pages that this touches are not loading in the current build, despite them working for me locally.. need to investigate before pulling in

wackerow added 3 commits May 17, 2025 14:22
refactor to more precise naming. Create getAppPageLastCommitDate for react page history fetches. Throw error at build if contributor information not available.
make date required for last commit from github data; 0 date fallback from crowdin contributor data
Copy link
Copy Markdown
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

Great! I think this is finally working.. had to adjust how we checked the "last edit date" for these files... with the markdown files, they live in /public/content so the git log approach works, but with these files we don't have access to the git history, so we need to use the last GitHub contribution.

I've updated to account for this, and double checked the pages we were having problems with and it looks good to go.. thanks for the help here @JoeChenJ!

@wackerow wackerow merged commit cce14aa into ethereum:dev May 20, 2025
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content 🖋️ This involves copy additions or edits high priority This has a high priority tooling 🔧 Changes related to tooling of the project translation 🌍 This is related to our Translation Program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants