minor fixes
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
TabsTrigger,
|
||||
} from "@components/UI/Tabs.js";
|
||||
import { useDevice } from "@core/stores/deviceStore.js";
|
||||
import { Fragment } from "react";
|
||||
|
||||
export const DeviceConfig = (): JSX.Element => {
|
||||
const { metadata } = useDevice();
|
||||
|
||||
@@ -6,9 +6,7 @@ import { H3 } from "@components/UI/Typography/H3.js";
|
||||
import { Subtle } from "@components/UI/Typography/Subtle.js";
|
||||
import {
|
||||
BluetoothIcon,
|
||||
CalendarIcon,
|
||||
ListPlusIcon,
|
||||
MapPinIcon,
|
||||
NetworkIcon,
|
||||
PlusIcon,
|
||||
UsbIcon,
|
||||
@@ -35,7 +33,7 @@ export const Dashboard = () => {
|
||||
|
||||
<div className="flex h-[450px] rounded-md border border-dashed border-slate-200 p-3 dark:border-slate-700">
|
||||
{devices.length ? (
|
||||
<ul role="list" className="grow divide-y divide-gray-200">
|
||||
<ul className="grow divide-y divide-gray-200">
|
||||
{devices.map((device) => {
|
||||
return (
|
||||
<li key={device.id}>
|
||||
|
||||
+17
-11
@@ -14,9 +14,9 @@ import {
|
||||
ZoomInIcon,
|
||||
ZoomOutIcon,
|
||||
} from "lucide-react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Layer, Marker, Source, useMap } from "react-map-gl";
|
||||
import MapGL from "react-map-gl/maplibre";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Marker, useMap } from "react-map-gl";
|
||||
import MapGl from "react-map-gl/maplibre";
|
||||
|
||||
export const MapPage = (): JSX.Element => {
|
||||
const { nodes, waypoints } = useDevice();
|
||||
@@ -28,11 +28,15 @@ export const MapPage = (): JSX.Element => {
|
||||
const allNodes = Array.from(nodes.values());
|
||||
|
||||
const getBBox = () => {
|
||||
if (!map) return;
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
const nodesWithPosition = allNodes.filter(
|
||||
(node) => node.position?.latitudeI,
|
||||
);
|
||||
if (!nodesWithPosition.length) return;
|
||||
if (!nodesWithPosition.length) {
|
||||
return;
|
||||
}
|
||||
if (nodesWithPosition.length === 1) {
|
||||
map.easeTo({
|
||||
zoom: 12,
|
||||
@@ -57,20 +61,22 @@ export const MapPage = (): JSX.Element => {
|
||||
],
|
||||
{ padding: { top: 10, bottom: 10, left: 10, right: 10 } },
|
||||
);
|
||||
if (center) map.easeTo(center);
|
||||
if (center) {
|
||||
map.easeTo(center);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
map?.on("zoom", () => {
|
||||
setZoom(map?.getZoom() ?? 0);
|
||||
});
|
||||
}, [map, zoom]);
|
||||
}, [map]);
|
||||
|
||||
useEffect(() => {
|
||||
if (map) {
|
||||
getBBox();
|
||||
}
|
||||
}, [map]);
|
||||
}, [map, getBBox]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -83,7 +89,7 @@ export const MapPage = (): JSX.Element => {
|
||||
</Sidebar>
|
||||
<PageLayout
|
||||
label="Map"
|
||||
noPadding
|
||||
noPadding={true}
|
||||
actions={[
|
||||
{
|
||||
icon: ZoomInIcon,
|
||||
@@ -105,7 +111,7 @@ export const MapPage = (): JSX.Element => {
|
||||
},
|
||||
]}
|
||||
>
|
||||
<MapGL
|
||||
<MapGl
|
||||
mapStyle="https://raw.githubusercontent.com/hc-oss/maplibre-gl-styles/master/styles/osm-mapnik/v8/default.json"
|
||||
// onClick={(e) => {
|
||||
// const waypoint = new Protobuf.Waypoint({
|
||||
@@ -177,7 +183,7 @@ export const MapPage = (): JSX.Element => {
|
||||
);
|
||||
}
|
||||
})}
|
||||
</MapGL>
|
||||
</MapGl>
|
||||
</PageLayout>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Hashicon } from "@emeraldpay/hashicon-react";
|
||||
import { Protobuf, Types } from "@meshtastic/meshtasticjs";
|
||||
import { getChannelName } from "@pages/Channels.js";
|
||||
import { HashIcon } from "lucide-react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useState } from "react";
|
||||
|
||||
export const MessagesPage = (): JSX.Element => {
|
||||
const { channels, nodes, hardware, messages } = useDevice();
|
||||
@@ -37,8 +37,8 @@ export const MessagesPage = (): JSX.Element => {
|
||||
channel.settings?.name.length
|
||||
? channel.settings?.name
|
||||
: channel.index === 0
|
||||
? "Primary"
|
||||
: `Ch ${channel.index}`
|
||||
? "Primary"
|
||||
: `Ch ${channel.index}`
|
||||
}
|
||||
active={activeChat === channel.index}
|
||||
onClick={() => {
|
||||
@@ -69,8 +69,8 @@ export const MessagesPage = (): JSX.Element => {
|
||||
chatType === "broadcast" && currentChannel
|
||||
? getChannelName(currentChannel)
|
||||
: chatType === "direct" && nodes.get(activeChat)
|
||||
? nodes.get(activeChat)?.user?.longName ?? "Unknown"
|
||||
: "Loading..."
|
||||
? nodes.get(activeChat)?.user?.longName ?? "Unknown"
|
||||
: "Loading..."
|
||||
}`}
|
||||
>
|
||||
{allChannels.map(
|
||||
|
||||
Reference in New Issue
Block a user