diff --git a/src/components/screens/Intro.tsx b/src/components/screens/Intro.tsx index 1c4ab10..acc139a 100644 --- a/src/components/screens/Intro.tsx +++ b/src/components/screens/Intro.tsx @@ -26,6 +26,7 @@ export default function Intro() { const [ videoPaused, setVideoPaused ] = useState(false); const [ voiceOverState, setVoiceOverState ] = useLocalStorage(PREF.voice_over, "off"); const [ boughtHintsStr, setBoughtHints ] = useLocalStorage(PREF.bought_hints, ""); + const [ reachedRiddlesStr, setReachedRiddles ] = useLocalStorage(PREF.reached_riddles, ""); const introVideoRef = useRef(null); const [ granted, setGranted ] = useState(false); @@ -38,6 +39,7 @@ export default function Intro() { setBoughtHints(""); setPlayers(""); setWorthyWords(""); + setReachedRiddles(""); setVoiceOverState("on"); setStep("2"); }; diff --git a/src/components/screens/Tour.tsx b/src/components/screens/Tour.tsx index 55ee38f..804c11a 100644 --- a/src/components/screens/Tour.tsx +++ b/src/components/screens/Tour.tsx @@ -94,10 +94,6 @@ export default function Tour() { const [ voiceOverStr, ] = useLocalStorage(PREF.voice_over, ""); const [ reachedRiddlesStr, ] = useLocalStorage(PREF.reached_riddles, ""); - const reachedRiddles = useMemo(() => { - return getReachedRiddles(); - }, [reachedRiddlesStr]); - const permissionsGranted = gpsStatus === "granted" && cameraStatus === "granted"; const _dismissFunc = () => { @@ -197,6 +193,7 @@ export default function Tour() { const distanceMeters = userLngLat.distanceTo(markerLngLat); const isNearby = distanceMeters <= r.requiredDistance; + const reachedRiddles = getReachedRiddles(); const reachedAlready = reachedRiddles.includes(r.step); if (isNearby || demoMode || reachedAlready) { diff --git a/src/utils/const.ts b/src/utils/const.ts index 4a65352..9f51f16 100644 --- a/src/utils/const.ts +++ b/src/utils/const.ts @@ -17,4 +17,4 @@ const isDev = process.env.NODE_ENV === "development"; export const HTTP_SCHEME = isDev ? "http" : "https"; export const WS_SCHEME = isDev ? "ws" : "wss"; -export const API_PREFIX = isDev ? "192.168.0.110:8080" : "api.excaliburs-erben.de"; \ No newline at end of file +export const API_PREFIX = isDev ? "localhost:8080" : "api.excaliburs-erben.de"; \ No newline at end of file diff --git a/src/utils/reachedRiddles.ts b/src/utils/reachedRiddles.ts index b1d5b68..88f62ed 100644 --- a/src/utils/reachedRiddles.ts +++ b/src/utils/reachedRiddles.ts @@ -8,6 +8,7 @@ export function addReachedRiddle(step: number) { riddles.push(step); localStorage.setItem(PREF.reached_riddles, JSON.stringify(riddles)); window.dispatchEvent(new Event('storage')); + return riddles; } export function getReachedRiddles(): number[] {