-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
Calculate time difference in days, hours, minutes, and seconds.
Add translations for "votingHasEnded" in en.json and sl.json
he, he found the first bug. Don't show does not work as expected. |
src/components/SozialMarie/index.jsx
Outdated
const roundedInitialTime = Math.floor((countDownDate - currentDate) / 1000) * 1000; | ||
const [timeLeft, setTimeLeft] = useTimer(roundedInitialTime); | ||
|
||
const [show, updateShow] = useLocalStorage('showSozialMarie', 'first'); |
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.
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.
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.
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".
Is there a specific const isDev === process.env.NODE_ENV === "development" |
Hm, safari, does not recognize |
new Date("YYYY-MM-DD HH:MM GMT+0200") is "Invalid Date"
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.
Please see changes requested on Slack.
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.
src/components/SozialMarie/index.jsx
Outdated
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/`; |
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.
Link is always https://www.sozialmarie.org/sl/projects/9280/ for some reason, regardless of language.
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.
this 80a72fc should fix link issue
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:
Styling is not done. Open for recommendations.
I prepared two components to show the timer in the popup.
Simple:
Full:
I prefer the simple version.
After voting has expired this will show up:
Todo:
FIX: #466