diff --git a/package-lock.json b/package-lock.json index ec0770bd..8511a23c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "utopia-ui", - "version": "1.0.8", + "version": "2.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "utopia-ui", - "version": "1.0.8", + "version": "2.0.6", "license": "MIT", "dependencies": { "@heroicons/react": "^2.0.17", @@ -354,9 +354,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -480,9 +480,9 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -4170,9 +4170,9 @@ } }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -4750,9 +4750,9 @@ } }, "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", + "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==", "dev": true, "engines": { "node": ">=0.10.0" diff --git a/package.json b/package.json index c8fd04c9..b7139114 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "utopia-ui", - "version": "2.0.5", - "description": "Reuseable React Components to build mapping apps for all kinds of communities ", + "version": "2.0.6", + "description": "Reuseable React Components to build mapping apps for real life communities and networks", "repository": "https://github.com/utopia-os/utopia-ui", - "homepage:": "https://utopia.os/", + "homepage:": "https://utopia-os.org/", "module": "dist/index.js", "types": "dist/index.d.ts", "scripts": { diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index 5107e53d..6bcf1d05 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -2,7 +2,7 @@ import * as React from 'react' import { Marker } from 'react-leaflet' import { Item, Tag, LayerProps } from '../../types' import MarkerIconFactory from '../../Utils/MarkerIconFactory' -import { Popup } from './Subcomponents/Popup' +import { ItemViewPopup } from './Subcomponents/ItemViewPopup' import { useTags } from './hooks/useTags' import { useAddItem, useItems, useResetItems } from './hooks/useItems' import { useEffect } from 'react' @@ -55,7 +55,7 @@ export const Layer = (props: LayerProps) => { } return ( - + ); }) diff --git a/src/Components/Map/Subcomponents/NewItemPopup.tsx b/src/Components/Map/Subcomponents/ItemFormPopup.tsx similarity index 91% rename from src/Components/Map/Subcomponents/NewItemPopup.tsx rename to src/Components/Map/Subcomponents/ItemFormPopup.tsx index b3a7e79d..0a0cfbd4 100644 --- a/src/Components/Map/Subcomponents/NewItemPopup.tsx +++ b/src/Components/Map/Subcomponents/ItemFormPopup.tsx @@ -5,14 +5,14 @@ import { useEffect, useState } from 'react' import { useAddItem, useUpdateItem } from '../hooks/useItems' import { Geometry, LayerProps, Item} from '../../../types' -export interface NewItemPopupProps { +export interface ItemFormPopupProps { position: LatLng, layer: LayerProps, item?: Item, - setNewItemPopup: React.Dispatch> + setItemFormPopup: React.Dispatch> } -export default function NewItemPopup(props: NewItemPopupProps) { +export default function ItemFormPopup(props: ItemFormPopupProps) { const [name, setName] = useState('') const [text, setText] = useState('') @@ -29,7 +29,7 @@ export default function NewItemPopup(props: NewItemPopupProps) { else { addItem(new Item(crypto.randomUUID(), name, text, new Geometry(props.position.lng, props.position.lat), props.layer))} map.closePopup(); - props.setNewItemPopup(null); + props.setItemFormPopup(null); } const resetPopup = () => { diff --git a/src/Components/Map/Subcomponents/Popup.tsx b/src/Components/Map/Subcomponents/ItemViewPopup.tsx similarity index 90% rename from src/Components/Map/Subcomponents/Popup.tsx rename to src/Components/Map/Subcomponents/ItemViewPopup.tsx index 1a4d782f..d900f042 100644 --- a/src/Components/Map/Subcomponents/Popup.tsx +++ b/src/Components/Map/Subcomponents/ItemViewPopup.tsx @@ -4,16 +4,16 @@ import { Popup as LeafletPopup, useMap } from 'react-leaflet' import { Item, Tag } from '../../../types' import { replaceURLs } from '../../../Utils/ReplaceURLs' import { useRemoveItem } from '../hooks/useItems' -import { NewItemPopupProps } from './NewItemPopup' +import { ItemFormPopupProps } from './ItemFormPopup' -export interface UtopiaPopupProps { +export interface ItemViewPopupProps { item: Item, tags: Tag[], - setNewItemPopup?: React.Dispatch> + setItemFormPopup?: React.Dispatch> } -const Popup = (props: UtopiaPopupProps) => { +const ItemViewPopup = (props: ItemViewPopupProps) => { const item: Item = props.item; const tags: Tag[] = props.tags; const removeItem = useRemoveItem(); @@ -28,8 +28,8 @@ const Popup = (props: UtopiaPopupProps) => { const openEditPopup = (event: React.MouseEvent) => { event.stopPropagation(); map.closePopup(); - if (props.setNewItemPopup) - props.setNewItemPopup({ position: new LatLng(item.position.coordinates[1], item.position.coordinates[0]), layer: item.layer, item: item, setNewItemPopup: props.setNewItemPopup }) + if (props.setItemFormPopup) + props.setItemFormPopup({ position: new LatLng(item.position.coordinates[1], item.position.coordinates[0]), layer: item.layer, item: item, setItemFormPopup: props.setItemFormPopup }) } return ( @@ -101,6 +101,6 @@ const Popup = (props: UtopiaPopupProps) => { ) } -export { Popup }; +export { ItemViewPopup }; diff --git a/src/Components/Map/UtopiaMap.tsx b/src/Components/Map/UtopiaMap.tsx index adf231b9..e5873556 100644 --- a/src/Components/Map/UtopiaMap.tsx +++ b/src/Components/Map/UtopiaMap.tsx @@ -7,7 +7,7 @@ import { LatLng } from "leaflet"; import MarkerClusterGroup from 'react-leaflet-cluster' import AddButton from "./Subcomponents/AddButton"; import { useState } from "react"; -import NewItemPopup, { NewItemPopupProps } from "./Subcomponents/NewItemPopup"; +import ItemFormPopup, { ItemFormPopupProps } from "./Subcomponents/ItemFormPopup"; import { ItemsProvider } from "./hooks/useItems"; import { TagsProvider } from "./hooks/useTags"; import { LayersProvider } from "./hooks/useLayers"; @@ -16,7 +16,7 @@ import { LayersProvider } from "./hooks/useLayers"; export interface MapEventListenerProps { selectMode: LayerProps | null, setSelectMode: React.Dispatch, - setNewItemPopup: React.Dispatch> + setItemFormPopup: React.Dispatch> } function MapEventListener(props: MapEventListenerProps) { @@ -25,7 +25,7 @@ function MapEventListener(props: MapEventListenerProps) { console.log(e.latlng.lat + ',' + e.latlng.lng); if (props.selectMode != null) { - props.setNewItemPopup({ layer: props.selectMode, position: e.latlng }) + props.setItemFormPopup({ layer: props.selectMode, position: e.latlng }) props.setSelectMode(null) } } @@ -43,7 +43,7 @@ function UtopiaMap({ : UtopiaMapProps) { const [selectMode, setSelectMode] = useState(null); - const [newItemPopup, setNewItemPopup] = useState(null); + const [newItemPopup, setItemFormPopup] = useState(null); @@ -59,13 +59,13 @@ function UtopiaMap({ { React.Children.toArray(children).map((child) => - React.isValidElement<{ setNewItemPopup: React.Dispatch> }>(child) ? React.cloneElement(child, { setNewItemPopup: setNewItemPopup }) : child + React.isValidElement<{ setItemFormPopup: React.Dispatch> }>(child) ? React.cloneElement(child, { setItemFormPopup: setItemFormPopup }) : child ) } - + {newItemPopup && - + } diff --git a/src/types.ts b/src/types.ts index f68ab4fa..ddf17614 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,5 @@ import { LatLng } from "leaflet"; -import { NewItemPopupProps } from "./Components/Map/Subcomponents/NewItemPopup"; +import { ItemFormPopupProps } from "./Components/Map/Subcomponents/ItemFormPopup"; export interface UtopiaMapProps { height?: string, @@ -22,7 +22,7 @@ export interface LayerProps { markerDefaultColor: string, tags?: Tag[], api?: ItemsApi, - setNewItemPopup?: React.Dispatch> + setItemFormPopup?: React.Dispatch> } export class Item {