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

Add progress svg graph to website journey and track show page. #1181

Merged
merged 3 commits into from
Jul 1, 2021

Conversation

neenjaw
Copy link
Collaborator

@neenjaw neenjaw commented Jul 1, 2021

This is adding an SVG component which draws a graph representing a persons contributions as a graphed line over time.

The <ProgressGraph /> component takes 3 props:

  • data an array of numbers representing contributions
  • width the width of the svg to draw
  • height the height of the svg to draw

The height and width are for the svg canvas so that the lines can be computed properly without skewing. The other properties of the graph can be styled via css properties and custom-properties. eg.)

.c-progress-graph {
  height: 120px;
  width: 300px;

  stroke-width: 4px;
  stroke-linecap: round;

  --progress-graph-first-color: rgb(15, 33, 244);
  --progress-graph-last-color: rgb(136, 30, 245);
}

New component files:

It has been added to two pages:

  1. The journey page:
    Screenshot from 2021-06-30 19-17-56
  2. The track page:
    Screenshot from 2021-06-30 19-20-42

@neenjaw neenjaw marked this pull request as ready for review July 1, 2021 01:47
@neenjaw
Copy link
Collaborator Author

neenjaw commented Jul 1, 2021

@kntsoriano, @iHiD told me that you have a React version on the journey page in PR. Not sure what the best merge plan is for this, please advise :)

Comment on lines +26 to +34
function getRandomId() {
const currentId = randomIdRef.current
if (currentId !== null) {
return currentId
}
const newId = Math.floor(Math.random() * 10000)
randomIdRef.current = newId
return newId
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

generates a random number to append to the id of the gradient to prevent collision and the id being overridden by multiple graphs appearing on one page

@@ -34,6 +34,7 @@ module.exports = {
files: ['*.ts', '*.tsx'],
rules: {
'react/prop-types': 'off',
'react/display-name': 'off',
Copy link
Member

Choose a reason for hiding this comment

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

What does this do?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh I meant to write a comment for that. Basically application.tsx is full of eslint errors because for the most part we are using arrow functions to define our components. Because of that we can't set a "display name" for debugging with dev tools. Since we aren't using that react feature consistently and it is hiding other errors from showing I turned it off

Copy link
Member

Choose a reason for hiding this comment

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

OK sweet.

@iHiD
Copy link
Member

iHiD commented Jul 1, 2021

This is really great :)

@iHiD
Copy link
Member

iHiD commented Jul 1, 2021

@kntsoriano, @iHiD told me that you have a React version on the journey page in PR. Not sure what the best merge plan is for this, please advise :)

I'm going to merge this, then see if I can sort the other one :)

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

Sweet!

@iHiD iHiD merged commit 6fb01cf into exercism:main Jul 1, 2021
@iHiD
Copy link
Member

iHiD commented Jul 1, 2021

Let's go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/large Large amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants