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
Proposals: Enable diff visualization of old versions #949
Conversation
f2cd75d
to
d48e303
Compare
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.
I left some inline comments.
src/components/snew/Markdown/Diff.js
Outdated
} | ||
onToggleFIlesDiff = e => { | ||
e.preventDefault(); | ||
this.setState({ |
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.
Prefer passing an updater function as a param to setState
when updating state based on the previous state. https://reactjs.org/docs/react-component.html#setstate
src/components/snew/Markdown/Diff.js
Outdated
filesDiff: false | ||
}; | ||
} | ||
onToggleFIlesDiff = e => { |
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.
Should be hanleToggleFilesDiff
src/components/snew/Markdown/Diff.js
Outdated
</Modal> | ||
); | ||
class Diff extends React.Component { | ||
constructor(props) { |
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.
This constructor is useless. state = { filesDiff: false }
should do the work.
}; | ||
|
||
getProposalFilesWithourIndexMd = proposal => { | ||
if (!proposal) return []; |
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.
This could be a ternary operator. return proposal ? proposal.files.filter(file => file.name !== "index.md") : []
import { getTextFromIndexMd, formatDate } from "../../../helpers"; | ||
|
||
class ProposalVersionDiff extends React.Component { | ||
constructor(props) { |
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.
This constructor is useless.
@tiagoalvesdulce thanks for the comments. I've replaced the version picker component to a better-suited UI, a dropdown. This is how it looks now: |
Cool, looks way better now. |
This PR enables diff visualization of old proposals versions
closes #939