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

chore: alert banner for HashiConf #2584

Merged
merged 5 commits into from
Oct 15, 2024

Conversation

heatlikeheatwave
Copy link
Collaborator

@heatlikeheatwave heatlikeheatwave commented Oct 11, 2024

πŸ”— Relevant links

πŸ—’οΈ What

  • alert banner to watch live stream of HashiConf on October 15th, 2024 8:30 am - 12:30 pm EDT

πŸ“Έ Design Screenshots

πŸ§ͺ Testing

  • Visit the preview link and see the alert banner is not there
  • Change the date & time on your machine to October 15th 8:30 AM and refresh the page
  • The alert banner should be visible
  • Change the date & time on your machine to October 15th 12:31 PM and refresh the page
  • The alert banner should not be visible

@heatlikeheatwave heatlikeheatwave self-assigned this Oct 11, 2024
Copy link

vercel bot commented Oct 11, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
dev-portal βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Oct 15, 2024 0:10am

@heatlikeheatwave heatlikeheatwave requested review from a team, EnMod and prestonbourne and removed request for a team and EnMod October 11, 2024 19:53
Copy link

github-actions bot commented Oct 11, 2024

πŸ“¦ Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action πŸ€–

This PR introduced no changes to the javascript bundle πŸ™Œ

Copy link
Collaborator

@RubenSandwich RubenSandwich left a comment

Choose a reason for hiding this comment

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

We have a timezone bug as we are compare across timezones.

const [isDuringHashiConf, setIsDuringHashiConf] = useState(false)

useEffect(() => {
const now = new Date().getTime() // current date & time
Copy link
Collaborator

Choose a reason for hiding this comment

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

@heatlikeheatwave we have a timezone bug here. Namely we are getting a random timezone but then comparing it to PST, which could mean they are already in Hashiconf time when Hashiconf hasn't even started yet. We need to get the users timezone in PST to accurately compare to PST.

So now should be:
const now = new Date().toLocaleString('en-US', { timeZone: 'America/Los_Angeles' })

Copy link
Collaborator

@RubenSandwich RubenSandwich Oct 11, 2024

Choose a reason for hiding this comment

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

Actually that is just going to just return the string. I think we should import something like: https://day.js.org/en/ and use it's date manipulation much easier.

As we need to:

  1. Get the users date
  2. Set the users date timezone to PST
  3. Compare that date between two different PST timezones

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shouldn't it be EDT since the conference is in Boston?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also, great catch with this!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Dates. Why you so hard. 😒

Copy link
Contributor

Choose a reason for hiding this comment

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

Y'all are making it happen with more πŸ‘οΈ on the code.

Copy link
Collaborator Author

@heatlikeheatwave heatlikeheatwave Oct 11, 2024

Choose a reason for hiding this comment

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

@RubenSandwich I tested this again, and I don't think this has the bug you described. I changed my location and time on my machine to west coast and europe; the visibility of the banner worked as expected. What am I missing that you're seeing?

I do agree that the pacific time zone (.e.g -8:00 in the time stamp) can be changed. That was a mistake on my part.

I think by converting the dates to unix timestamps that removes any confusion about timezones, no?

@heatlikeheatwave heatlikeheatwave changed the title chore: Time controlled alert banner for HashiConf chore: alert banner for HashiConf Oct 15, 2024
@@ -6,7 +6,7 @@
// Third-party imports
import classNames from 'classnames'
import AlertBanner from '@hashicorp/react-alert-banner'
import { HTMLAttributes, useState } from 'react'
import { HTMLAttributes, useEffect, useState } from 'react'
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the useEffect is used? But as long as the linter doesn't complain and it builds I have no issue with it.

Copy link
Collaborator

@RubenSandwich RubenSandwich 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. πŸ‘πŸ»

@heatlikeheatwave heatlikeheatwave merged commit 89eae21 into main Oct 15, 2024
8 of 9 checks passed
@heatlikeheatwave heatlikeheatwave deleted the heat/hashiconf/alert-banner-day-one branch October 15, 2024 12:13
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.

3 participants