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

Feat(banner) hide #7058

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Feat(banner) hide #7058

wants to merge 6 commits into from

Conversation

AugustinMauroy
Copy link
Contributor

Description

A little while ago we discussed hiding the banner, and since then there have been no major objections, so I've opened this pr to implement it.

Related Issues

close #6292

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run format to ensure the code follows the style guide.
  • I have run npm run test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

Copy link

vercel bot commented Sep 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Sep 26, 2024 7:29am

@AugustinMauroy AugustinMauroy marked this pull request as ready for review September 24, 2024 10:09
@AugustinMauroy AugustinMauroy requested a review from a team as a code owner September 24, 2024 10:09
Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer left a comment

Choose a reason for hiding this comment

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

functionally this works on the preview pretty simply
found one typo
have one small concern about relying on good JSON data in site.json

apps/site/components/Common/Banner/index.tsx Outdated Show resolved Hide resolved
};

const Banner: FC<PropsWithChildren<BannerProps>> = ({
type = 'default',
link,
onHiding,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest a different name here. onHiding to me implies it's a handler, when it's really a conditional state or mode that the banner can opt-into.

isHideable would not the boolean nature, and nod to the story name Hideable

packages/i18n/locales/en.json Outdated Show resolved Hide resolved

const WithBanner: FC<{ section: string }> = ({ section }) => {
const banner = siteConfig.websiteBanners[section];
const UUID = twoDateToUIID(banner.startDate, banner.endDate);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: at first glance, I thought we were using the uuid package here due to the name. Not sure if it needs to change, but calling attention to the momentary confusion. I think the way you did this was clever overall.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can call it generatekeyForBanner. But UIID mean Universally unique identifier.

Comment on lines +33 to +34
const date1String = date1.split('T')[0];
const date2String = date2.split('T')[0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

nothing seems to enforce this as a a proper date string over within site.json, which could lead to bugs or errors here splitting on T

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll have to reread the split docs because split automatically gives you a table that can be unique.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But we can also use new Date and throw error if not right date

AugustinMauroy and others added 2 commits September 26, 2024 09:25
Co-authored-by: Brian Muenzenmeyer <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>
Co-authored-by: Brian Muenzenmeyer <[email protected]>
Signed-off-by: Augustin Mauroy <[email protected]>

const WithBanner: FC<{ section: string }> = ({ section }) => {
const banner = siteConfig.websiteBanners[section];
const UUID = twoDateToUIID(banner.startDate, banner.endDate);
Copy link
Member

Choose a reason for hiding this comment

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

This feels so weird.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

I'm not sure about this PR. Sure, maybe being able to close the banner is nice... But how many people actually want this / or are frustrated with the banner?

Becazse as a technical change, I'm not a fan of using local storage just for this, and there are many other little technical details that are ehh, also not OK, not to mention the whole hacky and weird UUID logic.

I just overall don't feel confident with these changes and how much garbage we are adding just to have a single X button. The benefits are just not there.

@AugustinMauroy
Copy link
Contributor Author

also not OK, not to mention the whole hacky and weird UUID logic.

We can base the logic on dates and not a UIID.

I just overall don't feel confident with these changes and how much garbage we are adding just to have a single X button. The benefits are just not there.

I understand your point of view. I sent a message on slack to get a sample of opinions. And based on that:

  • Either we abandon the changes.
  • Or we find a clean solution to implement it.

Note that Caner had suggested using cookies, which has two advantages:

  • the function for reading them is provided by next
  • there's no more layout shift
    But we don't know what this means from a legal point of view
    ref: Feat(banner) hide #7058 (comment)

@ovflowd
Copy link
Member

ovflowd commented Oct 1, 2024

also not OK, not to mention the whole hacky and weird UUID logic.

We can base the logic on dates and not a UIID.

I just overall don't feel confident with these changes and how much garbage we are adding just to have a single X button. The benefits are just not there.

I understand your point of view. I sent a message on slack to get a sample of opinions. And based on that:

  • Either we abandon the changes.

  • Or we find a clean solution to implement it.

Note that Caner had suggested using cookies, which has two advantages:

  • the function for reading them is provided by next

  • there's no more layout shift

But we don't know what this means from a legal point of view

ref: #7058 (comment)

Im fine with the feature -- Im just pretty much saying your code is not good, and I won't allow it to get merged on the state it is, sorry.

I might have more bandwidth in the future; But still I'm not sure about how much value we get from hiding banners. And this is such a small change that genuinely speaking bothering core collaborators to interfere here is overkill and unnecessary.

Some banners should just stay there, and I don't think you should make an UUID based on the dates. You could simply create a hash based on the banner entry itself (the json blob)

I also don't have the time at the moment to propose code changes or to coach you here. For me it is more valuable for Caner to take over your PR if we decide to move forward with this. Which I doubt we will.

Sorry, Augustin 😅

@ovflowd
Copy link
Member

ovflowd commented Oct 1, 2024

I forgot to comment regarding:

But we don't know what this means from a legal point of view

Just a FYI although it is a cookie, we could consider these to be functional 1st party cookies as they store user preferences.

Nothing is really done with them, I doubt on a GDPR standpoint anything needs to be done. Just so you know, the "legal concerns" you have are not limited to cookies, they also apply to localStorage.

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.

Feat(banner): take place on screen, should we add the possibility of hide
5 participants