make it work again

This commit is contained in:
Adam 2023-04-25 10:52:32 -04:00
parent d71299ba90
commit 6e8d48a56d
14 changed files with 174 additions and 137 deletions

View file

@ -12,7 +12,7 @@
"postcss": "^8.4.23",
"solid-start-node": "^0.2.26",
"typescript": "^4.9.5",
"vite": "^4.3.1"
"vite": "^4.3.2"
},
"dependencies": {
"@deck.gl/layers": "^8.9.9",

View file

@ -36,7 +36,7 @@ dependencies:
version: 1.7.2(empty-npm-package@1.0.0)
solid-start:
specifier: ^0.2.26
version: 0.2.26(@solidjs/meta@0.28.4)(@solidjs/router@0.8.2)(solid-js@1.7.3)(solid-start-node@0.2.26)(vite@4.3.1)
version: 0.2.26(@solidjs/meta@0.28.4)(@solidjs/router@0.8.2)(solid-js@1.7.3)(solid-start-node@0.2.26)(vite@4.3.2)
tailwindcss:
specifier: ^3.3.1
version: 3.3.1(postcss@8.4.23)
@ -56,13 +56,13 @@ devDependencies:
version: 8.4.23
solid-start-node:
specifier: ^0.2.26
version: 0.2.26(solid-start@0.2.26)(undici@5.22.0)(vite@4.3.1)
version: 0.2.26(solid-start@0.2.26)(undici@5.22.0)(vite@4.3.2)
typescript:
specifier: ^4.9.5
version: 4.9.5
vite:
specifier: ^4.3.1
version: 4.3.1(@types/node@18.16.0)
specifier: ^4.3.2
version: 4.3.2(@types/node@18.16.0)
packages:
@ -2033,7 +2033,7 @@ packages:
hasBin: true
dependencies:
caniuse-lite: 1.0.30001481
electron-to-chromium: 1.4.369
electron-to-chromium: 1.4.371
node-releases: 2.0.10
update-browserslist-db: 1.0.11(browserslist@4.21.5)
@ -2232,8 +2232,8 @@ packages:
/ee-first@1.1.1:
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
/electron-to-chromium@1.4.369:
resolution: {integrity: sha512-LfxbHXdA/S+qyoTEA4EbhxGjrxx7WK2h6yb5K2v0UCOufUKX+VZaHbl3svlzZfv9sGseym/g3Ne4DpsgRULmqg==}
/electron-to-chromium@1.4.371:
resolution: {integrity: sha512-jlBzY4tFcJaiUjzhRTCWAqRvTO/fWzjA3Bls0mykzGZ7zvcMP7h05W6UcgzfT9Ca1SW2xyKDOFRyI0pQeRNZGw==}
/emoji-regex@8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
@ -2773,8 +2773,8 @@ packages:
hasBin: true
dev: false
/joi@17.9.1:
resolution: {integrity: sha512-FariIi9j6QODKATGBrEX7HZcja8Bsh3rfdGYy/Sb65sGlZWK/QWesU1ghk7aJWDj95knjXlQfSmzFSPPkLVsfw==}
/joi@17.9.2:
resolution: {integrity: sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw==}
dependencies:
'@hapi/hoek': 9.3.0
'@hapi/topo': 5.1.0
@ -2881,8 +2881,8 @@ packages:
'@math.gl/core': 3.6.3
dev: false
/merge-anything@5.1.4:
resolution: {integrity: sha512-7PWKwGOs5WWcpw+/OvbiFiAvEP6bv/QHiicigpqMGKIqPPAtGhBLR8LFJW+Zu6m9TXiR/a8+AiPlGG0ko1ruoQ==}
/merge-anything@5.1.5:
resolution: {integrity: sha512-9lquMsJxgaef2BXYUy8VnqHmuLYaEiGd7SULqOTuDFA9Lw6g6Hmdsblc6+yqshdJOQKkn9I106+3D5mnQMstvg==}
engines: {node: '>=12.13'}
dependencies:
is-what: 4.1.8
@ -3285,8 +3285,8 @@ packages:
/set-cookie-parser@2.6.0:
resolution: {integrity: sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==}
/sirv@2.0.2:
resolution: {integrity: sha512-4Qog6aE29nIjAOKe/wowFTxOdmbEZKb+3tsLljaBRzJwtqto0BChD2zzH0LhgCSXiI+V7X+Y45v14wBZQ1TK3w==}
/sirv@2.0.3:
resolution: {integrity: sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==}
engines: {node: '>= 10'}
dependencies:
'@polka/url': 1.0.0-next.21
@ -3327,7 +3327,7 @@ packages:
'@babel/types': 7.21.4
solid-js: 1.7.3
/solid-start-node@0.2.26(solid-start@0.2.26)(undici@5.22.0)(vite@4.3.1):
/solid-start-node@0.2.26(solid-start@0.2.26)(undici@5.22.0)(vite@4.3.2):
resolution: {integrity: sha512-8vciTGoQV+lIlCUSVHJPazlaoKDRfBowDkPeBr/EZdmtbcMOKoJYf/APPQWFspylF+nhzunMf0+zJP90VtMEYg==}
peerDependencies:
solid-start: '*'
@ -3340,15 +3340,15 @@ packages:
compression: 1.7.4
polka: 1.0.0-next.22
rollup: 3.21.0
sirv: 2.0.2
solid-start: 0.2.26(@solidjs/meta@0.28.4)(@solidjs/router@0.8.2)(solid-js@1.7.3)(solid-start-node@0.2.26)(vite@4.3.1)
sirv: 2.0.3
solid-start: 0.2.26(@solidjs/meta@0.28.4)(@solidjs/router@0.8.2)(solid-js@1.7.3)(solid-start-node@0.2.26)(vite@4.3.2)
terser: 5.17.1
undici: 5.22.0
vite: 4.3.1(@types/node@18.16.0)
vite: 4.3.2(@types/node@18.16.0)
transitivePeerDependencies:
- supports-color
/solid-start@0.2.26(@solidjs/meta@0.28.4)(@solidjs/router@0.8.2)(solid-js@1.7.3)(solid-start-node@0.2.26)(vite@4.3.1):
/solid-start@0.2.26(@solidjs/meta@0.28.4)(@solidjs/router@0.8.2)(solid-js@1.7.3)(solid-start-node@0.2.26)(vite@4.3.2):
resolution: {integrity: sha512-kne2HZlnSMzsirdnvNs1CsDqBl0L0uvKKt1t4de1CH7JIngyqoMcER97jTE0Ejr84KknANaKAdvJAzZcL7Ueng==}
hasBin: true
peerDependencies:
@ -3409,14 +3409,14 @@ packages:
rollup-route-manifest: 1.0.0(rollup@3.21.0)
sade: 1.8.1
set-cookie-parser: 2.6.0
sirv: 2.0.2
sirv: 2.0.3
solid-js: 1.7.3
solid-start-node: 0.2.26(solid-start@0.2.26)(undici@5.22.0)(vite@4.3.1)
solid-start-node: 0.2.26(solid-start@0.2.26)(undici@5.22.0)(vite@4.3.2)
terser: 5.17.1
undici: 5.22.0
vite: 4.3.1(@types/node@18.16.0)
vite-plugin-inspect: 0.7.24(rollup@3.21.0)(vite@4.3.1)
vite-plugin-solid: 2.7.0(solid-js@1.7.3)(vite@4.3.1)
vite: 4.3.2(@types/node@18.16.0)
vite-plugin-inspect: 0.7.24(rollup@3.21.0)(vite@4.3.2)
vite-plugin-solid: 2.7.0(solid-js@1.7.3)(vite@4.3.2)
wait-on: 6.0.1(debug@4.3.4)
transitivePeerDependencies:
- supports-color
@ -3665,7 +3665,7 @@ packages:
resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}
engines: {node: '>= 0.8'}
/vite-plugin-inspect@0.7.24(rollup@3.21.0)(vite@4.3.1):
/vite-plugin-inspect@0.7.24(rollup@3.21.0)(vite@4.3.2):
resolution: {integrity: sha512-XyrhTxYF+5X8CH0PFmYJhs8WGJMOa2UxwUftTaT0FiMm24VfUp+UsAh7xDZI3doPOiB5GxKEizDGxdU98Ay+Vg==}
engines: {node: '>=14'}
peerDependencies:
@ -3676,13 +3676,13 @@ packages:
debug: 4.3.4
fs-extra: 11.1.1
picocolors: 1.0.0
sirv: 2.0.2
vite: 4.3.1(@types/node@18.16.0)
sirv: 2.0.3
vite: 4.3.2(@types/node@18.16.0)
transitivePeerDependencies:
- rollup
- supports-color
/vite-plugin-solid@2.7.0(solid-js@1.7.3)(vite@4.3.1):
/vite-plugin-solid@2.7.0(solid-js@1.7.3)(vite@4.3.2):
resolution: {integrity: sha512-avp/Jl5zOp/Itfo67xtDB2O61U7idviaIp4mLsjhCa13PjKNasz+IID0jYTyqUp9SFx6/PmBr6v4KgDppqompg==}
peerDependencies:
solid-js: ^1.7.2
@ -3692,16 +3692,16 @@ packages:
'@babel/preset-typescript': 7.21.4(@babel/core@7.21.4)
'@types/babel__core': 7.20.0
babel-preset-solid: 1.7.3(@babel/core@7.21.4)
merge-anything: 5.1.4
merge-anything: 5.1.5
solid-js: 1.7.3
solid-refresh: 0.5.2(solid-js@1.7.3)
vite: 4.3.1(@types/node@18.16.0)
vitefu: 0.2.4(vite@4.3.1)
vite: 4.3.2(@types/node@18.16.0)
vitefu: 0.2.4(vite@4.3.2)
transitivePeerDependencies:
- supports-color
/vite@4.3.1(@types/node@18.16.0):
resolution: {integrity: sha512-EPmfPLAI79Z/RofuMvkIS0Yr091T2ReUoXQqc5ppBX/sjFRhHKiPPF/R46cTdoci/XgeQpB23diiJxq5w30vdg==}
/vite@4.3.2(@types/node@18.16.0):
resolution: {integrity: sha512-9R53Mf+TBoXCYejcL+qFbZde+eZveQLDYd9XgULILLC1a5ZwPaqgmdVpL8/uvw2BM/1TzetWjglwm+3RO+xTyw==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:
@ -3732,7 +3732,7 @@ packages:
optionalDependencies:
fsevents: 2.3.2
/vitefu@0.2.4(vite@4.3.1):
/vitefu@0.2.4(vite@4.3.2):
resolution: {integrity: sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==}
peerDependencies:
vite: ^3.0.0 || ^4.0.0
@ -3740,7 +3740,7 @@ packages:
vite:
optional: true
dependencies:
vite: 4.3.1(@types/node@18.16.0)
vite: 4.3.2(@types/node@18.16.0)
/vt-pbf@3.1.3:
resolution: {integrity: sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==}
@ -3756,7 +3756,7 @@ packages:
hasBin: true
dependencies:
axios: 0.25.0(debug@4.3.4)
joi: 17.9.1
joi: 17.9.2
lodash: 4.17.21
minimist: 1.2.8
rxjs: 7.8.0

View file

@ -5,6 +5,7 @@ import type { JSX } from 'solid-js';
import { useStationsContext } from './StationsContext';
function ChevronUpIcon(props: JSX.IntrinsicElements['svg']) {
return (<svg
xmlns="http://www.w3.org/2000/svg"
@ -22,19 +23,20 @@ function ChevronUpIcon(props: JSX.IntrinsicElements['svg']) {
</svg>) as JSX.Element;
};
export default function AccordionTest() {
const [stations, {setStationsRequest}] = useStationsContext();
return (
<Show when={stations()}>
<h1>Find Stations</h1>
<button onClick={() => (setStationsRequest({
Latitude: 42.36,
Longitude: -71.05625,
Distance: 100,
CountLimit: 100,
}))}>test</button>
<ErrorBoundary fallback={<p>pretty list broke</p>}>
<div class="w-full max-w-md p-2 mx-auto bg-black/90 rounded-2xl shadow-2xl max-h-screen overflow-scroll">
<Accordion class="space-y-2" defaultValue={stations()[0]} toggleable>

View file

@ -42,14 +42,7 @@ export const StationsContext = createContext();
export function StationsProvider(props: any) {
const TEST_PACKET: StationRequest = {
Latitude: 42.36,
Longitude: -71.05625,
Distance: 10,
CountLimit: 10,
};
const [stationsRequest, setStationsRequest] = createSignal<StationRequest>(TEST_PACKET)
const [stationsRequest, setStationsRequest] = createSignal<StationRequest>()
async function fetchStations() {
const response = await fetch('https://kevinfwu.com/getnearest', {

View file

@ -1,26 +1,33 @@
import type { JSX } from "solid-js"
import type { Viewport } from "solid-map-gl";
import { setViewport } from '~/root';
import { setViewport } from '~/components/map/BadassMap';
export function Toolbox() {
return (<ul>
return (
<ul>
<h3>Toolbox</h3>
<li> <button onClick={() => setViewport<Viewport>({
<li>
<button onClick={() => setViewport<Viewport>({
...viewport(),
center: { lng: -71.05625, lat: 42.36, },
zoom: 15.5,
bearing: 160,
pitch: 60,
})} > Boston </button> </li>
})} > Boston </button>
</li>
<li> <button onClick={() => setViewport<Viewport>({
<li>
<button onClick={() => setViewport<Viewport>({
...viewport(),
center: { lng: -74.0112660425065, lat: 40.70689167578798 },
zoom: 15.5,
bearing: 10,
pitch: 60,
})} > NYC </button> </li>
</ul>) as JSX.Element;
})} > NYC </button>
</li>
</ul>
) as JSX.Element;
};

View file

@ -1,7 +1,6 @@
import MapGL, { Viewport } from 'solid-map-gl';
import * as maplibre from 'maplibre-gl';
import MapControls from './MapControls';
import { createSignal } from 'solid-js';
import type { MapOptions } from 'maplibre-gl';
@ -15,9 +14,15 @@ const MapArcLayer = unstable_clientOnly(() => import('~/components/map/MapArcLay
import 'maplibre-gl/dist/maplibre-gl.css';
import StyleJson from '~/style/style.json';
export default function BadassMap(props: any) {
const [viewport, setViewport] = createSignal<Viewport>();
export const [viewport, setViewport] = createSignal<Viewport>({
center: { lng: -71.05625, lat: 42.36, },
zoom: 15.5,
bearing: 160,
pitch: 60,
});
export default function BadassMap(props: any) {
return (
<MapGL
mapLib={maplibre}

View file

@ -4,10 +4,11 @@ import { Layer } from 'solid-map-gl';
import type { JSX } from 'solid-js';
type ArcData = {
source: number[],
target: number[]
}
};
export default function MapArcLayer(props: any) {
return (

View file

@ -1,7 +1,7 @@
import { Control } from 'solid-map-gl';
import type { JSX } from 'solid-js';
import type { NavigationOptions, GeolocateOptions, AttributionOptions, ScaleOptions, } from 'maplibre-gl';
import type { JSX } from 'solid-js';
export default function MapControls() {

View file

@ -18,15 +18,24 @@ export default function MapScatLayer(props: any) {
const [scats, setScats] = createSignal([]);
function getCoords(stations) {
if (stations() === undefined) {
return
} else if (stations.loading) {
return stations.loading
} else if (stations.error) {
return stations.error
} else {
console.log('start');
let buf: ScatData[] = [];
for (const station of stations()) {
buf.push({ coordinates: [station.Loc.Coordinates[1], station.Loc.Coordinates[0]] })
};
console.log(buf)
console.log('stop')
return buf;
};
};
const pls = createMemo(() => setScats(getCoords(stations)));
console.log(scats());
return (
<Show when={stations()}>
@ -34,7 +43,7 @@ export default function MapScatLayer(props: any) {
new MapboxLayer({
id: 'deckgl-scatterplot',
type: ScatterplotLayer,
data: pls(),
data: scats(),
getPosition: (d: any) => d.coordinates,
getRadius: 90,
getFillColor: [255, 140, 0],

View file

@ -1,14 +1,16 @@
// @refresh reload
import { A, Body, ErrorBoundary, FileRoutes, Head, Html, Meta, Routes, Scripts, Title } from "solid-start";
import "./root.css";
import BadassMap from './components/map/BadassMap';
import { StationsProvider } from "./components/StationsContext";
import type { JSX } from "solid-js";
import { StationsProvider } from "./components/StationsContext";
import BadassMap from './components/map/BadassMap';
import "./root.css";
export default function Root() {
return (
<Html lang="en">
<Head>

View file

@ -5,7 +5,8 @@ import type { JSX } from 'solid-js';
export default function NotFound() {
return (<main>
return (
<main>
<Title>Not Found</Title>
<HttpStatusCode code={404} />
@ -20,5 +21,6 @@ export default function NotFound() {
to learn how to build SolidStart apps.
</p>
</main>) as JSX.Element;
</main>
) as JSX.Element;
};

View file

@ -4,7 +4,8 @@ import type { JSX } from 'solid-js';
export default function Home() {
return (<main>
return (
<main>
<Title>About Lightning</Title>
<h1>About</h1>
@ -51,5 +52,6 @@ export default function Home() {
github.com/adoyle0/maps
</a> </p>
</main>) as JSX.Element;
</main>
) as JSX.Element;
};

View file

@ -4,7 +4,9 @@ import type { JSX } from 'solid-js';
export default function Home() {
return (<>
return (
<>
<Title>Ride the Lightning</Title>
</>) as JSX.Element;
</>
) as JSX.Element;
};

View file

@ -1,15 +1,27 @@
import { Title, } from 'solid-start';
import { Suspense } from 'solid-js';
import AccordionTest from '~/components/AccordionTest';
import type { JSX } from 'solid-js';
export default function Stations() {
return (<>
<Title>Ride the Lightning</Title>
<Suspense>
<AccordionTest />
</Suspense>
</>) as JSX.Element;
import AccordionTest from '~/components/AccordionTest';
import { useStationsContext } from '~/components/StationsContext';
const TEST_PACKET: StationRequest = {
Latitude: 42.36,
Longitude: -71.05625,
Distance: 1000,
CountLimit: 20000,
};
export default function Stations() {
const [stations, {setStationsRequest}] = useStationsContext();
setStationsRequest(TEST_PACKET);
return (
<>
<Title>Ride the Lightning</Title>
<AccordionTest />
</>
) as JSX.Element;
};