import { useDevice } from "../../core/stores/deviceStore.ts"; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "../UI/Dialog.tsx"; import type { Protobuf, Types } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; export interface LocationResponseDialogProps { location: Types.PacketMetadata | undefined; open: boolean; onOpenChange: () => void; } export const LocationResponseDialog = ({ location, open, onOpenChange, }: LocationResponseDialogProps) => { 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

); };