diff --git a/package.json b/package.json index d6cd435..620a780 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "react-modern-drawer": "^1.1.2", "react-redux": "^8.0.4", "react-scripts": "^5.0.1", - "react-semantic-toasts": "^0.6.6", + "react-toastify": "^9.1.2", "redux": "^4.2.0", "redux-logger": "^3.0.6", "redux-thunk": "^2.4.2", diff --git a/src/Controls/index.jsx b/src/Controls/index.jsx index 6c27dc8..6c7dcbc 100644 --- a/src/Controls/index.jsx +++ b/src/Controls/index.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import { connect } from 'react-redux' import Drawer from 'react-modern-drawer' import 'react-modern-drawer/dist/index.css' -import { SemanticToastContainer, toast } from 'react-semantic-toasts' +import { toast } from 'react-toastify' import DirectionsControl from './Directions' import IsochronesControl from './Isochrones' import DirectionOutputControl from './Directions/OutputControl' @@ -52,24 +52,21 @@ class MainControl extends React.Component { componentDidMount = () => { const { dispatch } = this.props - // toast({ - // type: 'warning', - // icon: 'desktop', - // title: 'Expected Downtime', - // description: - // 'Due to server maintenance, Valhalla is offline until the evening of January 10th.', - // time: 5000 - // }) - this.getLastUpdate() - toast({ - type: 'success', - icon: 'heart', - title: 'Welcome to Valhalla!', - description: 'Global Routing Service - funded by FOSSGIS e.V.', - time: 5000, - }) + toast.success( + 'Welcome to Valhalla! Global Routing Service - funded by FOSSGIS e.V.', + { + position: 'bottom-center', + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: 'light', + } + ) const params = Object.fromEntries(new URL(document.location).searchParams) @@ -137,12 +134,15 @@ class MainControl extends React.Component { componentDidUpdate = (prevProps) => { const { message } = this.props if (message.receivedAt > prevProps.message.receivedAt) { - toast({ - type: message.type, - icon: message.icon, - title: message.topic, - description: message.description, - time: 5000, + toast.message.type(message.description, { + position: 'bottom-center', + autoClose: 5000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + theme: 'light', }) } } @@ -269,7 +269,6 @@ class MainControl extends React.Component { : '0000-00-00, 00:00'} - ) } diff --git a/src/Map/Map.jsx b/src/Map/Map.jsx index 78119f4..35d8b5f 100644 --- a/src/Map/Map.jsx +++ b/src/Map/Map.jsx @@ -17,6 +17,7 @@ import axios from 'axios' import * as R from 'ramda' import ExtraMarkers from './extraMarkers' import { Button, Label, Icon, Popup } from 'semantic-ui-react' +import { ToastContainer } from 'react-toastify' import { CopyToClipboard } from 'react-copy-to-clipboard' import { fetchReverseGeocode, @@ -649,12 +650,9 @@ class Map extends React.Component { } excludePolygons.push(lngLatArray) }) - const { dispatch } = this.props - const name = 'exclude_polygons' const value = excludePolygons - dispatch( updateSettings({ name, @@ -1037,6 +1035,19 @@ class Map extends React.Component { return (
+