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

add basic notifications through react-alert #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
52 changes: 33 additions & 19 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<WalletProvider>
<div className="container">
<BrowserRouter>
<Navigation/>
<div>
<Switch>
{Object.values(pages).map(({ RootComponent, rootPath }) => (
<Route
key={rootPath}
path={rootPath}
exact
render={props => <RootComponent {...props} />}
/>
))}
</Switch>
</div>
</BrowserRouter>
</div>
</WalletProvider>
<AlertProvider template={AlertTemplate} {...options}>
<WalletProvider>
<div className="container">
<BrowserRouter>
<Navigation/>
<div>
<Switch>
{Object.values(pages).map(({ RootComponent, rootPath }) => (
<Route
key={rootPath}
path={rootPath}
exact
render={props => <RootComponent {...props} />}
/>
))}
</Switch>
</div>
</BrowserRouter>
</div>
</WalletProvider>
</AlertProvider>
);
};

Expand Down
6 changes: 5 additions & 1 deletion src/pages/voting/components/IssuesTable.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -77,7 +79,9 @@ const IssuesTable = ({ onSelectIssue, selectedIssue }) => {
<td>holding</td>

<td>
<button>
<button onClick={() => {
alert.info("This is not implemented yet");
}}>
Support
</button>
</td>
Expand Down