added api to get address
This commit is contained in:
@@ -16,9 +16,43 @@ export const ContextMenu = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Popup position={[popup.lat, popup.lng]}>
|
<Popup position={[popup.lat, popup.lng]}>
|
||||||
// TODO: maske:
|
{/* // TODO: maske: */}
|
||||||
<div className="w-60">
|
<div>
|
||||||
<h1>Context Menu</h1>
|
<button
|
||||||
|
className="btn btn-sm"
|
||||||
|
onClick={async () => {
|
||||||
|
const address = await fetch(
|
||||||
|
`https://nominatim.openstreetmap.org/reverse?lat=${popup.lat}&lon=${popup.lng}&format=json`,
|
||||||
|
);
|
||||||
|
const data = (await address.json()) as {
|
||||||
|
address: {
|
||||||
|
ISO3166_2_lvl4: string;
|
||||||
|
country: string;
|
||||||
|
country_code: string;
|
||||||
|
county: string;
|
||||||
|
hamlet: string;
|
||||||
|
municipality: string;
|
||||||
|
postcode: string;
|
||||||
|
road: string;
|
||||||
|
state: string;
|
||||||
|
town: string;
|
||||||
|
};
|
||||||
|
display_name: string;
|
||||||
|
importance: number;
|
||||||
|
lat: string;
|
||||||
|
licence: string;
|
||||||
|
lon: string;
|
||||||
|
name: string;
|
||||||
|
osm_id: number;
|
||||||
|
osm_type: string;
|
||||||
|
place_id: number;
|
||||||
|
place_rank: number;
|
||||||
|
type: string;
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Neues Einsatz hier Erstellen
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</Popup>
|
</Popup>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
|
|||||||
import Navbar from "./_components/navbar/Navbar";
|
import Navbar from "./_components/navbar/Navbar";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { getServerSession } from "../api/auth/[...nextauth]/auth";
|
import { getServerSession } from "../api/auth/[...nextauth]/auth";
|
||||||
|
import { Toaster } from "react-hot-toast";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "VAR Leitstelle v2",
|
title: "VAR Leitstelle v2",
|
||||||
@@ -19,6 +20,21 @@ export default async function RootLayout({
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Toaster
|
||||||
|
containerStyle={{
|
||||||
|
top: 150,
|
||||||
|
left: 20,
|
||||||
|
right: 20,
|
||||||
|
}}
|
||||||
|
toastOptions={{
|
||||||
|
style: {
|
||||||
|
background: "var(--color-base-100)",
|
||||||
|
color: "var(--color-base-content)",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
position="top-left"
|
||||||
|
reverseOrder={false}
|
||||||
|
/>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
{children}
|
{children}
|
||||||
</>
|
</>
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user