diff --git a/Assets/RobotoMono-VariableFont_wght.ttf b/Assets/RobotoMono-VariableFont_wght.ttf new file mode 100644 index 0000000..fc02de4 Binary files /dev/null and b/Assets/RobotoMono-VariableFont_wght.ttf differ diff --git a/Assets/Roboto_Mono.zip b/Assets/Roboto_Mono.zip new file mode 100644 index 0000000..9aa7a80 Binary files /dev/null and b/Assets/Roboto_Mono.zip differ diff --git a/package-lock.json b/package-lock.json index b87cf8c..44df322 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1042,9 +1042,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001456", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001456.tgz", - "integrity": "sha512-XFHJY5dUgmpMV25UqaD4kVq2LsiaU5rS8fb0f17pCoXQiQslzmFgnfOxfvo1bTpTqf7dwG/N/05CnLCnOEKmzA==", + "version": "1.0.30001585", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001585.tgz", + "integrity": "sha512-yr2BWR1yLXQ8fMpdS/4ZZXpseBgE7o4g41x3a6AJOqZuOi+iE/WdJYAuZ6Y95i4Ohd2Y+9MzIWRR+uGABH4s3Q==", "dev": true, "funding": [ { @@ -1054,6 +1054,10 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ] }, @@ -3083,9 +3087,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001456", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001456.tgz", - "integrity": "sha512-XFHJY5dUgmpMV25UqaD4kVq2LsiaU5rS8fb0f17pCoXQiQslzmFgnfOxfvo1bTpTqf7dwG/N/05CnLCnOEKmzA==", + "version": "1.0.30001585", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001585.tgz", + "integrity": "sha512-yr2BWR1yLXQ8fMpdS/4ZZXpseBgE7o4g41x3a6AJOqZuOi+iE/WdJYAuZ6Y95i4Ohd2Y+9MzIWRR+uGABH4s3Q==", "dev": true }, "chalk": { diff --git a/src/App.jsx b/src/App.jsx index 9c2ef87..d4c4c9c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -3,15 +3,19 @@ import { GameContext } from "./context.js" import { Map } from "./Map.jsx" import names from "./names.json" import ConfettiExplosion from "react-confetti-explosion" +import ModeSelector from "./components/ModeSelector.jsx" const MAX_COUNTRIES = 197 const TIME = 15 * 60 +var mode = 0 // let 0 be easy mode and 1 be hard mode + export const App = () => { const [completedCountries, setCompletedCountries] = useState([]) const [countdown, setCountdown] = useState(TIME) const [started, setStarted] = useState(false) const [ended, setEnded] = useState(false) + const [mode, setMode] = useState("Normal") // useSate for the mode useEffect(() => { if (started && !ended) { const interval = setInterval(() => { @@ -27,6 +31,16 @@ export const App = () => { } }, [started, ended]) + const toggleMode = () => { + if (mode == "Easy") { + setMode("Normal") + } + if (mode == "Normal") { + setMode("Easy") + }else{setMode("Normal")} + console.log(mode) + } + const onInput = e => { const value = e.target.value.toLowerCase().trim() const code = names[value] @@ -34,14 +48,25 @@ export const App = () => { setCompletedCountries([...completedCountries, code]) e.target.value = "" if (completedCountries.length + 1 >= MAX_COUNTRIES) setEnded(true) + } else if (mode == "Easy") { + var enteredValue = e.target.value + for (const [key, value] of Object.entries(names)) { + if (enteredValue == value) { + setCompletedCountries([...completedCountries, value]) + e.target.value = "" + if (completedCountries.length + 1 >= MAX_COUNTRIES) setEnded(true) + } + + } + } if (!started) setStarted(true) } - return (
-
+ +

{formatTime(countdown)}

{!ended ? ( @@ -64,7 +89,7 @@ export const App = () => { - + ) } diff --git a/src/components/ModeSelector.jsx b/src/components/ModeSelector.jsx new file mode 100644 index 0000000..1c7474d --- /dev/null +++ b/src/components/ModeSelector.jsx @@ -0,0 +1,11 @@ +import React from 'react' + +function modeSelector(props) { + return ( +
+ +
+ ) +} + +export default modeSelector \ No newline at end of file diff --git a/src/index.css b/src/index.css index bd6213e..bcad331 100644 --- a/src/index.css +++ b/src/index.css @@ -1,3 +1,30 @@ @tailwind base; @tailwind components; -@tailwind utilities; \ No newline at end of file +@tailwind utilities; + +@font-face { + font-family: Robot-font; + src: url(../Assets/RobotoMono-VariableFont_wght.ttf); + } + +.mode-button{ + position: relative; + width: 10%; + height: 2%; + top: 10px; + font-family: Robot-font; + padding: 5px; + font-size: x-large; + border-radius: 20px; + color: white; + font-weight: 900; + transition: 500ms linear; +} + +.button-mode-Easy{ + background-color: rgb(0, 255, 0); +} + +.button-mode-Normal{ + background-color: #fbbf24; +} \ No newline at end of file