From 8c19f4de6806f176212050858bf5e588a217e5ac Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 30 Jan 2024 20:06:24 +0000 Subject: [PATCH] chore: Remove here map --- packages/app/src/Components/Feed/Generic.tsx | 20 ------- packages/app/src/Components/HereMap.tsx | 55 -------------------- 2 files changed, 75 deletions(-) delete mode 100644 packages/app/src/Components/HereMap.tsx diff --git a/packages/app/src/Components/Feed/Generic.tsx b/packages/app/src/Components/Feed/Generic.tsx index cf0eb5a2..6c23b0c4 100644 --- a/packages/app/src/Components/Feed/Generic.tsx +++ b/packages/app/src/Components/Feed/Generic.tsx @@ -1,13 +1,9 @@ -import { dedupe, removeUndefined } from "@snort/shared"; import { NostrLink, ReqFilter, RequestBuilder } from "@snort/system"; import { useRequestBuilder } from "@snort/system-react"; -import Geohash from "latlon-geohash"; import { lazy, Suspense, useMemo } from "react"; import { TimelineRenderer } from "@/Components/Feed/TimelineRenderer"; -import { findTag } from "@/Utils"; const LazySimpleChart = lazy(async () => await import("@/Components/LineChart")); -const LazyMap = lazy(async () => await import("@/Components/HereMap")); export function GenericFeed({ link }: { link: NostrLink }) { const reqs = JSON.parse(link.id) as Array; @@ -23,26 +19,10 @@ export function GenericFeed({ link }: { link: NostrLink }) { const evs = useRequestBuilder(sub); - const geoTags = dedupe(removeUndefined(evs.map(a => findTag(a, "g")))); const isTempSensor = reqs[0].kinds?.includes(8001) && reqs[0].kinds.length === 1; if (isTempSensor) { return (
- {geoTags.length > 0 && ( - - { - const pos = Geohash.decode(a); - return { - lat: pos.lat, - lng: pos.lon, - }; - })} - /> - - )} ; - center?: { lat: number; lng: number }; -}) { - const mapRef = useRef(null); - const map = useRef(null); - const platform = useRef(null); - - useEffect(() => { - if (!map.current) { - //@ts-expect-error - platform.current = new H.service.Platform({ apikey: "5uZZsWJdVyMSDTjjNJNyUgKq_bKv2rVVZWAXnfmgttQ" }); - - const rasterTileService = platform.current.getRasterTileService({ - queryParams: { - style: "explore.night", - size: 512, - }, - }); - const rasterTileProvider = new H.service.rasterTile.Provider(rasterTileService); - const rasterTileLayer = new H.map.layer.TileLayer(rasterTileProvider); - - const newMap = new H.Map(mapRef.current!, rasterTileLayer, { - engineType: H.Map.EngineType.WEBGL, - pixelRatio: window.devicePixelRatio, - center: props.center ?? { lat: 0, lng: 0 }, - zoom: props.zoom ?? 2, - }); - - new H.mapevents.Behavior(new H.mapevents.MapEvents(newMap)); - //@ts-expect-error - map.current = newMap; - } - }, [props]); - - useEffect(() => { - if (map.current) { - map.current.setCenter(props.center ?? { lat: 0, lng: 0 }); - map.current.setZoom(props.zoom ?? 2); - map.current.removeObjects(map.current.getObjects()); - for (const mrk of props.markers ?? []) { - const m = new H.map.Marker(mrk); - map.current.addObject(m); - } - } - }, [map, props.center, props.zoom, props.markers]); - - // Return a div element to hold the map - return
; -}