mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
welcome notification
This commit is contained in:
parent
986f3fbff5
commit
bd5142edc0
@ -1,6 +1,8 @@
|
||||
import { UtopiaMapProps } from "../../types";
|
||||
import { ContextWrapper } from "../AppShell/ContextWrapper";
|
||||
import { UtopiaMapInner } from "./UtopiaMapInner";
|
||||
import 'react-toastify/dist/ReactToastify.css';
|
||||
|
||||
|
||||
function UtopiaMap(props: UtopiaMapProps) {
|
||||
return (
|
||||
|
||||
@ -6,7 +6,7 @@ import "./UtopiaMap.css";
|
||||
import { LatLng } from "leaflet";
|
||||
import MarkerClusterGroup from 'react-leaflet-cluster';
|
||||
import AddButton from "./Subcomponents/AddButton";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { ItemFormPopupProps } from "./Subcomponents/ItemFormPopup";
|
||||
import { SearchControl } from "./Subcomponents/Controls/SearchControl";
|
||||
import { Control } from "./Subcomponents/Controls/Control";
|
||||
@ -21,6 +21,9 @@ import { useLayers } from "./hooks/useLayers";
|
||||
import { useAddVisibleLayer } from "./hooks/useFilter";
|
||||
import { GratitudeControl } from "./Subcomponents/Controls/GratitudeControl";
|
||||
import { SelectPosition } from "./Subcomponents/SelectPosition";
|
||||
import { toast } from 'react-toastify'
|
||||
import { TextView } from "./Subcomponents/ItemPopupComponents/TextView";
|
||||
|
||||
|
||||
const mapDivRef = React.createRef();
|
||||
|
||||
@ -33,7 +36,8 @@ export function UtopiaMapInner({
|
||||
geo,
|
||||
showFilterControl = false,
|
||||
showGratitudeControl = false,
|
||||
showLayerControl = true
|
||||
showLayerControl = true,
|
||||
infoText
|
||||
}: UtopiaMapProps) {
|
||||
|
||||
// Hooks that rely on contexts, called after ContextWrapper is provided
|
||||
@ -51,6 +55,17 @@ export function UtopiaMapInner({
|
||||
layers.forEach(layer => addVisibleLayer(layer));
|
||||
}, [layers]);
|
||||
|
||||
const init = useRef(false)
|
||||
useEffect(() => {
|
||||
if (!init.current) {
|
||||
infoText && setTimeout(() => {
|
||||
toast(<TextView rawText={infoText}/>, { autoClose: false});
|
||||
}, 4000);
|
||||
init.current=true;
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
function MapEventListener() {
|
||||
useMapEvents({
|
||||
click: (e) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user