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 jalezi/sozial marie banner 466 #474

Merged
merged 44 commits into from
Apr 8, 2024

Conversation

jalezi
Copy link
Collaborator

@jalezi jalezi commented Mar 14, 2024

Adds popup for SozialMarie voting.
Users can decide whether a popup will show on the initial load. They can trigger a popup by clicking on a button in the header. The trigger button has a tooltip showing remaining time to voting, remaining time to vote or whether the voting has ended.

Trigger button:
Screenshot 2024-03-14 at 10 23 24

Styling is not done. Open for recommendations.
I prepared two components to show the timer in the popup.

Simple:
Screenshot 2024-03-14 at 10 06 40

Full:
Screenshot 2024-03-14 at 10 08 59

I prefer the simple version.

After voting has expired this will show up:
Screenshot 2024-03-14 at 10 10 26

Todo:

  • some short text about SozialMarie
  • proper link to voting site
  • styling

FIX: #466

@jalezi jalezi requested review from stefanb and SterArcher March 14, 2024 09:26
@jalezi jalezi marked this pull request as draft March 14, 2024 09:27
@jalezi
Copy link
Collaborator Author

jalezi commented Mar 14, 2024

he, he found the first bug. Don't show does not work as expected.

const roundedInitialTime = Math.floor((countDownDate - currentDate) / 1000) * 1000;
const [timeLeft, setTimeLeft] = useTimer(roundedInitialTime);

const [show, updateShow] = useLocalStorage('showSozialMarie', 'first');
Copy link
Member

Choose a reason for hiding this comment

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

Popup is shown even if user ticks the checkbox to not show it again and the value "no-show" is persisted into the local storage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like I fixed it.

Alternatively the text should be "Don't show this again until the voting starts", so that the users are reminded again when they can vote and then they can silence the popup for good.

Before voting starts the value is "remind-me" and during voting "no-show".

@jalezi
Copy link
Collaborator Author

jalezi commented Mar 14, 2024

Is there a specific process.env var for deploy-preview? Something like in dev mode.

const isDev === process.env.NODE_ENV === "development"

@jalezi
Copy link
Collaborator Author

jalezi commented Mar 14, 2024

Hm, safari, does not recognize new Date("2024-04-09 GMT+0200"). gives an INVALID_DATE.

https://sagrawal003.medium.com/javascripts-date-does-not-work-with-ie-safari-technolize-your-future-c49c09dc4d87

new Date("YYYY-MM-DD HH:MM GMT+0200") is "Invalid Date"
Copy link
Contributor

@SterArcher SterArcher left a comment

Choose a reason for hiding this comment

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

Please see changes requested on Slack.

jalezi and others added 16 commits March 16, 2024 08:01
use valid time duration format
The date is set to "Tue Apr 02 2024 00:00:00 GMT+0200"
For developing all the dates are configured based on now + delays.
env var (.env.development) REACT_APP_SM_SHOW_TRIGGER_BUTTON_IMMEDIATELY=false respects delays.
For testing set to true.
Don't have better solutions ATM.
if SM popup is open and user change locale, some translations are not applied due to memoization.
if SM popup is open and user change locale, some translations are not applied due to memoization.
@jalezi jalezi marked this pull request as ready for review April 8, 2024 11:29
throw new Error('DELAY_TO_HIDE_ALERT should be less than DELAY_TO_HIDE_TRIGGER');
}

const SOZIAL_MARIE_LINK = `https://www.sozialmarie.org/${i18n.language === 'it' ? 'en' : i18n.language}/projects/9280/`;
Copy link
Member

@stefanb stefanb Apr 8, 2024

Choose a reason for hiding this comment

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

Link is always https://www.sozialmarie.org/sl/projects/9280/ for some reason, regardless of language.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this 80a72fc should fix link issue

@stefanb stefanb merged commit 0d008e5 into master Apr 8, 2024
6 checks passed
@stefanb stefanb deleted the feat-jalezi/sozial-marie-banner-466 branch April 8, 2024 11:53
stefanb added a commit that referenced this pull request Apr 19, 2024
stefanb added a commit that referenced this pull request Apr 27, 2024
Reverts "Feat jalezi/sozial marie banner #466 (#474)"
This reverts commit 0d008e5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SozialMarie award public voting
3 participants