Remove unused code.
This commit is contained in:
+1
-2
@@ -8,8 +8,7 @@
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"package": "gzipper c -i html,js,css,png,ico,svg,webmanifest,txt dist dist/output && tar -cvf dist/build.tar -C ./dist/output/ $(ls ./dist/output/)",
|
||||
"format": "prettier --write 'src/**/*.{ts,tsx}' && eslint src/*.{ts,tsx}",
|
||||
"check": "unimported"
|
||||
"format": "prettier --write 'src/**/*.{ts,tsx}' && eslint src/*.{ts,tsx}"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import type React from "react"
|
||||
import type React from "react";
|
||||
|
||||
import { Pane } from "evergreen-ui"
|
||||
import { Pane } from "evergreen-ui";
|
||||
|
||||
export const HelpDialog = (): JSX.Element => {
|
||||
return (
|
||||
<Pane></Pane>
|
||||
)
|
||||
}
|
||||
return <Pane></Pane>;
|
||||
};
|
||||
|
||||
@@ -45,13 +45,13 @@ export const QRDialog = ({
|
||||
})
|
||||
);
|
||||
const base64 = fromByteArray(encoded)
|
||||
.replace(/=/g, "")
|
||||
.replace(/\+/g, "-")
|
||||
.replace(/\//g, "_");
|
||||
.replace(/=/g, "")
|
||||
.replace(/\+/g, "-")
|
||||
.replace(/\//g, "_");
|
||||
|
||||
setQRCodeURL(`https://www.meshtastic.org/e/#${base64}`);
|
||||
}, [channels, selectedChannels, loraConfig]);
|
||||
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
isShown={isOpen}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import type React from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { Map, MapOptions } from "maplibre-gl";
|
||||
|
||||
export interface useMapboxProps {
|
||||
ref: React.RefObject<HTMLDivElement>;
|
||||
style: string;
|
||||
options?: Partial<MapOptions>;
|
||||
}
|
||||
|
||||
export function useCreateMapbox({
|
||||
ref,
|
||||
style,
|
||||
options,
|
||||
}: useMapboxProps): Map | undefined {
|
||||
const [mapInstance, setMapInstance] = useState<Map>();
|
||||
useEffect(() => {
|
||||
const container = ref.current as HTMLDivElement;
|
||||
if (mapInstance || !container) {
|
||||
return;
|
||||
}
|
||||
const map = new Map({
|
||||
container,
|
||||
style,
|
||||
...options,
|
||||
});
|
||||
setMapInstance(map);
|
||||
}, []);
|
||||
|
||||
return mapInstance;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
import type { Map } from "maplibre-gl";
|
||||
|
||||
export interface MapContextValue {
|
||||
ref: React.Ref<HTMLDivElement>;
|
||||
map?: Map;
|
||||
}
|
||||
|
||||
export const MapContext = createContext<MapContextValue>({} as MapContextValue);
|
||||
|
||||
export const useMap = (): MapContextValue => {
|
||||
return useContext(MapContext);
|
||||
};
|
||||
@@ -43,8 +43,6 @@ export const ModuleConfig = (): JSX.Element => {
|
||||
label: "Canned Message",
|
||||
element: CannedMessage,
|
||||
},
|
||||
// Channels
|
||||
// Interface
|
||||
];
|
||||
|
||||
return (
|
||||
|
||||
+56
-36
@@ -1,60 +1,82 @@
|
||||
import type React from "react";
|
||||
import { useRef } from "react";
|
||||
|
||||
import { majorScale, MapMarkerIcon, Pane } from "evergreen-ui";
|
||||
import {
|
||||
Heading,
|
||||
IconButton,
|
||||
LocateIcon,
|
||||
majorScale,
|
||||
MapMarkerIcon,
|
||||
Pane,
|
||||
Text,
|
||||
} from "evergreen-ui";
|
||||
import maplibregl from "maplibre-gl";
|
||||
import Map, { Marker } from "react-map-gl";
|
||||
import { Map, Marker, useMap } from "react-map-gl";
|
||||
|
||||
import { useDevice } from "@core/providers/useDevice.js";
|
||||
import { Hashicon } from "@emeraldpay/hashicon-react";
|
||||
|
||||
export const MapPage = (): JSX.Element => {
|
||||
const { nodes, waypoints } = useDevice();
|
||||
|
||||
// const nodeMarkers = useMemo(() => new Map<number, Marker>(), []);
|
||||
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
// useEffect(() => {
|
||||
// nodes.map((n) => {
|
||||
// if (n.data.position?.longitudeI && n.data.position?.latitudeI && map) {
|
||||
// if (nodeMarkers.has(n.data.num)) {
|
||||
// nodeMarkers
|
||||
// .get(n.data.num)
|
||||
// ?.setLngLat([
|
||||
// n.data.position?.longitudeI / 1e7,
|
||||
// n.data.position?.latitudeI / 1e7,
|
||||
// ]);
|
||||
// } else {
|
||||
// nodeMarkers.set(
|
||||
// n.data.num,
|
||||
// new Marker()
|
||||
// .setLngLat([
|
||||
// n.data.position?.longitudeI / 1e7,
|
||||
// n.data.position?.latitudeI / 1e7,
|
||||
// ])
|
||||
// .addTo(map)
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }, [map, nodeMarkers, nodes]);
|
||||
const { current: map } = useMap();
|
||||
|
||||
return (
|
||||
<Pane
|
||||
margin={majorScale(3)}
|
||||
borderRadius={majorScale(1)}
|
||||
background="white"
|
||||
elevation={1}
|
||||
display="flex"
|
||||
flexGrow={1}
|
||||
flexDirection="column"
|
||||
gap={majorScale(2)}
|
||||
overflow="hidden"
|
||||
position="relative"
|
||||
>
|
||||
<Pane
|
||||
position="absolute"
|
||||
zIndex={10}
|
||||
right={0}
|
||||
top={0}
|
||||
borderRadius={majorScale(1)}
|
||||
padding={majorScale(1)}
|
||||
margin={majorScale(1)}
|
||||
background="tint1"
|
||||
width={majorScale(28)}
|
||||
elevation={1}
|
||||
overflow="hidden"
|
||||
>
|
||||
<Pane padding={majorScale(1)} background="tint2">
|
||||
<Heading>Title</Heading>
|
||||
</Pane>
|
||||
<Pane display="flex" flexDirection="column" gap={majorScale(1)}>
|
||||
{nodes.map((n) => (
|
||||
<Pane key={n.data.num} display="flex" gap={majorScale(1)}>
|
||||
<Hashicon value={n.data.num.toString()} size={24} />
|
||||
<Text>{n.data.user?.longName}</Text>
|
||||
<IconButton
|
||||
icon={LocateIcon}
|
||||
marginLeft="auto"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
console.log("clicked");
|
||||
console.log(map);
|
||||
|
||||
map?.flyTo({
|
||||
center: [
|
||||
n.data.position?.latitudeI / 1e7,
|
||||
n.data.position?.longitudeI / 1e7,
|
||||
],
|
||||
zoom: 10,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Pane>
|
||||
))}
|
||||
</Pane>
|
||||
</Pane>
|
||||
<Map
|
||||
mapStyle="https://raw.githubusercontent.com/hc-oss/maplibre-gl-styles/master/styles/osm-mapnik/v8/default.json"
|
||||
mapLib={maplibregl}
|
||||
attributionControl={false}
|
||||
>
|
||||
{waypoints.map((wp) => (
|
||||
<Marker
|
||||
@@ -79,9 +101,7 @@ export const MapPage = (): JSX.Element => {
|
||||
latitude={n.data.position.latitudeI / 1e7}
|
||||
anchor="bottom"
|
||||
>
|
||||
<Pane>
|
||||
<Hashicon value={n.data.num.toString()} size={32} />
|
||||
</Pane>
|
||||
<Hashicon value={n.data.num.toString()} size={32} />
|
||||
</Marker>
|
||||
);
|
||||
}
|
||||
|
||||
Vendored
+16
-29
@@ -4,71 +4,58 @@
|
||||
///<reference types="chrome"/>
|
||||
|
||||
/* CSS MODULES */
|
||||
declare module '*.module.css' {
|
||||
declare module "*.module.css" {
|
||||
const classes: { [key: string]: string };
|
||||
export default classes;
|
||||
}
|
||||
declare module '*.module.scss' {
|
||||
declare module "*.module.scss" {
|
||||
const classes: { [key: string]: string };
|
||||
export default classes;
|
||||
}
|
||||
declare module '*.module.sass' {
|
||||
declare module "*.module.sass" {
|
||||
const classes: { [key: string]: string };
|
||||
export default classes;
|
||||
}
|
||||
declare module '*.module.less' {
|
||||
declare module "*.module.less" {
|
||||
const classes: { [key: string]: string };
|
||||
export default classes;
|
||||
}
|
||||
declare module '*.module.styl' {
|
||||
declare module "*.module.styl" {
|
||||
const classes: { [key: string]: string };
|
||||
export default classes;
|
||||
}
|
||||
|
||||
/* CSS */
|
||||
declare module '*.css';
|
||||
declare module '*.scss';
|
||||
declare module '*.sass';
|
||||
declare module '*.less';
|
||||
declare module '*.styl';
|
||||
declare module "*.css";
|
||||
declare module "*.scss";
|
||||
declare module "*.sass";
|
||||
declare module "*.less";
|
||||
declare module "*.styl";
|
||||
|
||||
/* IMAGES */
|
||||
declare module '*.svg' {
|
||||
declare module "*.svg" {
|
||||
const ref: string;
|
||||
export default ref;
|
||||
}
|
||||
declare module '*.bmp' {
|
||||
declare module "*.bmp" {
|
||||
const ref: string;
|
||||
export default ref;
|
||||
}
|
||||
declare module '*.gif' {
|
||||
declare module "*.gif" {
|
||||
const ref: string;
|
||||
export default ref;
|
||||
}
|
||||
declare module '*.jpg' {
|
||||
declare module "*.jpg" {
|
||||
const ref: string;
|
||||
export default ref;
|
||||
}
|
||||
declare module '*.jpeg' {
|
||||
declare module "*.jpeg" {
|
||||
const ref: string;
|
||||
export default ref;
|
||||
}
|
||||
declare module '*.png' {
|
||||
declare module "*.png" {
|
||||
const ref: string;
|
||||
export default ref;
|
||||
}
|
||||
|
||||
/* CUSTOM: ADD YOUR OWN HERE */
|
||||
|
||||
type Primitive = string | number | boolean | symbol | undefined | null;
|
||||
type DeepOmitHelper<T, K extends keyof T> = {
|
||||
[P in K]: T[P] extends infer TP //extra level of indirection needed to trigger homomorhic behavior // distribute over unions
|
||||
? TP extends Primitive
|
||||
? TP // leave primitives and functions alone
|
||||
: DeepOmit<TP, K>
|
||||
: never;
|
||||
};
|
||||
|
||||
type DeepOmit<T, K> = T extends Primitive
|
||||
? T
|
||||
: DeepOmitHelper<T, Exclude<keyof T, K>>;
|
||||
|
||||
Reference in New Issue
Block a user