decred / politeiagui

ISC License
62 stars 56 forks source link

feat: Proposal votes download #2865

Closed victorgcramos closed 1 year ago

victorgcramos commented 1 year ago

This PR adds proposal votes downloads on politeia app-shell, and changes the approach used to fetch and integrate proposal downloads.

Changes were required after noticing that downloads were being canceled on routes changes, and since the ticketvote timestamps has an average 3h of download time on mainnet, users ended up having their navigation "blocked" in order to avoid download to be canceled.

This PR also adds the support for background downloads by adding global services handlers on our appSetup.

Closes #2864

packages/comments

packages/common-ui

packages/core

packages/icketvote

apps/politeia

Preview

2865-proposal-progress-bar-route-change

victorgcramos commented 1 year ago

@tiagoalvesdulce Moving downloads services to core package is a good suggestion. I agree with it, but I'd like to share my thoughts with you. I don't think we should handle them as a pi service, since the pi plugin is implemented by the politeia app-shell, and we don't intend to use it elsewhere. Therefore, we would have to implement (copy/paste) the download service for each other app we create.

Initially, I thought of progress to be just an "UI indicator", without much complexity around it, and this is why I didn't name it "download". This service is supposed to track the progress percentage of some external request, and not handle downloads itself. I couldn't think of a non-UI usage for this service...

As you said on your example, if we want to send an e-mail after some download finishes, we can create an "email service" to listen to our downloads, with an effect that sends you the downloaded payload.

tiagoalvesdulce commented 1 year ago

Yeah, I agree it's a UI service, but I think it should be available to developers outside the common-ui if they want to use another UI framework, like angular or vue to develop since this service is vanillaJs.