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

Download bundle UX improvement #2453

Merged

Conversation

vibros68
Copy link
Contributor

@vibros68 vibros68 commented Jun 22, 2021

resolved #2438
resolved #2461

Description

adjust download bundle: show loading wheel while the data is being fetched; show progress for paginated downloads only when there are more than 1 page

…tched; show progress for paginated downloads only when there are more than 1 page
@lukebp
Copy link
Member

lukebp commented Jun 22, 2021

This doesn't appear to be updating the % complete correctly.

tmp-2021-06-22_10.40.57.mp4

You can use the pictl seedproposals [adminEmail] [adminPassword] command to seed your backend with proposals that contain 150 comments each in order to test out the paginated timestamps.

@vibros68
Copy link
Contributor Author

vibros68 commented Jun 22, 2021

I fixed it. Thank you for guidance

Copy link
Member

@lukebp lukebp left a comment

Choose a reason for hiding this comment

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

I'm seeing two issues.

  1. A ticketvote/v1/details request is being made when you load the proposal details page. This is a expensive route and should only be retrieved when the votes bundle is being downloaded.
  2. Downloading the votes bundle does not download the actual cast votes.

@@ -59,7 +60,7 @@ export function useDownloadCommentsTimestamps(recordToken) {
const getProgressPercentage = useCallback(
(timestamps) =>
timestamps
? (Object.keys(timestamps.length * 100) / commentsLength).toFixed(2)
? ((Object.keys(timestamps).length * 100) / commentsLength).toFixed(2)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to show decimal places on these % complete indicators. Instead of 66.67%, lets just show 67%.

Copy link
Member

@victorgcramos victorgcramos left a comment

Choose a reason for hiding this comment

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

Hey @vibros68, thanks for the PR. Left some inline comments in addition to luke's review.

useDownloadCommentsTimestamps(recordToken);

return loading ? (
<div>
<span style={{ marginRight: 10 }}>{progress}%</span>
{multiPage ? <span style={{ marginRight: 10 }}>{progress}%</span> : <></>}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{multiPage ? <span style={{ marginRight: 10 }}>{progress}%</span> : <></>}
{multiPage && <span style={{ marginRight: 10 }}>{progress}%</span>}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you


return loading ? (
<div>
<span style={{ marginRight: 10 }}>{progress}%</span>
{multiPage ? <span style={{ marginRight: 10 }}>{progress}%</span> : <></>}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{multiPage ? <span style={{ marginRight: 10 }}>{progress}%</span> : <></>}
{multiPage && <span style={{ marginRight: 10 }}>{progress}%</span> }

Comment on lines 35 to 41
<div>
<DownloadJSON
label={"Comments Timestamps"}
fileName={`${recordToken}-comments-timestamps`}
content={timestamps}
/>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Wrapping this inside a <div> element creates an odd alignment on the download progress. See:

Screen Shot 2021-06-28 at 5 37 10 PM

@lukebp
Copy link
Member

lukebp commented Jun 29, 2021

A ticketvote/v1/details request is being made when you load the proposal details page. This is a expensive route and should only be retrieved when the votes bundle is being downloaded.

This is an issue on master. It was not introduce by this pull request. Please disregard this comment.

@lukebp
Copy link
Member

lukebp commented Jun 29, 2021

Two pre-existing bugs were discovered during review of this pull request. #2460 and #2461.

This pull request does not need to fix 2460, but it should assume that the vote details call is being removed and should not rely on the vote details being available prior to download. 2461 should be fixed in this pull request.

To accomplish both of these it should:

  1. Retrieve the vote details when the Votes Bundle button is clicked.
  2. Retrieve the vote results when the Votes Bundle button is clicked.
  3. Populate the Votes Bundle correctly with the retrieved data.

@vibros68 vibros68 force-pushed the 2438_Download_bundle_UX_improvement branch from 5d613f8 to 6f12a0a Compare July 5, 2021 02:22
@vibros68 vibros68 requested review from lukebp and victorgcramos July 5, 2021 04:26
Copy link
Member

@victorgcramos victorgcramos left a comment

Choose a reason for hiding this comment

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

Progress percentage is till with a wrong alignment. It should be vertically centralized with the progress circle.

Screen Shot 2021-07-05 at 4 28 34 PM

auths: voteSummary?.details?.auths,
details: voteSummary?.details?.details,
votes: voteSummary?.votes,
serverpublickey
};
return <DownloadJSON fileName={fileName} label={label} content={bundle} />;
return <DownloadJSON fileName={fileName} label={label} content={bundle} />;*/
Copy link
Member

Choose a reason for hiding this comment

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

comment

Comment on lines 337 to 342
/*const bundle = {
auths: voteSummary?.details?.auths,
details: voteSummary?.details?.details,
votes: voteSummary?.votes,
serverpublickey
};
Copy link
Member

Choose a reason for hiding this comment

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

comment

Copy link
Member

@lukebp lukebp left a comment

Choose a reason for hiding this comment

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

The UX is looking good. See the comment about the server public key though.

src/actions/api.js Show resolved Hide resolved
Copy link
Member

@lukebp lukebp left a comment

Choose a reason for hiding this comment

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

The votes bundle JSON has been changed from details to detail. You can't make changes like this. It breaks other software that expects details. Please change it back.

image

@vibros68
Copy link
Contributor Author

vibros68 commented Jul 6, 2021

I am sorry. It is fixed now

Copy link
Member

@lukebp lukebp left a comment

Choose a reason for hiding this comment

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

tACK

This looks good from a UX standpoint. Verification using politeiaverify works as expected with all bundle downloads.

@tiagoalvesdulce and @victorgcramos will need to approve the code.

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.

LGTM

Copy link
Member

@victorgcramos victorgcramos left a comment

Choose a reason for hiding this comment

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

LGTM!

@tiagoalvesdulce tiagoalvesdulce merged commit 539b697 into decred:master Jul 9, 2021
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.

Cast votes not included in bundle download Download bundle UX improvement
4 participants