package config

This commit is contained in:
AT 2023-05-22 16:12:58 +02:00
parent 5d14d7d56d
commit 8c9499336f
5 changed files with 14 additions and 13 deletions

View File

@ -1,10 +1,11 @@
{
"name": "utopia-ui",
"version": "1.0.8",
"version": "2.0.1",
"description": "Reuseable React Components to build mapping apps for all kinds of communities ",
"repository": "https://github.com/utopia-os/utopia-ui",
"homepage:": "https://utopia.os/",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "rollup -c",
"start": "rollup -c -w"

View File

@ -18,5 +18,5 @@ export default {
}),
typescript()
],
external: ['react', 'react-dom', 'leaflet', 'react-leaflet', 'react-leaflet-cluster', 'leaflet/dist/leaflet.css', '@heroicons/react/20/solid']
external: ['react', 'react-dom', 'leaflet', 'react-leaflet', 'react-toastify' , 'react-toastify/dist/ReactToastify.css', 'tw-elements' ,'react-router-dom', 'react-leaflet-cluster', 'leaflet/dist/leaflet.css', '@heroicons/react/20/solid']
}

View File

@ -1,6 +1,6 @@
import * as React from 'react'
import { Marker } from 'react-leaflet'
import { Item, Tag, Layer as LayerProps } from '../../types'
import { Item, Tag, LayerProps } from '../../types'
import MarkerIconFactory from '../../Utils/MarkerIconFactory'
import { Popup } from './Subcomponents/Popup'
import { useTags } from './hooks/useTags'

View File

@ -1,7 +1,7 @@
import { TileLayer, MapContainer, useMapEvents } from "react-leaflet";
import "leaflet/dist/leaflet.css";
import * as React from "react";
import { Item, Tag, ItemsApi, Layer, UtopiaMap as UtopiaMapProps } from "../../types"
import { Item, Tag, ItemsApi, LayerProps, UtopiaMapProps } from "../../types"
import "./UtopiaMap.css"
import { LatLng } from "leaflet";
import MarkerClusterGroup from 'react-leaflet-cluster'
@ -14,7 +14,7 @@ import { LayersProvider } from "./hooks/useLayers";
export interface MapEventListenerProps {
selectMode: Layer | null,
selectMode: LayerProps | null,
setSelectMode: React.Dispatch<any>,
setNewItemPopup: React.Dispatch<React.SetStateAction<any>>
}
@ -42,7 +42,7 @@ function UtopiaMap({
children }
: UtopiaMapProps) {
const [selectMode, setSelectMode] = useState<Layer | null>(null);
const [selectMode, setSelectMode] = useState<LayerProps | null>(null);
const [newItemPopup, setNewItemPopup] = useState<NewItemPopupProps | null>(null);

View File

@ -1,7 +1,7 @@
import { LatLng } from "leaflet";
import { NewItemPopupProps } from "./Components/Map/Subcomponents/NewItemPopup";
export interface UtopiaMap {
export interface UtopiaMapProps {
height?: string,
width?: string,
center?: LatLng,
@ -10,7 +10,7 @@ export interface UtopiaMap {
children?: React.ReactNode,
}
export interface Layer {
export interface LayerProps<T> {
data?: Item[],
children?: React.ReactNode
name: string,
@ -21,7 +21,7 @@ export interface Layer {
markerShape: string,
markerDefaultColor: string,
tags?: Tag[],
api?: ItemsApi,
api?: ItemsApi<T>,
setNewItemPopup?: React.Dispatch<React.SetStateAction<NewItemPopupProps | null>>
}
@ -36,7 +36,7 @@ export class Item {
start?: string;
end?: string;
tags?: number[];
constructor(id:string|number,name:string,text:string,position:Geometry, layer: Layer){
constructor(id:string|number,name:string,text:string,position:Geometry, layer: LayerProps){
this.id = id;
this.name = name;
this.text = text;
@ -60,9 +60,9 @@ export interface Tag {
name: string;
}
export interface ItemsApi {
export interface ItemsApi<T> {
getItems(): Promise<void>,
addItem(item : Item): Promise<void>,
updateItem(item : Item): Promise<void>,
addItem(item : T): Promise<void>,
updateItem(item : T): Promise<void>,
deleteItem(id : number): Promise<void>,
}