-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Conversation
@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 :) |
function getRandomId() { | ||
const currentId = randomIdRef.current | ||
if (currentId !== null) { | ||
return currentId | ||
} | ||
const newId = Math.floor(Math.random() * 10000) | ||
randomIdRef.current = newId | ||
return newId | ||
} |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK sweet.
This is really great :) |
I'm going to merge this, then see if I can sort the other one :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
Let's go! |
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 contributionswidth
the width of the svg to drawheight
the height of the svg to drawThe 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.)
New component files:
app/javascript/components/progress-graph/ProgressGraph.tsx
app/javascript/components/progress-graph/svg-graph-util.ts
app/helpers/react_components/progress_graph.rb
It has been added to two pages:
app/css/pages/journey/overview.css
app/views/journey/show.html.haml
app/css/pages/track-show-joined.css
app/views/tracks/show/joined/_summary_article.html.haml