More things for web
This commit is contained in:
1 parent
78b1058276
commit
a1ab487084
8 files changed
+87
-8
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { useLocalStorage } from "@/hooks/useLocalStorage"
|
||||
import { PREF } from "@/utils/const"
|
||||
|
||||
export default function Intro() {
|
||||
const [ stepStr, setStep ] = useLocalStorage(PREF.step, "0");
|
||||
|
||||
return (
|
||||
<div className="screen-container">
|
||||
Intro or smth
|
||||
<br></br>
|
||||
<button onClick={() => {
|
||||
setStep("2");
|
||||
}}>Ok</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,32 @@
|
||||
import { useLocalStorage } from "@/hooks/useLocalStorage"
|
||||
import { PREF } from "@/utils/const"
|
||||
import { parsePlayerData } from "@/utils/dataparser";
|
||||
|
||||
export default function Tour() {
|
||||
const [ stepStr, setStep ] = useLocalStorage(PREF.step, "0");
|
||||
const [ tourCode, setTourCode ] = useLocalStorage(PREF.code, "");
|
||||
const [ completedRiddlesStr, setCompletedRiddles ] = useLocalStorage(PREF.completed_riddles, "");
|
||||
const [ playersStr, setPlayers ] = useLocalStorage(PREF.players, "");
|
||||
const [ pointsStr, setPoints ] = useLocalStorage(PREF.points, "0");
|
||||
const step = Number.parseInt(stepStr) || 0;
|
||||
const points = Number.parseInt(pointsStr) || 0;
|
||||
const players = parsePlayerData(playersStr);
|
||||
|
||||
return (
|
||||
<div className="screen-container">
|
||||
<div>
|
||||
{"Points: " + points}
|
||||
{"Players: " + playersStr}
|
||||
</div>
|
||||
<div>
|
||||
Contains both
|
||||
<div>
|
||||
Map
|
||||
</div>
|
||||
<div>
|
||||
Riddle Overlay
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
import { ChangeEvent, SyntheticEvent, useEffect, useRef, useState } from "react";
|
||||
import styles from "../../css/WelcomeScreen.module.css";
|
||||
import ChargedButton from "../ChargedButton";
|
||||
import { useLocalStorage } from "@/hooks/useLocalStorage";
|
||||
import { PREF } from "@/utils/const";
|
||||
|
||||
const CODE_LENGTH = 9;
|
||||
const COOLDOWN_MS = 3000;
|
||||
@@ -13,6 +15,8 @@ export default function WelcomeScreen() {
|
||||
const [isCooldown, setIsCooldown] = useState(false);
|
||||
const tourCodeRef = useRef("");
|
||||
const cooldownRef = useRef(-1);
|
||||
const [, setCode ] = useLocalStorage(PREF.code, "");
|
||||
const [, setStep ] = useLocalStorage(PREF.step, "0");
|
||||
|
||||
const checkCooldown = () => {
|
||||
if (cooldownRef.current === -1) return false;
|
||||
@@ -47,6 +51,8 @@ export default function WelcomeScreen() {
|
||||
setLastSubmitTs(cooldownRef.current);
|
||||
|
||||
console.log("submitted", value);
|
||||
setCode(value);
|
||||
setStep("1");
|
||||
};
|
||||
|
||||
const handleChange = (event: ChangeEvent<HTMLInputElement>): boolean => {
|
||||
|
||||
Reference in new issue
Block a user