diff --git a/src/components/MapBox/MapboxProvider.tsx b/src/components/MapBox/MapboxProvider.tsx index 747c2f9b..5ead930f 100644 --- a/src/components/MapBox/MapboxProvider.tsx +++ b/src/components/MapBox/MapboxProvider.tsx @@ -1,5 +1,7 @@ import React from 'react'; +import mapboxgl from 'mapbox-gl'; + import { setBearing, setLatLng, @@ -35,11 +37,14 @@ export const MapboxProvider = ({ zoom: mapState.zoom, bearing: mapState.bearing, pitch: mapState.pitch, - style: mapState.style.url, + style: mapState.style.data, }, }); React.useEffect(() => { + map?.on('load', () => { + map.addControl(new mapboxgl.ScaleControl()); + }); map?.on('styledata', () => { if (!map.getSource('mapbox-dem')) { map.addSource('mapbox-dem', { @@ -120,7 +125,7 @@ export const MapboxProvider = ({ */ React.useEffect(() => { if (map?.loaded()) { - map.setStyle(mapState.style.url); + map.setStyle(mapState.style.data); } }, [map, mapState.style]); diff --git a/src/components/layout/Sidebar/Settings/Index.tsx b/src/components/layout/Sidebar/Settings/Index.tsx index 25988d1a..c24a009d 100644 --- a/src/components/layout/Sidebar/Settings/Index.tsx +++ b/src/components/layout/Sidebar/Settings/Index.tsx @@ -18,7 +18,6 @@ import { import { CollapsibleSection } from '@app/components/layout/Sidebar/sections/CollapsibleSection'; import { ExternalSection } from '@app/components/layout/Sidebar/sections/ExternalSection'; import { SidebarOverlay } from '@app/components/layout/Sidebar/sections/SidebarOverlay'; -import { SidebarPrimary } from '@app/components/layout/Sidebar/sections/SidebarPrimary'; import { Channels } from '@app/components/layout/Sidebar/Settings/Channels'; import { ExternalNotificationsSettingsPlanel } from '@app/components/layout/Sidebar/Settings/plugins/panels/ExternalNotifications/SettingsPlanel'; import { RangeTestSettingsPanel } from '@app/components/layout/Sidebar/Settings/plugins/panels/RangeTest/SettingsPanel'; @@ -48,12 +47,13 @@ export const Settings = ({ open, setOpen }: SettingsProps): JSX.Element => { return ( <> - { setOpen(false); }} + direction="y" > } title="WiFi & MQTT"> @@ -90,7 +90,7 @@ export const Settings = ({ open, setOpen }: SettingsProps): JSX.Element => { } title="Interface"> - + {/* Plugins */} { close={(): void => { setPluginsOpen(false); }} + direction="x" > }> @@ -122,6 +123,7 @@ export const Settings = ({ open, setOpen }: SettingsProps): JSX.Element => { close={(): void => { setChannelsOpen(false); }} + direction="x" > diff --git a/src/components/layout/Sidebar/sections/SidebarOverlay.tsx b/src/components/layout/Sidebar/sections/SidebarOverlay.tsx index ac5ceec9..28adac5b 100644 --- a/src/components/layout/Sidebar/sections/SidebarOverlay.tsx +++ b/src/components/layout/Sidebar/sections/SidebarOverlay.tsx @@ -9,6 +9,7 @@ export interface SidebarOverlayProps { title: string; open: boolean; close: () => void; + direction: 'x' | 'y'; children: React.ReactNode; } @@ -16,20 +17,25 @@ export const SidebarOverlay = ({ title, open, close, + direction, children, }: SidebarOverlayProps): JSX.Element => { return ( {open && ( -
+
{ close(); diff --git a/src/components/layout/Sidebar/sections/SidebarPrimary.tsx b/src/components/layout/Sidebar/sections/SidebarPrimary.tsx deleted file mode 100644 index add31f2b..00000000 --- a/src/components/layout/Sidebar/sections/SidebarPrimary.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import type React from 'react'; - -import { AnimatePresence, AnimateSharedLayout, m } from 'framer-motion'; -import { FiArrowDown } from 'react-icons/fi'; - -import { IconButton } from '@meshtastic/components'; - -export interface SidebarPrimaryProps { - title: string; - open: boolean; - close: () => void; - children: React.ReactNode; -} - -export const SidebarPrimary = ({ - title, - open, - close, - children, -}: SidebarPrimaryProps): JSX.Element => { - return ( - - {open && ( - - -
- { - close(); - }} - icon={} - /> -
- {title} -
-
- -
{children}
-
-
- )} -
- ); -}; diff --git a/src/pages/Map/styles.ts b/src/pages/Map/styles.ts index 8ef49de8..48b607d7 100644 --- a/src/pages/Map/styles.ts +++ b/src/pages/Map/styles.ts @@ -1,28 +1,48 @@ +import type { Style } from 'mapbox-gl'; + export interface MapStyle { title: string; - url: string; + data: Style | string; } export const MapStyles = { Streets: { title: 'Streets', - url: 'mapbox://styles/mapbox/streets-v11?optimize=true', + data: 'mapbox://styles/mapbox/streets-v11?optimize=true', } as MapStyle, Outdoors: { title: 'Outdoors', - url: 'mapbox://styles/mapbox/outdoors-v11?optimize=true', + data: 'mapbox://styles/mapbox/outdoors-v11?optimize=true', } as MapStyle, Light: { title: 'Light', - url: 'mapbox://styles/mapbox/light-v10?optimize=true', + data: 'mapbox://styles/mapbox/light-v10?optimize=true', } as MapStyle, Dark: { title: 'Dark', - url: 'mapbox://styles/sachaw/ckwzwm92e1oep14pjunjqlqbo?optimize=true', + data: 'mapbox://styles/sachaw/ckwzwm92e1oep14pjunjqlqbo?optimize=true', } as MapStyle, Satellite: { title: 'Satellite', - url: 'mapbox://styles/mapbox/satellite-v9?optimize=true', + + data: { + version: 8, + layers: [ + { + id: 'esri', + type: 'raster', + source: 'esri', + }, + ], + sources: { + esri: { + type: 'raster', + tiles: [ + 'https://clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', + ], + }, + }, + }, } as MapStyle, }; diff --git a/src/pages/Nodes/NodeCard.tsx b/src/pages/Nodes/NodeCard.tsx index 96b6f494..1b8aa821 100644 --- a/src/pages/Nodes/NodeCard.tsx +++ b/src/pages/Nodes/NodeCard.tsx @@ -114,6 +114,7 @@ export const NodeCard = ({ close={(): void => { setInfoOpen(false); }} + direction="x" > }>
Info