Skip to content

Commit 6ca414c

Browse files
committed
better config
1 parent 39c30f9 commit 6ca414c

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

src/config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/lib/Map.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<script>
22
import { onMount, onDestroy } from "svelte";
3-
import L, { marker } from "leaflet";
3+
import L from "leaflet";
44
import "leaflet/dist/leaflet.css";
55
import { createEventDispatcher } from "svelte";
6-
import { rootUrl } from "../config";
6+
7+
const basePath = import.meta.env.BASE_URL;
8+
console.log("basePath", basePath);
79
810
// Props
911
export let markers = [];
@@ -65,7 +67,7 @@
6567
return `
6668
<div class="map-marker marker-display-${marker.displayClass}" >
6769
<div class="marker-icon-circle">
68-
<img src="${rootUrl}/icons/${icon}.svg">
70+
<img src="${basePath}icons/${icon}.svg">
6971
</div>
7072
<div class="marker-text-container">
7173
<div class="marker-text marker-text-outline">${label}</div>

src/lib/SlidingPane.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script>
2-
import { fade } from "svelte/transition";
32
import SlidingPaneHeader from "./SlidingPaneHeader.svelte";
43
54
// Props

src/lib/SlidingPaneHeader.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import { rootUrl } from "../config";
2+
const basePath = import.meta.env.BASE_URL;
33
// Props
44
export let title = "";
55
export let expanded = false;
@@ -31,8 +31,8 @@
3131
>
3232
<img
3333
src={expanded
34-
? `${rootUrl}/icons/shrink.svg`
35-
: `${rootUrl}/icons/expand.svg`}
34+
? `${basePath}icons/shrink.svg`
35+
: `${basePath}icons/expand.svg`}
3636
alt={expanded ? "Shrink pane" : "Expand pane"}
3737
class="icon"
3838
/>
@@ -47,8 +47,8 @@
4747
>
4848
<img
4949
src={expanded
50-
? `${rootUrl}/icons/shrink.svg`
51-
: `${rootUrl}/icons/expand-vertical.svg`}
50+
? `${basePath}icons/shrink.svg`
51+
: `${basePath}icons/expand-vertical.svg`}
5252
alt={expanded ? "Shrink pane" : "Expand pane"}
5353
class="icon"
5454
/>

src/lib/geodata.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Loki from 'lokijs';
22
import ngeohash from 'ngeohash'; // Import ngeohash for better performance
3-
import { rootUrl } from '../config'; // Import rootUrl from config file
4-
3+
const basePath = import.meta.env.BASE_URL;
54
// Initialize a LokiJS database
65

76
const ingestedFiles = [];
@@ -160,7 +159,7 @@ export async function getGeoEntriesInBounds({minLat, maxLat, minLon, maxLon}) {
160159
if (geohashes_1.length > 3) {
161160
if (!ingestedFiles.includes("geodata/geo3_unique.csv.gz")) {
162161
// Use consistent path format
163-
const fileUrl = rootUrl + "/geodata/geo3_unique.csv.gz";
162+
const fileUrl = `${basePath}geodata/geo3_unique.csv.gz`;
164163
try {
165164
const rows = await loadCsvGzFile(fileUrl);
166165
addLatLonToRows(rows);
@@ -191,7 +190,7 @@ export async function getGeoEntriesInBounds({minLat, maxLat, minLon, maxLon}) {
191190

192191
// Load all files in parallel but collect results before inserting
193192
const loadResults = await Promise.all(needDownload.map(async (g) => {
194-
const url = rootUrl + `/geodata/${g}.csv.gz`;
193+
const url = `${basePath}geodata/${g}.csv.gz`;
195194
try {
196195
const rows = await loadCsvGzFile(url);
197196
ingestedFiles.push(url);

0 commit comments

Comments
 (0)