Skip to content

Commit

Permalink
updates country list and accounts for missing lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandersimoes committed Oct 26, 2022
1 parent d404e07 commit 1fdb7ac
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
.nvmrc
126 changes: 63 additions & 63 deletions public/data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ date,country
2022-9-28,ae
2022-9-29,vu
2022-9-30,st
2022-10-1,tv
2022-10-2,mn
2022-10-3,ec
2022-10-4,co
2022-10-5,bd
2022-10-6,sy
2022-10-7,sv
2022-10-8,bn
2022-10-9,bl
2022-10-01,tv
2022-10-02,mn
2022-10-03,ec
2022-10-04,co
2022-10-05,bd
2022-10-06,sy
2022-10-07,sv
2022-10-08,bn
2022-10-09,bl
2022-10-10,ar
2022-10-11,cg
2022-10-12,ve
Expand All @@ -139,15 +139,15 @@ date,country
2022-10-29,tl
2022-10-30,fr
2022-10-31,hu
2022-11-1,ag
2022-11-2,mf
2022-11-3,fm
2022-11-4,mp
2022-11-5,aw
2022-11-6,to
2022-11-7,kg
2022-11-8,az
2022-11-9,kh
2022-11-01,ag
2022-11-02,mf
2022-11-03,fm
2022-11-04,mp
2022-11-05,aw
2022-11-06,to
2022-11-07,kg
2022-11-08,az
2022-11-09,kh
2022-11-10,np
2022-11-11,de
2022-11-12,km
Expand All @@ -169,15 +169,15 @@ date,country
2022-11-28,vn
2022-11-29,es
2022-11-30,gi
2022-12-1,ss
2022-12-2,us
2022-12-3,qa
2022-12-4,mw
2022-12-5,ls
2022-12-6,pf
2022-12-7,si
2022-12-8,ad
2022-12-9,bb
2022-12-01,ss
2022-12-02,us
2022-12-03,qa
2022-12-04,mw
2022-12-05,ls
2022-12-06,pf
2022-12-07,si
2022-12-08,ad
2022-12-09,bb
2022-12-10,kw
2022-12-11,mx
2022-12-12,ms
Expand All @@ -200,15 +200,15 @@ date,country
2022-12-29,lv
2022-12-30,mg
2022-12-31,ro
2023-1-1,dm
2023-1-2,ye
2023-1-3,gd
2023-1-4,th
2023-1-5,ky
2023-1-6,la
2023-1-7,hn
2023-1-8,ie
2023-1-9,kp
2023-1-01,dm
2023-1-02,ye
2023-1-03,gd
2023-1-04,th
2023-1-05,ky
2023-1-06,la
2023-1-07,hn
2023-1-08,ie
2023-1-09,kp
2023-1-10,hr
2023-1-11,ge
2023-1-12,kn
Expand All @@ -231,15 +231,15 @@ date,country
2023-1-29,no
2023-1-30,ne
2023-1-31,ai
2023-2-1,gn
2023-2-2,mv
2023-2-3,ht
2023-2-4,ke
2023-2-5,bz
2023-2-6,id
2023-2-7,jm
2023-2-8,ma
2023-2-9,iq
2023-2-01,gn
2023-2-02,mv
2023-2-03,ht
2023-2-04,ke
2023-2-05,bz
2023-2-06,id
2023-2-07,jm
2023-2-08,ma
2023-2-09,iq
2023-2-10,cf
2023-2-11,rs
2023-2-12,tc
Expand All @@ -259,15 +259,15 @@ date,country
2023-2-26,mz
2023-2-27,lb
2023-2-28,ca
2023-3-1,cn
2023-3-2,dk
2023-3-3,it
2023-3-4,sb
2023-3-5,gm
2023-3-6,pl
2023-3-7,gt
2023-3-8,rw
2023-3-9,ua
2023-3-01,cn
2023-3-02,dk
2023-3-03,it
2023-3-04,sb
2023-3-05,gm
2023-3-06,pl
2023-3-07,gt
2023-3-08,rw
2023-3-09,ua
2023-3-10,cl
2023-3-11,lc
2023-3-12,nu
Expand All @@ -290,15 +290,15 @@ date,country
2023-3-29,sr
2023-3-30,ly
2023-3-31,tj
2023-4-1,af
2023-4-2,gu
2023-4-3,wf
2023-4-4,sd
2023-4-5,sh
2023-4-6,fk
2023-4-7,lr
2023-4-8,cc
2023-4-9,uy
2023-4-01,af
2023-4-02,gu
2023-4-03,wf
2023-4-04,sd
2023-4-05,sh
2023-4-06,fk
2023-4-07,lr
2023-4-08,cc
2023-4-09,uy
2023-4-10,so
2023-4-11,cx
2023-4-12,al
Expand Down
36 changes: 19 additions & 17 deletions src/components/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ export function Game({ settingsData }: GameProps) {

let iframeSrc = "https://oec.world/en/tradle/aprilfools.html";
let oecLink = "https://oec.world/";
const country3LetterCode = country?.code
? countryISOMapping[country.code].toLowerCase()
: "";
if (!isAprilFools) {
const country3LetterCode = country?.code
? countryISOMapping[country.code].toLowerCase()
: "";
iframeSrc = `https://oec.world/en/visualize/embed/tree_map/hs92/export/${country3LetterCode}/all/show/2020/?controls=false&title=false&click=false`;
oecLink = `https://oec.world/en/profile/country/${country3LetterCode}`;
}
Expand Down Expand Up @@ -181,20 +181,22 @@ export function Game({ settingsData }: GameProps) {
height: 0,
}}
>
<iframe
style={{
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: "100%",
}}
title="Country to guess"
width="390"
height="315"
src={iframeSrc}
frameBorder="0"
/>
{country3LetterCode ? (
<iframe
style={{
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: "100%",
}}
title="Country to guess"
width="390"
height="315"
src={iframeSrc}
frameBorder="0"
/>
) : null}
</div>
{rotationMode && !hideImageMode && !gameEnded && (
<button
Expand Down
4 changes: 1 addition & 3 deletions src/components/Share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ export function Share({
const guessCount =
guesses[guesses.length - 1]?.distance === 0 ? guesses.length : "X";
const dayCount = Math.floor(
Interval.fromDateTimes(START_DATE, DateTime.fromISO(dayString)).length(
"day"
)
Interval.fromDateTimes(START_DATE, new Date(dayString)).length("day")
);
const difficultyModifierEmoji = hideImageMode
? " 🙈"
Expand Down
26 changes: 20 additions & 6 deletions src/domain/countries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ const countryCodesWithImage = [
"ua",
"ve",
"ye",
"tv",
"mh",
];

export interface Country {
Expand Down Expand Up @@ -326,6 +328,12 @@ export const countries: Country[] = [
{ code: "BH", latitude: 25.930414, longitude: 50.637772, name: "Bahrain" },
{ code: "BI", latitude: -3.373056, longitude: 29.918886, name: "Burundi" },
{ code: "BJ", latitude: 9.30769, longitude: 2.315834, name: "Benin" },
{
code: "BL",
latitude: 17.9139222,
longitude: -62.8338521,
name: "Saint Barthélemy",
},
{ code: "BM", latitude: 32.321384, longitude: -64.75737, name: "Bermuda" },
{ code: "BN", latitude: 4.535277, longitude: 114.727669, name: "Brunei" },
{ code: "BO", latitude: -16.290154, longitude: -63.588653, name: "Bolivia" },
Expand Down Expand Up @@ -579,6 +587,12 @@ export const countries: Country[] = [
// { code: "MC", latitude: 43.750298, longitude: 7.412841, name: "Monaco" },
{ code: "MD", latitude: 47.411631, longitude: 28.369885, name: "Moldova" },
// { code: "ME", latitude: 42.708678, longitude: 19.37439, name: "Montenegro" },
{
code: "MF",
latitude: 18.075,
longitude: -63.060001,
name: "Saint Maarten",
},
{
code: "MG",
latitude: -18.766947,
Expand Down Expand Up @@ -839,12 +853,12 @@ export const countries: Country[] = [
name: "Saint Vincent and the Grenadines",
},
{ code: "VE", latitude: 6.42375, longitude: -66.58973, name: "Venezuela" },
// {
// code: "VG",
// latitude: 18.420695,
// longitude: -64.639968,
// name: "British Virgin Islands",
// },
{
code: "VG",
latitude: 18.420695,
longitude: -64.639968,
name: "British Virgin Islands",
},
// {
// code: "VI",
// latitude: 18.335765,
Expand Down
1 change: 0 additions & 1 deletion src/hooks/useCountry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ export function useCountry(dayString: string): [Country | undefined] {
: undefined;
return forcedCountry;
}, [forcedCountryCode]);

return [country];
}

0 comments on commit 1fdb7ac

Please sign in to comment.