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

Usunięcie wzmianki o kolejności szczepień #8

Open
wants to merge 92 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
362ea36
Change header styling
dzierzanowski Jan 28, 2021
0d9286a
Fix fotoer
krethh Jan 28, 2021
9559f79
Remove percent
krethh Jan 28, 2021
bcbd3c5
Change meta tag
krethh Jan 28, 2021
d4d79ec
Add a GitHub Pages CNAME file
dzierzanowski Jan 28, 2021
75c1283
Add sententes header, modify style
dzierzanowski Jan 28, 2021
ab29cde
Add og:image resources
Jan 29, 2021
a1508a4
Update og:image
dzierzanowski Jan 29, 2021
844a8a9
Add metadata
dzierzanowski Jan 29, 2021
2b51489
Update metadata
dzierzanowski Jan 29, 2021
d47df16
Update metadata
dzierzanowski Jan 29, 2021
ce5e8af
Remove bus seat calculation from view
dzierzanowski Jan 29, 2021
4d1f74a
Slim down header image
dzierzanowski Jan 29, 2021
d7362a2
Join entries for 1-4, 9-12, 13-17 and 27-28
dzierzanowski Jan 29, 2021
dc5af7d
Update data and switch format to TSV
dzierzanowski Jan 29, 2021
6a59782
Display 8 sentences
krethh Jan 29, 2021
877eb35
Fix restauracje i bary
krethh Jan 29, 2021
7ebbbe1
Add favicon
dzierzanowski Jan 29, 2021
d5c7006
Add react-breakpoints
krethh Jan 29, 2021
e043cb8
Merge branch 'master' of github.com:krethh/koronawirus.lol
krethh Jan 29, 2021
45f24c4
Fix sometimes missing value
dzierzanowski Jan 29, 2021
7c46a10
Slight refactor
krethh Jan 29, 2021
042fad5
Merge branch 'master' of github.com:krethh/koronawirus.lol
krethh Jan 29, 2021
4619ca6
Refactor snake case
krethh Jan 29, 2021
834e639
Working style on small screens
dzierzanowski Jan 30, 2021
1f9847f
Tweak responsiveness
dzierzanowski Jan 30, 2021
4b6c00d
Fix inflexion of certain number-related words
dzierzanowski Jan 30, 2021
a037750
Snapshot data, remove quotation mark filtering (.tsv format solved th…
dzierzanowski Jan 30, 2021
2eaaab7
Snapshot data
dzierzanowski Jan 30, 2021
fc9a9a3
Add dynamic button text, tweak style
dzierzanowski Jan 30, 2021
8ac277d
Add font import
dzierzanowski Jan 30, 2021
9fb6351
Add Google Analytics (ad personalization disabled)
Jan 31, 2021
7b35155
Tweak style
Jan 31, 2021
66ae2e1
Add GitHub link in footer
Jan 31, 2021
1d308bc
Change Github URL
krethh Jan 31, 2021
45e2ce4
Add social media share buttons
krethh Jan 31, 2021
4ff05ed
Change messenger share button
krethh Jan 31, 2021
7f2191e
Fix style of share button
krethh Jan 31, 2021
4da1b85
Change "heart" to "star" in GitHub reference
Jan 31, 2021
0807801
Tweak link colors
Jan 31, 2021
c90fd10
Minor style changes to templates
Jan 31, 2021
afb4610
Minor refactor sentence 19 for consistency
Jan 31, 2021
900930e
Snapshot data
Jan 31, 2021
012235e
Snapshot data
Jan 31, 2021
7ace866
Remove redundant comma
Jan 31, 2021
37e826b
Refactor
krethh Jan 31, 2021
3f42be4
Add some distance between generation button and share buttons
Jan 31, 2021
23ab4f7
Merge branch 'master' of github.com:krethh/koronawirus.lol
krethh Jan 31, 2021
3819040
Merge branch 'master' of github.com:krethh/koronawirus.lol
krethh Jan 31, 2021
4553c23
Rename React files to .jsx extension
Jan 31, 2021
b7d5aa3
Add pollyfill
krethh Jan 31, 2021
3987382
Merge branch 'master' of github.com:krethh/koronawirus.lol
krethh Jan 31, 2021
31fafb0
Add polyfill
krethh Jan 31, 2021
f8acee9
Remove unused breakpoints
krethh Jan 31, 2021
a337e46
Change polyfill declaration
krethh Jan 31, 2021
adc3c4d
Remove console.log
krethh Jan 31, 2021
094189a
Track every new generation (absolutely no user tracking)
krethh Jan 31, 2021
b63cb9e
Count views and generations
krethh Jan 31, 2021
64c22ec
Clean up GA requests
Jan 31, 2021
12a8830
Fix event category name
Jan 31, 2021
c9fe7d5
Attempt to fix missing header bug
Feb 3, 2021
c44ed57
Tweak consistency (to better suit potential words with "i")
Feb 3, 2021
47ce37c
Add readme/collaboration doc on data.tsv
Feb 3, 2021
c73fb82
Fix inflexion around sentence 33
Feb 3, 2021
88b0e25
Tweak conditions for inflexion at sentences 8 and 33
Feb 3, 2021
5e6dae0
Generate school grade range programmatically
Feb 3, 2021
a13b093
Refactor file structure and semicolons, snapshot data
krethh Feb 6, 2021
246c63c
Add IDs to list elements
Feb 3, 2021
d20b6f3
Add date of update in footer
Feb 3, 2021
fd0de9e
Tag generation events based on generation counter
Feb 3, 2021
1dd6749
Add internationalization
krethh Feb 6, 2021
6973a72
Add internationalization and update README
krethh Feb 6, 2021
c94a4c9
Remove console.log
krethh Feb 5, 2021
a3bbc4c
Add bus seat values to data
krethh Feb 6, 2021
f140ac9
Add AGPL license
Feb 6, 2021
88bc70f
Add license notice in readme, refactor readme
Feb 6, 2021
4d23107
Select language based on URL
krethh Feb 9, 2021
0f5aa48
Remove unnecessary store
krethh Feb 9, 2021
b161d22
Remove console.log
krethh Feb 9, 2021
798ba31
Adjust share URL
krethh Feb 9, 2021
ebcef52
Add English translation of the UI
Feb 9, 2021
245544e
Probe dump of english data
Feb 10, 2021
856d2bb
Fix values in English dataset
Feb 10, 2021
283637c
Localize dynamic content
Feb 10, 2021
ae7f14f
Update EN data with bus seat percentages
Feb 10, 2021
ce532cf
YOLO eject
krethh Feb 10, 2021
75f112b
Add separate index at /en
Feb 10, 2021
6790119
Localize metatags for EN
Feb 10, 2021
bdbd4ba
Tweak EN localization
Feb 10, 2021
4360912
Fix missing EN translation
krzysztof-sikorski Feb 19, 2021
89c9a55
Merge pull request #7 from krzysztof-sikorski/patch-1
Feb 19, 2021
f7d7948
Usunięcie wzmianki o kolejności szczepień
ad-m Nov 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add English translation of the UI
Waked committed Feb 10, 2021
commit ebcef525c4fa43c22d85b6c2ff7c93310a7867b9
52 changes: 28 additions & 24 deletions public/messages/en.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
{
"topBar": "Coronavirus - important information",
"topBar": "Coronavirus: PSA",
"header": "COVID-19 Restrictions Generator",
"subHeader": "Check what is and what isn't allowed today",
"infoMessage": "Kancelaria Prezesa Rady Ministrów informuje, że od {date} roku:",
"button": "GENERUJ",
"buttonGenerateNew": "GENERUJ NOWE",
"footer1": "Ta strona to żart.",
"footer2": "Po prawdziwe informacje na temat obostrzeń udaj się ",
"footer3": "tutaj.",
"footer4": "Zagwiazdkuj {star} to na {githubLogo} {githubLink}",
"footer5": "GitHubie.",
"footer6": "Ikony dzięki {freepik} przez {flaticon}",
"footer7": "Aktualizacja ",
"sentence1": "Hotele dostępne są tylko dla {0}, {1}, {2} oraz {3}.",
"sentence2": "Wszystkie osoby przybywające do Polski z {4} {5} są {6}.",
"sentence3": "W zgromadzeniach {meta70} uczestniczyć maks. {7} {meta71} (nie dotyczy {8} oraz {9}).",
"sentence4": "Obowiązuje zakaz organizacji {10} oraz {11}",
"sentence5": "Zamknięte są {12}, {13} oraz {14}. Otwarte zostaną {15} oraz {16}, ale wyłącznie w {17}.",
"sentence6": "Restauracje i bary są {18}{19}.",
"sentence7": "Nauka zdalna w klasach {20} szkół podstawowych, {21} oraz {22}, za wyjątkiem {23} (chyba, że {24}).",
"sentence8": "Żłobki i przedszkola są {25}.",
"sentence9": "W {26} i {27} może przebywać maks. jedna osoba na {28} m kw. pomieszczenia.",
"sentence10": "W godzinach {29} zakupy mogą robić tylko osoby {30}.",
"sentence11": "W autobusach {meta320} być zajęte maks. {32} {meta321} (lub {31}% wszystkich miejsc)."

"subHeader": "Find out what you can and cannot do.",
"infoMessage": "The National Health Services inform, that beginning {date}:",
"button": "GENERATE",
"buttonGenerateNew": "GENERATE AGAIN",
"footer1": "This page is a joke.",
"footer2": "Visit a {govLink} for restrictions in your area.",
"footer3": ".gov site",
"footerGovAddress": "https://travel.state.gov/content/travel/en/traveladvisories/COVID-19-Country-Specific-Information.html",
"footer4": "Give it a {star} star on {githubLogo} {githubLink}.",
"footer5": "GitHub",
"footer6": "Icons thanks to {freepik} through {flaticon}",
"footer7": "Updated ",
"sentence1": "Only {0}, {1}, {2} and {3} are allowed in hotels.",
"sentence2": "People returning to the country from {4} {5} are {6}.",
"sentence3": "At gatherings, there can be a maximum of {7} people (not including {8} and {9}).",
"sentence4": "Organising {10} and {11} is forbidden.",
"sentence5": "The {12}, {13} as well as {14} are closed. The {15} and {16} will be opened, although only on {17}.",
"sentence6": "Restaurants and bars are {18}{19}.",
"sentence7": "Remote teaching in primary school grades {20}, {21} and {22}, except {23} (unless {24}).",
"sentence8": "Nurseries and kindergartens are {25}.",
"sentence9": "In {26} and {27} there can only be a maximum of one person per {28} m².",
"sentence10": "{29} shopping is reserved for {30}.",
"sentence11": "In city buses, only up to {32} seats may be occupied (or {31}% of all seats).",
"dynamicQuarantine1": "exempt from quarantine",
"dynamicQuarantine2": "obliged to undergo quaranine for {days} days",
"dynamicRestaurant1": "closed",
"dynamicRestaurant2": ", provided {condition}"
}
20 changes: 12 additions & 8 deletions public/messages/pl.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
{
"topBar": "Koronawirus - ważne informacje",
"topBar": "Koronawirus: ważne informacje",
"header": "Generator obostrzeń COVID-19",
"subHeader": "Sprawdź, co dzisiaj wolno, a czego nie",
"infoMessage": "Kancelaria Prezesa Rady Ministrów informuje, że od {date} roku:",
"button": "GENERUJ",
"buttonGenerateNew": "GENERUJ NOWE",
"footer1": "Ta strona to żart.",
"footer2": "Po prawdziwe informacje na temat obostrzeń udaj się ",
"footer3": "tutaj.",
"footer4": "Zagwiazdkuj {star} to na {githubLogo} {githubLink}",
"footer5": "GitHubie.",
"footer2": "Po prawdziwe informacje na temat obostrzeń udaj się {govLink}.",
"footer3": "tutaj",
"footerGovAddress": "https://www.gov.pl/web/koronawirus",
"footer4": "Zagwiazdkuj {star} to na {githubLogo} {githubLink}.",
"footer5": "GitHubie",
"footer6": "Ikony dzięki {freepik} przez {flaticon}",
"footer7": "Aktualizacja ",
"sentence1": "Hotele dostępne są tylko dla {0}, {1}, {2} oraz {3}.",
"sentence2": "Wszystkie osoby przybywające do Polski z {4} {5} są {6}.",
"sentence3": "W zgromadzeniach {meta70} uczestniczyć maks. {7} {meta71} (nie dotyczy {8} oraz {9}).",
"sentence3": "W zgromadzeniach {meta_pl_7_0} uczestniczyć maks. {7} {meta_pl_7_1} (nie dotyczy {8} oraz {9}).",
"sentence4": "Obowiązuje zakaz organizacji {10} oraz {11}",
"sentence5": "Zamknięte są {12}, {13} oraz {14}. Otwarte zostaną {15} oraz {16}, ale wyłącznie w {17}.",
"sentence6": "Restauracje i bary są {18}{19}.",
"sentence7": "Nauka zdalna w klasach {20} szkół podstawowych, {21} oraz {22}, za wyjątkiem {23} (chyba, że {24}).",
"sentence8": "Żłobki i przedszkola są {25}.",
"sentence9": "W {26} i {27} może przebywać maks. jedna osoba na {28} m kw. pomieszczenia.",
"sentence10": "W godzinach {29} zakupy mogą robić tylko osoby {30}.",
"sentence11": "W autobusach {meta320} być zajęte maks. {32} {meta321} (lub {31}% wszystkich miejsc)."

"sentence11": "W autobusach {meta_pl_32_0} być zajęte maks. {32} {meta_pl_32_1} (lub {31}% wszystkich miejsc).",
"dynamicQuarantine1": "zwolnione z kwarantanny",
"dynamicQuarantine2": "zobowiązane do odbycia kwarantanny przez {days} dni",
"dynamicRestaurant1": "zamknięte",
"dynamicRestaurant2": ", pod warunkiem {condition}"
}
19 changes: 13 additions & 6 deletions src/generation-logic/generate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { chooseLanguage, shuffleArray } from '../utils'
import { useIntl } from 'react-intl'

const QUARANTINE_MIN = 7;
const QUARANTINE_MAX = 14;
@@ -56,12 +57,14 @@ function getRandom(n, data) {
function getQuarantineDecision() {
let rnd = Math.random();
if (rnd <= 0.25) {
return "zwolnione z kwarantanny";
// return "zwolnione z kwarantanny";
return intl.formatMessage({id: "dynamicQuarantine1"});
}
else {
rnd = Math.random();
const quarantine_days = QUARANTINE_MIN + Math.floor(rnd * (QUARANTINE_MAX - QUARANTINE_MIN));
return "zobowiązane do odbycia kwarantanny przez " + quarantine_days + " dni";
// return "zobowiązane do odbycia kwarantanny przez " + quarantine_days + " dni";
return intl.formatMessage({id: "dynamicQuarantine2", values: { days: quarantine_days }});
}
}

@@ -70,10 +73,13 @@ function getBusSeatsNumber(percentage) {
}

function getRestaurantState(value1, value2) {
if (value1.includes("zamknięte")) {
// if (value1.includes("zamknięte")) {
const closedStr = intl.formatMessage({id: "dynamicRestaurant1"});
if (value1.includes(closedStr)) {
return "";
}
return `, pod warunkiem ${value2}`;
// return `, pod warunkiem ${value2}`;
return intl.formatMessage({id: "dynamicRestaurant2", values: { condition: value2 }});
}

function getSchoolGradeRange() {
@@ -109,7 +115,8 @@ export default function generate() {
dict[31] = getRandom(31, data);
dict[32] = getBusSeatsNumber(dict[31]);
dict['meta'] = {};
dict['meta'][7] = (() => {
dict['meta']['pl'] = {};
dict['meta']['pl'][7] = (() => {
const n = Number(dict[7]);
if ((n % 10).between(2, 4) && !(n % 100).between(12, 14)) {
return ['mogą', 'osoby'];
@@ -118,7 +125,7 @@ export default function generate() {
return ['może', 'osób'];
}
})();
dict['meta'][32] = (() => {
dict['meta']['pl'][32] = (() => {
const n = Number(dict[32]);
if ((n % 10).between(2, 4) && !(n % 100).between(12, 14)) {
return ['mogą', 'miejsca siedzące'];
2 changes: 1 addition & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ fetch(messagesPath)
.then(response => {
ReactDOM.render(
<React.StrictMode>
<IntlProvider messages={response} locale="pl" defaultLocale="pl">
<IntlProvider messages={response} locale={language} defaultLocale={language}>
<ReactBreakpoints breakpoints={breakpoints}>
<App />
</ReactBreakpoints>
16 changes: 9 additions & 7 deletions src/ui/App.jsx
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import ShareButtons from './ShareButtons'
import AppHeader from './AppHeader'
import AppFooter from './AppFooter'
import { collectEvent, collectVisit, shuffleArray } from '../utils'
import { FormattedMessage } from 'react-intl'
import { useIntl, FormattedMessage } from 'react-intl'

const Container = styled.div`
height: 100vh;
@@ -118,10 +118,12 @@ const StyledButton = styled.button`


function App(props) {
const intl = useIntl()

/*
* Format:
* sentences[n] - value for sentence `n`
* sentences['meta'][n] - additional data for sentence `n`
* sentences['meta'][locale][n] - additional data for sentence `n` in `locale`
*/
const [sentences, setSentences] = useState(null)
const [buttonLabelId, setButtonLabelId] = useState("button")
@@ -142,17 +144,17 @@ function App(props) {
(sentences => (<Sentence key="10"><FormattedMessage id="sentence10" values={getValues(sentences, [29, 30])} /></Sentence>)),
(sentences => (<Sentence key="11"><FormattedMessage id="sentence11" values={{
...getValues(sentences, [31, 32]),
meta320: sentences['meta'][32][0],
meta321: sentences['meta'][32][1]
meta_pl_32_0: sentences['meta']['pl'][32][0],
meta_pl_32_1: sentences['meta']['pl'][32][1]
}} /></Sentence>))
]

const obligatorySentences = [
(sentences => (<Sentence key="1"><FormattedMessage id="sentence1" values={getValues(sentences, [0, 1, 2, 3])}/></Sentence>)),
(sentences => (<Sentence key="3"><FormattedMessage id="sentence3" values={{
...getValues(sentences, [7, 8, 9]),
meta70: sentences['meta'][7][0],
meta71: sentences['meta'][7][1]
meta_pl_7_0: sentences['meta']['pl'][7][0],
meta_pl_7_1: sentences['meta']['pl'][7][1]
}} /></Sentence>)),
(sentences => (<Sentence key="4"><FormattedMessage id="sentence4" values={getValues(sentences, [10, 11])} />.</Sentence>)),
(sentences => (<Sentence key="9"><FormattedMessage id="sentence9" values={getValues(sentences, [26, 27, 28])} /></Sentence>)),
@@ -173,7 +175,7 @@ function App(props) {
year: 'numeric'
};

const date = (new Date()).toLocaleDateString('pl-PL', dateOpts)
const date = intl.formatDate(new Date(), dateOpts);

shuffleArray(optionalSentences)
const finalSentences = [
52 changes: 29 additions & 23 deletions src/ui/AppFooter.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import breakpoints from './breakpoints'
import styled from 'styled-components'
import { FormattedMessage } from 'react-intl'
import { useIntl, FormattedMessage } from 'react-intl'

const Footer = styled.div`
display: flex;
@@ -64,27 +64,33 @@ const StarIcon = styled.span`
background-repeat: no-repeat;
`

const AppFooter = ({ }) => (
<>
<Footer>
<FooterText>
<b><FormattedMessage id="footer1" /></b> <FormattedMessage id="footer2" /><a href="https://www.gov.pl/web/koronawirus"><FormattedMessage id="footer3" /></a>
<br />
<FormattedMessage id="footer4" values={{
star: <StarIcon />,
githubLogo: <GithubIcon />,
githubLink: <a href="https://github.com/808-Squad/koronawirus.lol"><FormattedMessage id="footer5" /></a>
}} />
<br />
<FormattedMessage id="footer6" values={{
freepik: <a href="https://www.freepik.com" title="Freepik">Freepik</a>,
flaticon: <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
}}/>
<br />
<FormattedMessage id="footer7" /> 4.02.2021
</FooterText>
</Footer>
</>
)
const AppFooter = ({ }) => {
const intl = useIntl()
return (
<>
<Footer>
<FooterText>
<b><FormattedMessage id="footer1" /></b>&nbsp;
<FormattedMessage id="footer2" values={{
govLink: <a href={intl.formatMessage({id: "footerGovAddress"})}><FormattedMessage id="footer3" /></a>
}} />
<br />
<FormattedMessage id="footer4" values={{
star: <StarIcon />,
githubLogo: <GithubIcon />,
githubLink: <a href="https://github.com/808-Squad/koronawirus.lol"><FormattedMessage id="footer5" /></a>
}} />
<br />
<FormattedMessage id="footer6" values={{
freepik: <a href="https://www.freepik.com" title="Freepik">Freepik</a>,
flaticon: <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
}}/>
<br />
<FormattedMessage id="footer7" /> 4.02.2021
</FooterText>
</Footer>
</>
)
}

export default AppFooter