From d14be02a7df1e644b94d6a8cf7e92c9349ff0ce0 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Sat, 3 Feb 2024 18:20:50 -0500 Subject: [PATCH] use @rdub/next-plotly --- www/next.config.js | 1 + www/package.json | 7 ++- www/pages/_app.js | 1 + www/pages/index.tsx | 79 ++++++------------------ www/pnpm-lock.yaml | 107 ++++++++++++--------------------- www/src/components/Map/Map.tsx | 5 +- 6 files changed, 65 insertions(+), 135 deletions(-) diff --git a/www/next.config.js b/www/next.config.js index e5ba776e..dc95999f 100644 --- a/www/next.config.js +++ b/www/next.config.js @@ -16,6 +16,7 @@ const nextConfig = { webpack({ optimization, ...webpackConfig }) { return { ...webpackConfig, optimization: { ...optimization, minimize } }; }, + output: "export", } const withMDX = require('@next/mdx')({ diff --git a/www/package.json b/www/package.json index 0c7aeba0..8e5602df 100644 --- a/www/package.json +++ b/www/package.json @@ -11,6 +11,7 @@ "@rdub/next-base": "^0.1.0", "@rdub/next-markdown": "0.0.2", "@rdub/next-params": "^0.0.1", + "@rdub/next-plotly": "^0.0.3", "assert": "^2.0.0", "aws-sdk": "^2.1043.0", "bootstrap": "^4.1.3", @@ -19,7 +20,7 @@ "d3-color": ">=3.1.0", "danfojs": "^1.1.2", "jquery": "^3.6.0", - "leaflet": "^1.9.2", + "leaflet": "^1.9.4", "lodash": "^4.17.21", "moment": "^2.29.1", "next": "^14", @@ -28,9 +29,8 @@ "process": "^0.11.10", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-leaflet": "^4.1.0", + "react-leaflet": "^4.2.1", "react-markdown": "^7.1.1", - "react-plotly.js": "^2.6.0", "react-router-dom": "^6.0.2", "react-tooltip": "^5.0.0" }, @@ -41,6 +41,7 @@ "@types/lodash": "^4.14.177", "@types/node-fetch": "^2.6.2", "@types/parquetjs": "^0.10.3", + "@types/plotly.js": "^2.29.0", "@types/react": "^18.0.25", "@types/react-dom": "^18.0.9", "@types/react-plotly.js": "^2.5.0", diff --git a/www/pages/_app.js b/www/pages/_app.js index 51b8157e..5bc925a1 100644 --- a/www/pages/_app.js +++ b/www/pages/_app.js @@ -1,4 +1,5 @@ import 'bootstrap/dist/css/bootstrap.css' +import 'leaflet/dist/leaflet.css'; import '../styles/globals.css' function MyApp({ Component, pageProps }) { diff --git a/www/pages/index.tsx b/www/pages/index.tsx index 955a32f1..8e498983 100644 --- a/www/pages/index.tsx +++ b/www/pages/index.tsx @@ -29,16 +29,16 @@ import Link from "next/link"; import 'react-tooltip/dist/react-tooltip.css' import {darken} from "../src/colors"; -import {Figure} from "react-plotly.js"; +import { Figure, PlotParams } from "react-plotly.js"; import { useEffect } from "react"; -const Plot = dynamic(() => import("react-plotly.js"), { ssr: false, }) const Tooltip = dynamic(() => import("react-tooltip").then(m => m.Tooltip), { ssr: false, }) const {pow} = Math const JSON_PATH = 'public/assets/ymrgtb_cd.json' import {LAST_MONTH_PATH} from "../src/paths"; +import PlotWrapper from "@rdub/next-plotly/plot-wrapper"; export async function getStaticProps(context: any) { const data = loadSync(JSON_PATH) @@ -517,8 +517,6 @@ export default function App({ data, lastMonthStr }: { data: Row[], lastMonthStr: const [ initialized, setInitialized ] = useState(false) const clickToToggle = false - // const width = 768 - const height = 450 const src = 'screenshots/plot-fallback.png' const [ initializedPlot, setInitializedPlot ] = useState(null) const [ firstRender, setFirstRender ] = useState(new Date) @@ -543,7 +541,7 @@ export default function App({ data, lastMonthStr }: { data: Row[], lastMonthStr: .then(m => m.default) .then( Plotly => Plotly.downloadImage( - figure as RootOrData, + figure, { width: graphDiv.offsetWidth, height: graphDiv.offsetHeight, @@ -557,6 +555,17 @@ export default function App({ data, lastMonthStr }: { data: Row[], lastMonthStr: [ initializedPlot?.set ] ) + const plotParams: PlotParams = { + data: traces, + useResizeHandler: true, + layout: layout, + config: { + displayModeBar: false, + // staticPlot: true, + // responsive: true, + } + } + return (
{subtitle}

}
{/* Main plot: bar graph + rolling avg line(s) */} -
-
clickToToggle && setInitialized(true)} - > - {title} -
- { - , graphDiv: Readonly) => { - if (!plotInitialized) { - // This can still run more than once; true once-only semantics (for storing only a - // timestamp only the first time this code path is hit) comes from - // `useEffect(…, [ set ])` above. - setPlotInitialized({ time: Date.now(), set: true }) - } - - console.log("initialized:", figure, graphDiv) - setInitializedPlot({ figure, graphDiv, set: true }) - clickToToggle || setInitialized(true) - }} - onDoubleClick={() => setDateRange('All')} - onRelayout={e => { - if (!('xaxis.range[0]' in e && 'xaxis.range[1]' in e)) return - let [start, end] = [e['xaxis.range[0]'], e['xaxis.range[1]'],].map(s => s ? new Date(s) : undefined) - start = start ? moment(start).subtract(1, 'month').toDate() : start - const dateRange = (!start && !end) ? 'All' : {start, end,} - // console.log("relayout:", e, start, end, dateRange,) - setDateRange(dateRange) - }} - data={traces} - useResizeHandler - layout={layout} - config={{ - displayModeBar: false, - // staticPlot: true, - // responsive: true, - }} - /> - } -
- {/* DateRange controls */} +
+ {/* DateRange controls */}
{ diff --git a/www/pnpm-lock.yaml b/www/pnpm-lock.yaml index 2fe94d1b..01386e5b 100644 --- a/www/pnpm-lock.yaml +++ b/www/pnpm-lock.yaml @@ -23,6 +23,9 @@ dependencies: '@rdub/next-params': specifier: ^0.0.1 version: 0.0.1(next@14.1.0)(react-dom@18.2.0)(react@18.2.0) + '@rdub/next-plotly': + specifier: ^0.0.3 + version: 0.0.3(mapbox-gl@1.13.3)(next@14.1.0)(react-dom@18.2.0)(react@18.2.0)(webpack@5.90.1) assert: specifier: ^2.0.0 version: 2.1.0 @@ -48,7 +51,7 @@ dependencies: specifier: ^3.6.0 version: 3.7.1 leaflet: - specifier: ^1.9.2 + specifier: ^1.9.4 version: 1.9.4 lodash: specifier: ^4.17.21 @@ -75,14 +78,11 @@ dependencies: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) react-leaflet: - specifier: ^4.1.0 + specifier: ^4.2.1 version: 4.2.1(leaflet@1.9.4)(react-dom@18.2.0)(react@18.2.0) react-markdown: specifier: ^7.1.1 version: 7.1.2(@types/react@18.2.52)(react@18.2.0) - react-plotly.js: - specifier: ^2.6.0 - version: 2.6.0(plotly.js@2.29.0)(react@18.2.0) react-router-dom: specifier: ^6.0.2 version: 6.22.0(react-dom@18.2.0)(react@18.2.0) @@ -109,6 +109,9 @@ devDependencies: '@types/parquetjs': specifier: ^0.10.3 version: 0.10.6 + '@types/plotly.js': + specifier: ^2.29.0 + version: 2.29.0 '@types/react': specifier: ^18.0.25 version: 18.2.52 @@ -246,7 +249,6 @@ packages: /@babel/helper-plugin-utils@7.22.5: resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} engines: {node: '>=6.9.0'} - dev: true /@babel/helper-simple-access@7.22.5: resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} @@ -305,7 +307,6 @@ packages: dependencies: '@babel/core': 7.23.9 '@babel/helper-plugin-utils': 7.22.5 - dev: true /@babel/runtime@7.23.9: resolution: {integrity: sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==} @@ -366,7 +367,6 @@ packages: cpu: [ppc64] os: [aix] requiresBuild: true - dev: true optional: true /@esbuild/android-arm64@0.19.12: @@ -375,7 +375,6 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-arm@0.19.12: @@ -384,7 +383,6 @@ packages: cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-x64@0.19.12: @@ -393,7 +391,6 @@ packages: cpu: [x64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/darwin-arm64@0.19.12: @@ -402,7 +399,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/darwin-x64@0.19.12: @@ -411,7 +407,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-arm64@0.19.12: @@ -420,7 +415,6 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-x64@0.19.12: @@ -429,7 +423,6 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm64@0.19.12: @@ -438,7 +431,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm@0.19.12: @@ -447,7 +439,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ia32@0.19.12: @@ -456,7 +447,6 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-loong64@0.19.12: @@ -465,7 +455,6 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-mips64el@0.19.12: @@ -474,7 +463,6 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ppc64@0.19.12: @@ -483,7 +471,6 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-riscv64@0.19.12: @@ -492,7 +479,6 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-s390x@0.19.12: @@ -501,7 +487,6 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-x64@0.19.12: @@ -510,7 +495,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/netbsd-x64@0.19.12: @@ -519,7 +503,6 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true - dev: true optional: true /@esbuild/openbsd-x64@0.19.12: @@ -528,7 +511,6 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true - dev: true optional: true /@esbuild/sunos-x64@0.19.12: @@ -537,7 +519,6 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true - dev: true optional: true /@esbuild/win32-arm64@0.19.12: @@ -546,7 +527,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-ia32@0.19.12: @@ -555,7 +535,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-x64@0.19.12: @@ -564,7 +543,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@floating-ui/core@1.6.0: @@ -979,6 +957,35 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false + /@rdub/next-plotly@0.0.3(mapbox-gl@1.13.3)(next@14.1.0)(react-dom@18.2.0)(react@18.2.0)(webpack@5.90.1): + resolution: {integrity: sha512-zFglAsiYRuEMFnLoZ8DVty4wvr3yXxA+PPuFdlhqA+FT/V/V/dYEepXoItIKaYLCywCxCl0JAmngsEm86YEYlg==} + peerDependencies: + next: ^14 + react: ^18 + react-dom: ^18 + dependencies: + '@rdub/base': 0.1.0(react-dom@18.2.0)(react@18.2.0) + '@rdub/next-base': 0.1.0(next@14.1.0)(react-dom@18.2.0)(react@18.2.0) + '@vanilla-extract/css': 1.14.1 + '@vanilla-extract/next-plugin': 2.3.6(next@14.1.0)(webpack@5.90.1) + next: 14.1.0(@babel/core@7.23.9)(react-dom@18.2.0)(react@18.2.0) + plotly.js: 2.29.0(mapbox-gl@1.13.3) + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + react-plotly.js: 2.6.0(plotly.js@2.29.0)(react@18.2.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - mapbox-gl + - sass + - stylus + - sugarss + - supports-color + - terser + - webpack + dev: false + /@react-leaflet/core@2.1.0(leaflet@1.9.4)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-Qk7Pfu8BSarKGqILj4x7bCSZ1pjuAPZ+qmRwH5S7mDS91VSbVVsJSrW4qA+GPrro8t69gFYVMWb1Zc4yFmPiVg==} peerDependencies: @@ -1001,7 +1008,6 @@ packages: cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true /@rollup/rollup-android-arm64@4.9.6: @@ -1009,7 +1015,6 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true /@rollup/rollup-darwin-arm64@4.9.6: @@ -1017,7 +1022,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@rollup/rollup-darwin-x64@4.9.6: @@ -1025,7 +1029,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm-gnueabihf@4.9.6: @@ -1033,7 +1036,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm64-gnu@4.9.6: @@ -1041,7 +1043,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm64-musl@4.9.6: @@ -1049,7 +1050,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-riscv64-gnu@4.9.6: @@ -1057,7 +1057,6 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-x64-gnu@4.9.6: @@ -1065,7 +1064,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-x64-musl@4.9.6: @@ -1073,7 +1071,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-arm64-msvc@4.9.6: @@ -1081,7 +1078,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-ia32-msvc@4.9.6: @@ -1089,7 +1085,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-x64-msvc@4.9.6: @@ -1097,7 +1092,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@swc/helpers@0.5.2: @@ -1439,7 +1433,6 @@ packages: '@babel/core': 7.23.9 transitivePeerDependencies: - supports-color - dev: true /@vanilla-extract/css@1.14.1: resolution: {integrity: sha512-V4JUuHNjZgl64NGfkDJePqizkNgiSpphODtZEs4cCPuxLAzwOUJYATGpejwimJr1n529kq4DEKWexW22LMBokw==} @@ -1481,7 +1474,6 @@ packages: - sugarss - supports-color - terser - dev: true /@vanilla-extract/next-plugin@2.3.6(next@14.1.0)(webpack@5.90.1): resolution: {integrity: sha512-EzVJU5mUgMnERW4qVxIlivzjioFbgY+Q/hrrZxEsZBRpbcV35vf7oksCJc5seG2nzWTBRGJGoodJaXSm74pz3g==} @@ -1500,7 +1492,6 @@ packages: - supports-color - terser - webpack - dev: true /@vanilla-extract/private@1.0.3: resolution: {integrity: sha512-17kVyLq3ePTKOkveHxXuIJZtGYs+cSoev7BlP+Lf4916qfDhk/HBjvlYDe8egrea7LNPHKwSZJK/bzZC+Q6AwQ==} @@ -1524,7 +1515,6 @@ packages: - sugarss - supports-color - terser - dev: true /@webassemblyjs/ast@1.11.6: resolution: {integrity: sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==} @@ -1871,7 +1861,6 @@ packages: /big.js@5.2.2: resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} - dev: true /binary-search-bounds@2.0.5: resolution: {integrity: sha512-H0ea4Fd3lS1+sTEB2TgcLoK21lLhwEJzlQv3IN47pJS976Gx4zoWe0ak3q+uYh60ppQxg9F16Ri4tS1sfD4+jA==} @@ -1969,7 +1958,6 @@ packages: /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} - dev: true /call-bind@1.0.5: resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} @@ -2591,7 +2579,6 @@ packages: /emojis-list@3.0.0: resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} engines: {node: '>= 4'} - dev: true /end-of-stream@1.4.4: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} @@ -2691,7 +2678,6 @@ packages: '@esbuild/win32-arm64': 0.19.12 '@esbuild/win32-ia32': 0.19.12 '@esbuild/win32-x64': 0.19.12 - dev: true /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} @@ -2803,7 +2789,6 @@ packages: dependencies: '@types/node': 20.11.16 require-like: 0.1.2 - dev: true /eventemitter3@4.0.7: resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} @@ -2909,7 +2894,6 @@ packages: dependencies: locate-path: 6.0.0 path-exists: 4.0.0 - dev: true /flat@5.0.2: resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} @@ -2998,7 +2982,6 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true - dev: true optional: true /function-bind@1.1.2: @@ -3676,7 +3659,6 @@ packages: /javascript-stringify@2.1.0: resolution: {integrity: sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==} - dev: true /jest-worker@27.5.1: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} @@ -3769,7 +3751,6 @@ packages: /jsonc-parser@3.2.1: resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} - dev: true /kdbush@3.0.0: resolution: {integrity: sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==} @@ -3803,7 +3784,6 @@ packages: big.js: 5.2.2 emojis-list: 3.0.0 json5: 2.2.3 - dev: true /locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} @@ -3816,7 +3796,6 @@ packages: engines: {node: '>=10'} dependencies: p-locate: 5.0.0 - dev: true /lodash.clonedeep@4.5.0: resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==} @@ -4811,7 +4790,6 @@ packages: pathe: 1.1.2 pkg-types: 1.0.3 ufo: 1.3.2 - dev: true /modern-ahocorasick@1.0.1: resolution: {integrity: sha512-yoe+JbhTClckZ67b2itRtistFKf8yPYelHLc7e5xAwtNAXxM6wJTUx2C7QeVSJFDzKT7bCIFyBVybPMKvmB9AA==} @@ -5070,7 +5048,6 @@ packages: engines: {node: '>=10'} dependencies: yocto-queue: 0.1.0 - dev: true /p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} @@ -5083,7 +5060,6 @@ packages: engines: {node: '>=10'} dependencies: p-limit: 3.1.0 - dev: true /p-try@2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} @@ -5169,7 +5145,6 @@ packages: /pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} - dev: true /pbf@3.2.1: resolution: {integrity: sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==} @@ -5219,7 +5194,6 @@ packages: jsonc-parser: 3.2.1 mlly: 1.5.0 pathe: 1.1.2 - dev: true /plotly.js-dist-min@2.8.0: resolution: {integrity: sha512-6OOg/D7OEffYq1WJt4XKNHzJAd9uN3kCuKZcCr0RGvnSB3wvP7fDmfsUpxZR2q0M+3j7SKejJ8qv1HGkarnObg==} @@ -5322,7 +5296,6 @@ packages: nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 - dev: true /potpack@1.0.2: resolution: {integrity: sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==} @@ -5813,7 +5786,6 @@ packages: /require-like@0.1.2: resolution: {integrity: sha512-oyrU88skkMtDdauHDuKVrgR+zuItqr6/c//FXzvmxRGMexSDc6hNvJInGW3LL46n+8b50RykrvwSUIIQH2LQ5A==} - dev: true /requires-port@1.0.0: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} @@ -5876,7 +5848,6 @@ packages: '@rollup/rollup-win32-ia32-msvc': 4.9.6 '@rollup/rollup-win32-x64-msvc': 4.9.6 fsevents: 2.3.3 - dev: true /rw@1.3.3: resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==} @@ -6419,7 +6390,6 @@ packages: /ufo@1.3.2: resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} - dev: true /unbzip2-stream@1.4.3: resolution: {integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==} @@ -6690,7 +6660,6 @@ packages: - sugarss - supports-color - terser - dev: true /vite@5.0.12: resolution: {integrity: sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==} @@ -6725,7 +6694,6 @@ packages: rollup: 4.9.6 optionalDependencies: fsevents: 2.3.3 - dev: true /vt-pbf@3.1.3: resolution: {integrity: sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==} @@ -7098,7 +7066,6 @@ packages: /yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} - dev: true /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} diff --git a/www/src/components/Map/Map.tsx b/www/src/components/Map/Map.tsx index 44210990..9235bb61 100644 --- a/www/src/components/Map/Map.tsx +++ b/www/src/components/Map/Map.tsx @@ -1,7 +1,6 @@ import {ReactElement} from 'react'; import L from 'leaflet'; import * as ReactLeaflet from 'react-leaflet'; -import 'leaflet/dist/leaflet.css'; import styles from './Map.module.css'; @@ -9,11 +8,11 @@ import {MapContainerProps} from "react-leaflet/lib/MapContainer"; type MapProps = (Omit & { children: (RL: typeof ReactLeaflet, map: L.Map) => ReactElement<{}> }) -const _hooks = require("react-leaflet/hooks"); +import { useMap } from "react-leaflet" function MapConsumer(_ref: { children: (map: L.Map) => ReactElement<{}> }) { let { children } = _ref; - return children(_hooks.useMap()); + return children(useMap()); } const Map = ({ children, className, ...rest }: MapProps) => {