first commit

This commit is contained in:
2026-03-01 10:59:07 +01:00
commit f6ed0ee437
29 changed files with 11890 additions and 0 deletions

26
mobile/src/router.tsx Normal file
View File

@@ -0,0 +1,26 @@
import React, { createContext, useContext, useState } from "react";
export type Route = "home" | "mystery";
interface RouterContextValue {
route: Route;
navigate: (to: Route) => void;
}
const RouterContext = createContext<RouterContextValue | null>(null);
export function RouterProvider({ children }: { children: React.ReactNode }) {
const [route, setRoute] = useState<Route>("home");
return (
<RouterContext.Provider value={{ route, navigate: setRoute }}>
{children}
</RouterContext.Provider>
);
}
export function useRouter(): RouterContextValue {
const ctx = useContext(RouterContext);
if (!ctx) throw new Error("useRouter must be used inside <RouterProvider>");
return ctx;
}