Skip to content

Commit 730377c

Browse files
authored
Merge pull request #16 from CodeDead/release/2.0.1.0
Release/2.0.1.0
2 parents 98aba8f + 549eb27 commit 730377c

File tree

32 files changed

+1657
-1133
lines changed

32 files changed

+1657
-1133
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
![DeadHash](https://codedead.com/wp-content/uploads/2019/12/deadhash.png)
1+
![DeadHash](https://codedead.com/wp-content/uploads/2020/01/deadhash-dark.png)
22

33
# DeadHash
4-
DeadHash is a freeware utility to calculate file and text hashes. The following hash calculations are supported:
4+
DeadHash is a free and open-source utility to calculate file and text hashes. The following hash calculations are supported:
55
* MD5
66
* SHA1
77
* SHA224
@@ -11,7 +11,7 @@ DeadHash is a freeware utility to calculate file and text hashes. The following
1111
* SHA512
1212
* RIPEMD160
1313

14-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and [Electron](https://electronjs.org/).
14+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and built using [Electron](https://electronjs.org/).
1515

1616
## Learn More
1717
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "deadhash",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Hash calculator",
55
"homepage": "./",
66
"private": true,
@@ -35,9 +35,9 @@
3535
},
3636
"main": "public/electron.js",
3737
"dependencies": {
38-
"@material-ui/core": "^4.8.2",
38+
"@material-ui/core": "^4.9.0",
3939
"@material-ui/icons": "^4.5.1",
40-
"axios": "^0.19.0",
40+
"axios": "^0.19.2",
4141
"cross-env": "^6.0.3",
4242
"crypto-js": "^3.1.9-1",
4343
"electron-is-dev": "^1.1.0",
@@ -78,8 +78,8 @@
7878
},
7979
"devDependencies": {
8080
"concurrently": "^5.0.2",
81-
"electron": "^7.1.7",
82-
"electron-builder": "^21.2.0",
83-
"wait-on": "^3.3.0"
81+
"electron": "^7.1.10",
82+
"electron-builder": "^22.2.0",
83+
"wait-on": "^4.0.0"
8484
}
8585
}

src/components/AlertDialog/index.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React, {useState} from "react";
2+
import DialogTitle from "@material-ui/core/DialogTitle";
3+
import DialogContent from "@material-ui/core/DialogContent";
4+
import DialogContentText from "@material-ui/core/DialogContentText";
5+
import DialogActions from "@material-ui/core/DialogActions";
6+
import Button from "@material-ui/core/Button";
7+
import Dialog from "@material-ui/core/Dialog";
8+
import {useSelector} from "react-redux";
9+
10+
const AlertDialog = ({title, content}) => {
11+
12+
const language = useSelector(state => state.MainReducer.languages[state.MainReducer.languageIndex]);
13+
const [open, setOpen] = useState(true);
14+
15+
/**
16+
* Close the AlertDialog instance
17+
*/
18+
const handleClose = () => {
19+
setOpen(false);
20+
};
21+
22+
return (
23+
<Dialog
24+
open={open}
25+
onClose={handleClose}
26+
aria-labelledby="alert-dialog-title"
27+
aria-describedby="alert-dialog-description"
28+
>
29+
<DialogTitle id="alert-dialog-title">{title}</DialogTitle>
30+
<DialogContent>
31+
<DialogContentText id="alert-dialog-description">
32+
{content}
33+
</DialogContentText>
34+
</DialogContent>
35+
<DialogActions>
36+
<Button onClick={handleClose} color="primary" autoFocus>
37+
{language.ok}
38+
</Button>
39+
</DialogActions>
40+
</Dialog>
41+
);
42+
};
43+
44+
export default AlertDialog;

src/components/AlertModal/index.js

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/components/App/index.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,35 @@ import Topbar from "../Topbar";
99
import About from "../../routes/About";
1010
import File from "../../routes/File";
1111
import Text from "../../routes/Text";
12+
import Drawerbar from "../Drawerbar";
13+
import {CssBaseline} from "@material-ui/core";
14+
import DropZone from "../DropZone";
1215

1316
function App() {
1417

15-
const themeIndex = useSelector(state => state.MainReducer.themeIndex);
18+
let themeIndex = useSelector(state => state.MainReducer.themeIndex);
19+
20+
let themeType = "light";
21+
if (themeIndex === 8) {
22+
themeType = "dark";
23+
themeIndex = 2;
24+
}
1625
const color = ThemeSelector(themeIndex);
1726

1827
const theme = createMuiTheme({
1928
palette: {
2029
primary: color,
30+
type: themeType
2131
}
2232
});
2333

2434
return (
2535
<ThemeProvider theme={theme}>
2636
<BrowserRouter>
27-
<div className="App">
37+
<DropZone>
2838
<Topbar/>
39+
<Drawerbar/>
40+
<CssBaseline/>
2941
<Switch>
3042
<Route path={"/settings"}>
3143
<Settings/>
@@ -43,7 +55,7 @@ function App() {
4355
<Home/>
4456
</Route>
4557
</Switch>
46-
</div>
58+
</DropZone>
4759
</BrowserRouter>
4860
</ThemeProvider>
4961
);

src/components/CryptographyMenu/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ const CryptographyMenu = ({handleIndexChange, selectedIndex}) => {
3434
<ListItem button selected={selectedIndex === 0}>
3535
<ListItemIcon onClick={() => handleIndexChange(0)}><KeyIcon/></ListItemIcon>
3636
<ListItemText onClick={() => handleIndexChange(0)} primary={language.cryptography}/>
37-
{openCollapse ? <ExpandLessIcon onClick={handleOpenMenu}/> :
38-
<ExpandMoreIcon onClick={handleOpenMenu}/>}
37+
{openCollapse ? <ExpandLessIcon color="inherit" onClick={handleOpenMenu}/> :
38+
<ExpandMoreIcon color="inherit" onClick={handleOpenMenu}/>}
3939
</ListItem>
4040
<Collapse in={openCollapse} timeout="auto" unmountOnExit>
4141
<List component="div" disablePadding>

src/components/CsvExport/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from "react";
2+
3+
const CsvExport = ({children, data, fileName}) => {
4+
5+
let href = null;
6+
if (data) {
7+
let csvContent = "";
8+
data.forEach(element => {
9+
csvContent += element.type + "," + element.hash + "\n";
10+
});
11+
12+
const blob = new Blob([csvContent], {type: 'text/csv;charset=utf-8;'});
13+
href = URL.createObjectURL(blob);
14+
}
15+
16+
return (
17+
data ? (
18+
<a href={href} download={fileName} target={"_self"}
19+
style={{textDecoration: "none"}}>
20+
{children}
21+
</a>
22+
) : {children}
23+
);
24+
};
25+
26+
export default CsvExport;

src/components/Drawerbar/index.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import {useSelector, useDispatch} from "react-redux";
1313
import InfoIcon from '@material-ui/icons/Info';
1414
import BuildIcon from "@material-ui/icons/Build";
1515
import HelpIcon from "@material-ui/icons/Help";
16+
import CloseIcon from "@material-ui/icons/Close";
1617
import {useHistory} from "react-router-dom";
1718
import CryptographyMenu from "../CryptographyMenu";
1819

19-
const drawerWidth = 220;
20+
const drawerWidth = 240;
2021
const useStyles = makeStyles(theme => ({
2122
drawer: {
2223
width: drawerWidth,
@@ -34,6 +35,8 @@ const useStyles = makeStyles(theme => ({
3435
}
3536
}));
3637

38+
const remote = window.require('electron').remote;
39+
3740
const Drawerbar = () => {
3841

3942
const language = useSelector(state => state.MainReducer.languages[state.MainReducer.languageIndex]);
@@ -108,7 +111,7 @@ const Drawerbar = () => {
108111

109112
<List>
110113
<ListItem onClick={() => handleIndexChange(3)} selected={selectedItem === 3} button>
111-
<ListItemIcon><BuildIcon/></ListItemIcon>
114+
<ListItemIcon><BuildIcon color="inherit"/></ListItemIcon>
112115
<ListItemText primary={language.settings}/>
113116
</ListItem>
114117
</List>
@@ -117,15 +120,25 @@ const Drawerbar = () => {
117120

118121
<List>
119122
<ListItem onClick={() => handleIndexChange(4)} button>
120-
<ListItemIcon><HelpIcon/></ListItemIcon>
123+
<ListItemIcon><HelpIcon color="inherit" /></ListItemIcon>
121124
<ListItemText primary={language.help}/>
122125
</ListItem>
123126

124127
<ListItem onClick={() => handleIndexChange(5)} selected={selectedItem === 5} button>
125-
<ListItemIcon><InfoIcon/></ListItemIcon>
128+
<ListItemIcon><InfoIcon color="inherit"/></ListItemIcon>
126129
<ListItemText primary={language.about}/>
127130
</ListItem>
128131
</List>
132+
133+
<Divider />
134+
135+
<List>
136+
<ListItem onClick={() => remote.getGlobal("mainWindow").close()} button>
137+
<ListItemIcon><CloseIcon color="inherit" /></ListItemIcon>
138+
<ListItemText primary={language.exit} />
139+
</ListItem>
140+
</List>
141+
129142
</Drawer>
130143
);
131144
};

src/components/DropZone/index.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from "react";
2+
import {useHistory} from "react-router-dom";
3+
import {useDispatch, useSelector} from "react-redux";
4+
5+
const DropZone = ({children}) => {
6+
7+
const history = useHistory();
8+
const enabled = useSelector(state => state.MainReducer.canDragDrop);
9+
const dispatch = useDispatch();
10+
11+
/**
12+
* Event that is fired when one or more files are dropped
13+
* @param event The event that contains the drop details
14+
*/
15+
const onDrop = (event) => {
16+
event.preventDefault();
17+
if (!enabled) return;
18+
19+
dispatch({type: 'SET_CURRENT_FILE', payload: event.dataTransfer.files[0]});
20+
history.push("/file");
21+
};
22+
23+
/**
24+
* Event that is fired when a drag over event is detected
25+
* @param event The event that contains the drag over details
26+
*/
27+
const onDragOver = (event) => {
28+
event.preventDefault();
29+
};
30+
31+
return (
32+
<div
33+
onDragOver={onDragOver}
34+
onDrop={onDrop}>
35+
{children}
36+
</div>
37+
);
38+
39+
};
40+
41+
export default DropZone;

0 commit comments

Comments
 (0)