Skip to content

Commit 0ff03a5

Browse files
committed
chore: fix github pages build
1 parent f063715 commit 0ff03a5

7 files changed

Lines changed: 10 additions & 24 deletions

File tree

src/context/ProjectContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createContext, useContext, useEffect, useState } from "react";
2-
import { useLocation, useSearchParams } from "react-router-dom";
2+
import { useSearchParams } from "react-router-dom";
33
import { Project, loadProjectById } from "../supabase/projects";
44

55
const ProjectContext = createContext<{

src/pages/MapPage/BaseMapControls.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import L from "leaflet";
55
interface BaseMapControlsProps {
66
mapRef: React.MutableRefObject<L.Map | null>;
77
drawControlRef: React.MutableRefObject<L.Control.Draw | null>;
8-
featureCount: number;
98
isHebrew?: boolean;
109
}
1110

12-
const BaseMapControls = ({ mapRef, drawControlRef, featureCount, isHebrew }: BaseMapControlsProps) => {
11+
const BaseMapControls = ({ mapRef, drawControlRef, isHebrew }: BaseMapControlsProps) => {
1312
const navigate = useNavigate();
1413

1514
const disableAllModes = () => {

src/pages/MapPage/PinkLineMapPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const PinkLineMapPage = () => {
3535

3636
// Nuke every route polyline from the map. Called before every re-render.
3737
const clearAllRouteLayers = (map: L.Map) => {
38-
const count = routeLayersRef.current.length;
3938
for (const layer of routeLayersRef.current) {
4039
try { map.removeLayer(layer); } catch (_) { /* already gone */ }
4140
}

src/pages/MapPage/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState } from "react";
22
import L from "leaflet";
3+
import type { Geometry } from "geojson";
34
import { useMap } from "./hooks/useMap";
45
import { useProject } from "../../context/ProjectContext";
56
import PinkLineMapPage from "./PinkLineMapPage";
@@ -19,7 +20,10 @@ const MapPage = () => {
1920

2021
if (projectMeta) {
2122
try {
22-
const geojson = projectMeta;
23+
const geojson: Geometry =
24+
typeof projectMeta === "string"
25+
? (JSON.parse(projectMeta) as Geometry)
26+
: (projectMeta as unknown as Geometry);
2327
if (geojson.type === "Polygon" && geojson.coordinates.length > 0) {
2428
const coords = geojson.coordinates[0];
2529
const latSum = coords.reduce(
@@ -60,7 +64,7 @@ const MapPage = () => {
6064
const isMemorialSites = project?.id === "33333333-3333-3333-3333-333333333333";
6165
const isTestimony = project?.id === TESTIMONY_PROJECT_ID;
6266
const isSpecialProject = project?.name === "Pink Line" || isMemorialSites;
63-
const { mapRef, drawControlRef, featureCount } = useMap({
67+
const { mapRef, drawControlRef } = useMap({
6468
center: mapInitCenter,
6569
enabled: !isLoading && !isSpecialProject,
6670
onShapeCreated: handleShapeCreated,
@@ -77,7 +81,7 @@ const MapPage = () => {
7781
return (
7882
<>
7983
<div key={project?.id || "no-project"} id="map" style={{ height: "100vh", width: "100%" }}></div>
80-
<BaseMapControls mapRef={mapRef} drawControlRef={drawControlRef} featureCount={featureCount} isHebrew={isTestimony} />
84+
<BaseMapControls mapRef={mapRef} drawControlRef={drawControlRef} isHebrew={isTestimony} />
8185
{pendingLayer && (
8286
project?.id === TESTIMONY_PROJECT_ID ? (
8387
<TestimonyForm

src/pages/ProjectsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const ProjectsPage = () => {
2626
const data = await loadProjects();
2727
setProjects(data || []);
2828
} catch (err) {
29-
setError(err.message);
29+
setError(err instanceof Error ? err.message : "Failed to load projects");
3030
} finally {
3131
setLoading(false);
3232
}

src/supabase/memorialSites.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ export interface MemorialSite {
1212
feature_type: MemorialFeatureType;
1313
}
1414

15-
function getProjectId(): string {
16-
const params = new URLSearchParams(window.location.search);
17-
const projectId = params.get("projectId");
18-
if (!projectId) throw new Error("Missing projectId in URL");
19-
return projectId;
20-
}
21-
2215
export async function loadCentralMemorial(projectId: string): Promise<MemorialSite | null> {
2316
const { data, error } = await supabase
2417
.from("geo_features")

src/supabase/pinkLine.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ export interface PinkLineNode {
88
submissionId: string | null;
99
}
1010

11-
function getProjectId(): string {
12-
const params = new URLSearchParams(window.location.search);
13-
const projectId = params.get("projectId");
14-
if (!projectId) {
15-
throw new Error("Missing project ID in URL (?projectId=...)");
16-
}
17-
return projectId;
18-
}
19-
2011
export async function createPinkLineNode(
2112
projectId: string,
2213
lat: number,

0 commit comments

Comments
 (0)