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

Added timer component for time sensitive promotions. #108

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

iggy18
Copy link

@iggy18 iggy18 commented Jan 11, 2022

I've made a timer component.

it's easy to use.
<CountDownTimer date="Mon, 12 Jan 2022 08:43:00 GMT" />

I saw that previous time-sensitive promotions had an end date set in GMT so I made sure that format works with this timer component. you can drop it in anywhere you need a countdown.

I wasn't sure if it would be better to have it disappear when time is up or display a temporary message. I went with a temporary message but If there are any changes you'd like me to make just let me know.

@brenzi
Copy link
Contributor

brenzi commented Jan 11, 2022

Thanks a lot. @mosonyi may I ask you to have look and test this?

@mosonyi
Copy link
Collaborator

mosonyi commented Jan 13, 2022

@anizeani please review this. thanks.

@anizeani
Copy link
Contributor

anizeani commented Jan 14, 2022

I approve:
image
the countdown timer works, just needs to be adapted to the ui.
I suggest to hardcode the enddate, because it doesnt change (only for next crowdloan).
But if we plan on doing many crowdloans, we could get it by api call.. though I recieved from api.query.crowloan.funds(2015) => 11,391,600 (which i don't know what it means..if it would be epochs or unix, its far to small... did we change parachain id?
Same paraid, and its the end block
If we chose hardcoded date:
Is this date correct: 'Mon, 14 Feb 2022 04:20:00 GMT' ? (I'm not sure if GMT is correct!)
image

@iggy18
Copy link
Author

iggy18 commented Jan 16, 2022

I picked GMT as the input because I'd seen that format used on the site before, but it works with UTC as well. It can parse a string containing a numeric UTC offset from any time zone.

I can look into getting the end date from an API call as I learn more about the substrate front-end template. sounds like a fun learning exercise.

If there are any changes you want me to make, just let me know.

@anizeani
Copy link
Contributor

Great thanks. From what I understood, you can get from the query i mentioned above the end block. Knowing the estimated block time (i think its 6 min) you can estimate the end time. But I'm not sure if there is a more accurate way to know the end time. Maybe ask @brenzi, he probably knows better

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.

4 participants