diff --git a/client/src/main.ts b/client/src/main.ts index 0b6e235..3c74dae 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -1,13 +1,31 @@ import "./style.css"; +import L from "leaflet"; import { initMap } from "./map.ts"; import { checkAuth, renderAuthBar, setOnAuthChange } from "./auth.ts"; import { loadPins, setupMapClick } from "./pins.ts"; async function main(): Promise { initMap(); - await checkAuth(); + + // Prevent map from receiving clicks/scrolls through the auth bar + const authBar = document.getElementById("auth-bar")!; + L.DomEvent.disableClickPropagation(authBar); + L.DomEvent.disableScrollPropagation(authBar); + + try { + await checkAuth(); + } catch { + // Server may not be reachable; continue as logged out + } + renderAuthBar(); - await loadPins(); + + try { + await loadPins(); + } catch { + // No pins to load if server is unreachable + } + setupMapClick(); setOnAuthChange(async () => { diff --git a/client/src/style.css b/client/src/style.css index d6e503f..8beaf87 100644 --- a/client/src/style.css +++ b/client/src/style.css @@ -19,7 +19,7 @@ body { position: absolute; top: 10px; right: 10px; - z-index: 1000; + z-index: 1001; background: white; padding: 10px 14px; border-radius: 6px; diff --git a/server/src/index.ts b/server/src/index.ts index acfa524..41f6294 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -35,7 +35,7 @@ app.use("/api/pins", pinRoutes); const __dirname = path.dirname(fileURLToPath(import.meta.url)); const clientDist = path.join(__dirname, "../../client/dist"); app.use(express.static(clientDist)); -app.get("*", (_req, res) => { +app.get("*path", (_req, res) => { res.sendFile(path.join(clientDist, "index.html")); });