This commit is contained in:
Ashley Yakeley 2026-02-23 15:18:57 -08:00
parent 34430d9e99
commit c3093f1030
3 changed files with 22 additions and 4 deletions

View File

@ -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<void> {
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 () => {

View File

@ -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;

View File

@ -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"));
});