diff --git a/src/Components/Map/Subcomponents/HeaderView.tsx b/src/Components/Map/Subcomponents/HeaderView.tsx new file mode 100644 index 00000000..dfd661fc --- /dev/null +++ b/src/Components/Map/Subcomponents/HeaderView.tsx @@ -0,0 +1,69 @@ +import * as React from "react" +import { useRemoveItem } from "../hooks/useItems"; +import { useMap } from "react-leaflet"; +import { ItemFormPopupProps } from "./ItemFormPopup"; +import { LatLng } from "leaflet"; +import { Item } from "../../../types"; + + + +export function HeaderView({item, setItemFormPopup}: { + item : Item, + setItemFormPopup?: React.Dispatch> +}) { + + const removeItem = useRemoveItem(); + + const map = useMap(); + + const removeItemFromMap = (event: React.MouseEvent) => { + item.api?.deleteItem!(item.id) + .then( () => removeItem(item)) + .then(()=> map.closePopup()) + .catch(err => console.log(err)); + + event.stopPropagation(); + } + + const openEditPopup = (event: React.MouseEvent) => { + event.stopPropagation(); + map.closePopup(); + if (setItemFormPopup) + setItemFormPopup({ position: new LatLng(item.position.coordinates[1], item.position.coordinates[0]), layer: item.layer, item: item, setItemFormPopup: setItemFormPopup }) + } + + return ( +
+
+ {item.name} +
+
+ {item.api && +
+ + +
} +
+
+ ) +} diff --git a/src/Components/Map/Subcomponents/StartEndView.tsx b/src/Components/Map/Subcomponents/StartEndView.tsx new file mode 100644 index 00000000..f798cb67 --- /dev/null +++ b/src/Components/Map/Subcomponents/StartEndView.tsx @@ -0,0 +1,26 @@ +import * as React from 'react' +import { Item } from '../../../types' + +const StartEndView = ({item} : {item:Item}) => { + return ( +
+
+ + + + {new Date(item.start!).toISOString().substring(0, 10) || ""} +
+
+ - +
+
+ + + + {new Date(item.end!).toISOString().substring(0, 10) || ""} +
+
+ ) +} + +export default StartEndView \ No newline at end of file diff --git a/src/Components/Map/Subcomponents/TextView.tsx b/src/Components/Map/Subcomponents/TextView.tsx new file mode 100644 index 00000000..67529477 --- /dev/null +++ b/src/Components/Map/Subcomponents/TextView.tsx @@ -0,0 +1,14 @@ +import * as React from 'react' +import { Item } from '../../../types' +import { useTags } from '../hooks/useTags'; +import { replaceURLs } from '../../../Utils/ReplaceURLs'; +import { heighlightTags } from '../../../Utils/HeighlightTags'; + +export const TextView = ({item} : {item: Item}) => { + const all_tags = useTags(); + + return ( +

+ + ) +} diff --git a/src/index.tsx b/src/index.tsx index d100aae7..aee240ca 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -10,6 +10,5 @@ import "./index.css" declare global { interface Window { my_modal_3: any; - sign_up_modal: any; } } \ No newline at end of file