import { useDevice } from "@app/core/stores/deviceStore"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@components/UI/Dialog"; import type { Protobuf, Types } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; import type { JSX } from "react"; export interface LocationResponseDialogProps { location: Types.PacketMetadata | undefined; open: boolean; onOpenChange: () => void; } export const LocationResponseDialog = ({ location, open, onOpenChange, }: LocationResponseDialogProps): JSX.Element => { const { nodes } = useDevice(); const from = nodes.get(location?.from ?? 0); const longName = from?.user?.longName ?? (from ? `!${numberToHexUnpadded(from?.num)}` : "Unknown"); const shortName = from?.user?.shortName ?? (from ? `${numberToHexUnpadded(from?.num).substring(0, 4)}` : "UNK"); return ( {`Location: ${longName} (${shortName})`}

Coordinates:{" "} {location?.data.latitudeI / 1e7},{" "} {location?.data.longitudeI / 1e7}

Altitude: {location?.data.altitude}m

); };