diff --git a/package-lock.json b/package-lock.json index 1322a8c..6b9aedf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7219,6 +7219,16 @@ "scheduler": "^0.13.6" } }, + "react-alert": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/react-alert/-/react-alert-5.5.0.tgz", + "integrity": "sha512-PzB6ktBmtNZkmgZVdPp/Wbe/zjIBzqBu9QHLTrfquUVVPCVVfn3lPWOebejEg6VOxGepIPOSAsb1bd3ESMyC0Q==" + }, + "react-alert-template-basic": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/react-alert-template-basic/-/react-alert-template-basic-1.0.0.tgz", + "integrity": "sha512-6x5Us0oc+jj8BDNkvSWfQMESk5SdyGKitXdLb7CwIlIlecyATjCTKSWpLABg8tpKAPOSJu4Dv/fYUqxXEio/XA==" + }, "react-chartjs-2": { "version": "2.7.6", "resolved": "https://registry.npmjs.org/react-chartjs-2/-/react-chartjs-2-2.7.6.tgz", diff --git a/package.json b/package.json index 0598ea5..034970b 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "ethers": "^4.0.27", "rc-slider": "^8.6.11", "react": "^16.8.6", + "react-alert": "^5.5.0", + "react-alert-template-basic": "^1.0.0", "react-chartjs-2": "^2.7.6", "react-dom": "^16.8.6", "react-router-dom": "^5.0.0", diff --git a/src/index.js b/src/index.js index ab7aef7..9be26c3 100644 --- a/src/index.js +++ b/src/index.js @@ -5,29 +5,43 @@ import Navigation from './shared-components/Navigation'; import pages from './pages/index'; import { BrowserRouter, Route, Switch } from 'react-router-dom'; import WalletProvider from './context/Wallet'; +import AlertTemplate from 'react-alert-template-basic'; +import { transitions, positions, Provider as AlertProvider } from 'react-alert'; +// optional cofiguration +const options = { + // you can also just use 'bottom center' + position: positions.TOP_RIGHT, + timeout: 5000, + offset: '30px', + // you can also just use 'scale' + transition: transitions.SCALE +}; + const Index = () => { return ( - -
- - -
- - {Object.values(pages).map(({ RootComponent, rootPath }) => ( - } - /> - ))} - -
-
-
-
+ + +
+ + +
+ + {Object.values(pages).map(({ RootComponent, rootPath }) => ( + } + /> + ))} + +
+
+
+
+
); }; diff --git a/src/pages/voting/components/IssuesTable.js b/src/pages/voting/components/IssuesTable.js index a0af63c..931359e 100644 --- a/src/pages/voting/components/IssuesTable.js +++ b/src/pages/voting/components/IssuesTable.js @@ -1,8 +1,10 @@ import React, { useEffect, useState } from 'react'; import axios from 'axios'; +import { useAlert } from 'react-alert'; const IssuesTable = ({ onSelectIssue, selectedIssue }) => { const [issues, setIssues] = useState([]); + const alert = useAlert(); useEffect(() => { let isSubscribed = true; @@ -77,7 +79,9 @@ const IssuesTable = ({ onSelectIssue, selectedIssue }) => { holding -