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

Resolve Todo at src/components/BugBountyCards.js:111 on dev Branch #4303

Closed
Hakeemmidan opened this issue Oct 24, 2021 · 5 comments · Fixed by #4905
Closed

Resolve Todo at src/components/BugBountyCards.js:111 on dev Branch #4303

Hakeemmidan opened this issue Oct 24, 2021 · 5 comments · Fixed by #4905
Assignees
Labels
refactor ♻️ Changes which don't affect functionality

Comments

@Hakeemmidan
Copy link
Contributor

Hakeemmidan commented Oct 24, 2021

Is your feature request related to a problem? Please describe.

Not really a problem. Just some syntax clean-up.

I'd like to resolve the todo at src/components/BugBountyCards.js:111 on the dev branch:

// TODO move data into array & loop through
const BugBountyCards = () => (
  <CardRow>
    <Card>
      <LowLabel>
        <Translation id="page-eth2-bug-bountycard-label-1" />
  // ...

Describe the solution you'd like
Associate an index number (starting from 0) with each card and do string interpolation to change the id during the iteration. E.g.

{[0,1,2,3].map((i) => {
  <CardRow>
    <Card>
      <LowLabel>
        <Translation id=`page-eth2-bug-bountycard${i}-lowlabel` />
  // ...
})}

Nevertheless, that wouldn't work with some IDs that use words instead of numbers, such as "page-eth2-bug-bountycard-low", and each card's link. So I'd need to change those IDs to just use numbers instead of words, and have a simple array of links that has an index that's the same as its parent-card index number.

Describe alternatives you've considered
Move all existing data into an array of objects, and iterate through them.

It'd be something like this:

const bugBountyCardsInfo = [
  {
    lowLabelId: 'page-eth2-bug-bountycard-label-1',
    titleId: 'page-eth2-bug-bountycard-low',
    // ...
  },
  // ...
  {
    lowLabelId: 'page-eth2-bug-bountycard-label-7',
    titleId: 'page-eth2-bug-bountycard-critical',
    // ...
  },
  // ...
];

Which seems a little more verbose.

Additional context
Screen Shot 2021-10-24 at 9 56 31 PM
(page screenshot)

@Hakeemmidan Hakeemmidan added the feature ✨ This is enhancing something existing or creating something new label Oct 24, 2021
@Hakeemmidan
Copy link
Contributor Author

I'd like to be assigned to this issue (if possible) ( ^___^ )

@minimalsm
Copy link
Contributor

Hey @Hakeemmidan. Thanks for offering to help on this.

I agree we should refactor this (as per the todo). However because of how the translations work on ethereum.org it would be a lot of overhead to rename the labels. I think moving data into an array of objects and mapping through them is what we were looking for here.

@minimalsm minimalsm added refactor ♻️ Changes which don't affect functionality and removed feature ✨ This is enhancing something existing or creating something new labels Nov 1, 2021
@github-actions
Copy link
Contributor

This issue is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Status: Stale This issue is stale because it has been open 30 days with no activity. label Dec 17, 2021
@ShubhankarKG
Copy link
Contributor

Hey @Hakeemmidan , still working on this ? If not, can I pick this one up ?

@minimalsm minimalsm removed the Status: Stale This issue is stale because it has been open 30 days with no activity. label Dec 22, 2021
@Hakeemmidan
Copy link
Contributor Author

Hi @ShubhankarKG, thank you for reaching out! = )
Yes, I'm still working. (Kind of got busy with another task.) I'll try to get it done this week (by end of day, Sunday, 12/26/2021). If I don't, I'll pass it on to you. Thanks again ( ^__^ )

Hakeemmidan added a commit to Hakeemmidan/ethereum-org-website that referenced this issue Dec 27, 2021
minimalsm added a commit that referenced this issue Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor ♻️ Changes which don't affect functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants