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

Implement timer for tBTC Rewards interval #2212

Merged

Conversation

michalsmiarowski
Copy link
Contributor

@michalsmiarowski michalsmiarowski commented Dec 14, 2020

This PR implements a timer on the tBTC Rewards page that shows when the next rewards will be released.

image

Implemented timer on tBTC Rewards page that shows when the next rewards will be
released.
solidity/dashboard/src/components/Timer.jsx Outdated Show resolved Hide resolved
solidity/dashboard/src/utils/rewardsHelper.js Outdated Show resolved Hide resolved
solidity/dashboard/src/pages/rewards/TBTCRewardsPage.jsx Outdated Show resolved Hide resolved
solidity/dashboard/src/components/Timer.jsx Outdated Show resolved Hide resolved
setRemainingMinutes(minutes - 1)
} else if (remainingMinutes === 0) {
setRemainingMinutes(59)
if (remainingHours > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nested ifs... 🤯 out of idea now how we can do better, but let's keep 👀 on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One way to get cleaner code would be to keep the remainingSeconds only and then when displaying we could format it with moment js. However, I don't think it will be efficient to do such thing every re-render (which means every sec). Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

However, I don't think it will be efficient to do such thing every re-render (which means every sec)

Agree. Let's keep it in mind, maybe someday we'll do it better 😆

@liz-shinn liz-shinn added the 🗝️ token dashboard Related to KEEP token dashboard label Dec 14, 2020
@liz-shinn liz-shinn added this to the token-dashboard/v1.5.0 milestone Dec 14, 2020
Change Timer component props so it uses timestamp in units instead of days,
hours, minutes and seconds.
Copy link
Contributor

@r-czajkowski r-czajkowski left a comment

Choose a reason for hiding this comment

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

Looks good 👍 just left one comment.

solidity/dashboard/src/components/Timer.jsx Outdated Show resolved Hide resolved
Refactor Timer component to make sure targetInUnix prop is indeed a timestamp in
unix instead of a moment object as it was before.
Copy link
Contributor

@r-czajkowski r-czajkowski left a comment

Choose a reason for hiding this comment

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

let's :shipit:

@r-czajkowski r-czajkowski merged commit 88590b6 into new-rewards-mechanism-dapp Dec 15, 2020
@r-czajkowski r-czajkowski deleted the new-rewards-mechanism-dapp-timer branch December 15, 2020 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗝️ token dashboard Related to KEEP token dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants