-
Notifications
You must be signed in to change notification settings - Fork 78
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
Implement timer for tBTC Rewards interval #2212
Conversation
Implemented timer on tBTC Rewards page that shows when the next rewards will be released.
setRemainingMinutes(minutes - 1) | ||
} else if (remainingMinutes === 0) { | ||
setRemainingMinutes(59) | ||
if (remainingHours > 0) { |
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.
nested ifs... 🤯 out of idea now how we can do better, but let's keep 👀 on that.
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.
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?
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.
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 😆
Change Timer component props so it uses timestamp in units instead of days, hours, minutes and seconds.
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.
Looks good 👍 just left one comment.
Refactor Timer component to make sure targetInUnix prop is indeed a timestamp in unix instead of a moment object as it was before.
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.
let's
This PR implements a timer on the tBTC Rewards page that shows when the next rewards will be released.