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

Proposals: Enable diff visualization of old versions #949

Merged
merged 4 commits into from Dec 21, 2018

Conversation

fernandoabolafio
Copy link
Member

@fernandoabolafio fernandoabolafio commented Dec 20, 2018

This PR enables diff visualization of old proposals versions
closes #939

Copy link
Member

@tiagoalvesdulce tiagoalvesdulce left a 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.

}
onToggleFIlesDiff = e => {
e.preventDefault();
this.setState({
Copy link
Member

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

filesDiff: false
};
}
onToggleFIlesDiff = e => {
Copy link
Member

Choose a reason for hiding this comment

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

Should be hanleToggleFilesDiff

</Modal>
);
class Diff extends React.Component {
constructor(props) {
Copy link
Member

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 [];
Copy link
Member

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) {
Copy link
Member

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
Copy link
Member

Cool, the code looks good to me now. Thanks!
I think the select component could be placed under Edit and See on Github.

screen shot 2018-12-21 at 11 50 26

Also, the select component is not updating the version when one is selected. We could change the cursor to pointer in the options as well.

gifbugselect

@fernandoabolafio
Copy link
Member Author

@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:
screen shot 2018-12-21 at 1 11 01 pm

@tiagoalvesdulce
Copy link
Member

Cool, looks way better now.

@tiagoalvesdulce tiagoalvesdulce merged commit c9c40a7 into decred:master Dec 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply Revision diff component
3 participants