Skip to content

Commit 5b1c180

Browse files
committed
introducing flash
1 parent d14e3ea commit 5b1c180

5 files changed

Lines changed: 44 additions & 8 deletions

File tree

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"react-modal": "^3.13.1",
3232
"react-scripts": "4.0.3",
3333
"react-simple-code-editor": "^0.13.0",
34+
"react-toastify": "^8.0.0",
3435
"react-tooltip": "^4.2.21",
3536
"web-vitals": "^0.2.4",
3637
"workbox-background-sync": "^5.1.3",

src/App.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React, { useEffect, useReducer } from 'react';
2+
import { ToastContainer } from 'react-toastify';
3+
import 'react-toastify/dist/ReactToastify.css';
24
import './App.css';
35
import ReactTooltip from 'react-tooltip';
46
import GraphWorkspace from './GraphWorkspace';
@@ -47,6 +49,7 @@ const app = () => {
4749
</div>
4850
</section>
4951
<ReactTooltip place="bottom" type="dark" effect="solid" />
52+
<ToastContainer position="top-right" autoClose={5000} pauseOnHover={false} />
5053
</div>
5154
);
5255
};

src/graph-builder/graph-core/5-load-save.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { saveAs } from 'file-saver';
2+
import { toast } from 'react-toastify';
23
import localStorageManager from '../local-storage-manager';
34
import graphmlBuilder from '../graphml/builder';
45
import BendingDistanceWeight from '../calculations/bending-dist-weight';
@@ -149,8 +150,7 @@ class GraphLoadSave extends GraphUndoRedo {
149150
const stream = await handle.createWritable();
150151
await stream.write(blob);
151152
await stream.close();
152-
// eslint-disable-next-line no-alert
153-
alert('File saved Successfully');
153+
toast.success('File saved Successfully');
154154
}
155155

156156
saveToFolder() {

src/toolbarActions/toolbarFunctions.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { toast } from 'react-toastify';
12
import { actionType as T } from '../reducer';
23

34
const getGraphFun = (superState) => superState.curGraphInstance;
@@ -88,17 +89,14 @@ async function saveGraphMLFile(state) {
8889
const stream = await graph.fileHandle.createWritable();
8990
await stream.write(getGraphFun(state).saveToFolder());
9091
await stream.close();
91-
// eslint-disable-next-line no-alert
92-
alert('File saved Successfully');
92+
toast.success('File saved Successfully');
9393
} else if (graph.fileHandle === null) {
9494
getGraphFun(state).saveWithoutFileHandle();
9595
} else {
96-
// eslint-disable-next-line no-alert
97-
alert('Switch to Edge/Chrome!');
96+
toast.info('Switch to Edge/Chrome!');
9897
}
9998
} else {
100-
// eslint-disable-next-line no-alert
101-
alert('Switch to Edge/Chrome!');
99+
toast.info('Switch to Edge/Chrome!');
102100
}
103101
}
104102

0 commit comments

Comments
 (0)