Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved entirely to react-toastify #174

Merged
merged 3 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
47 changes: 23 additions & 24 deletions src/Controls/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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',
})
}
}
Expand Down Expand Up @@ -269,7 +269,6 @@ class MainControl extends React.Component {
: '0000-00-00, 00:00'}
</div>
</Drawer>
<SemanticToastContainer position="bottom-center" maxToasts={1} />
</>
)
}
Expand Down
17 changes: 14 additions & 3 deletions src/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1037,6 +1035,19 @@ class Map extends React.Component {
return (
<React.Fragment>
<div>
<ToastContainer
position="bottom-center"
autoClose={5000}
limit={1}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="light"
/>
<div id="map" className="map-style" />
<button
className="ui primary button"
Expand Down
2 changes: 1 addition & 1 deletion src/index.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '~semantic-ui-css/semantic.css';
@import '~leaflet/dist/leaflet.css';
@import '~tachyons/css/tachyons.css';
@import '~react-semantic-toasts/styles/react-semantic-alert.css';
@import '~react-toastify/dist/ReactToastify.css';
@import '~leaflet-extra-markers/dist/css/leaflet.extra-markers.min.css';

body {
Expand Down