Skip to content

Commit

Permalink
Merge pull request #22 from CodeDead/release/2.0.3
Browse files Browse the repository at this point in the history
Release/2.0.3
  • Loading branch information
CodeDead committed Jun 7, 2020
2 parents 7da30b5 + c429655 commit 17bef42
Show file tree
Hide file tree
Showing 33 changed files with 1,915 additions and 1,580 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ yarn-error.log*

.idea
.idea/*
dist/*
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
![DeadHash](https://codedead.com/wp-content/uploads/2020/01/deadhash-dark.png)
![DeadHash](https://codedead.com/wp-content/uploads/2020/06/DeadHash.png)

# DeadHash

DeadHash is a free and open-source utility to calculate file and text hashes. The following hash calculations are supported:
* MD5
* SHA1
Expand All @@ -14,13 +15,15 @@ DeadHash is a free and open-source utility to calculate file and text hashes. Th
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and built using [Electron](https://electronjs.org/).

## Learn More

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

To learn React, check out the [React documentation](https://reactjs.org/).

To learn Electron, check out the [Electron documentation](https://electronjs.org/).

## About

This library is maintained by CodeDead. You can find more about us using the following links:
* [Website](https://codedead.com)
* [Twitter](https://twitter.com/C0DEDEAD)
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deadhash",
"version": "2.0.2",
"version": "2.0.3",
"description": "File and text hash calculator",
"homepage": "./",
"private": true,
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"main": "public/electron.js",
"dependencies": {
"@material-ui/core": "^4.9.9",
"@material-ui/core": "^4.10.1",
"@material-ui/icons": "^4.9.1",
"axios": "^0.19.2",
"cross-env": "^7.0.2",
Expand All @@ -45,8 +45,8 @@
"react-contexify": "^4.1.1",
"react-dom": "^16.13.1",
"react-redux": "^7.2.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"redux": "^4.0.5",
"redux-actions": "^2.6.5"
Expand Down Expand Up @@ -77,9 +77,9 @@
]
},
"devDependencies": {
"concurrently": "^5.1.0",
"electron": "^8.2.0",
"electron-builder": "^22.4.1",
"wait-on": "^4.0.1"
"concurrently": "^5.2.0",
"electron": "^9.0.2",
"electron-builder": "^22.7.0",
"wait-on": "^5.0.1"
}
}
40 changes: 33 additions & 7 deletions public/electron.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const electron = require("electron");
const app = electron.app;
const ipcMain = electron.ipcMain;
const BrowserWindow = electron.BrowserWindow;
const path = require("path");
const isDev = require("electron-is-dev");
Expand All @@ -12,8 +13,8 @@ const createWindow = () => {
},
frame: false,
title: "DeadHash",
width: 980,
height: 550,
width: 960,
height: 520,
icon: path.join(__dirname, '../build/Icon-512x512.png')
});

Expand All @@ -23,9 +24,6 @@ const createWindow = () => {
electron.Menu.setApplicationMenu(null);
}

// noinspection JSUndefinedPropertyAssignment
global.mainWindow = mainWindow;

mainWindow.removeMenu();
mainWindow.loadURL(isDev ? "http://localhost:3000" : `file://${path.join(__dirname, "../build/index.html")}`);
mainWindow.on("closed", () => (mainWindow = null));
Expand All @@ -34,9 +32,17 @@ const createWindow = () => {
event.preventDefault();
electron.shell.openExternal(arg);
});

mainWindow.on("maximize", () => {
mainWindow.webContents.send("window-maximized");
});

mainWindow.on("unmaximize", () => {
mainWindow.webContents.send("window-unmaximized");
})
};

app.on("ready", createWindow);
app.whenReady().then(createWindow);

app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
Expand All @@ -45,7 +51,27 @@ app.on("window-all-closed", () => {
});

app.on("activate", () => {
if (mainWindow === null) {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});

ipcMain.on("handle-close", () => {
mainWindow.close();
});

ipcMain.on("handle-maximize", () => {
if (!mainWindow.isMaximized()) {
mainWindow.maximize();
} else {
mainWindow.unmaximize();
}
});

ipcMain.on("handle-minimize", () => {
mainWindow.minimize();
});

ipcMain.on("get-version", (e) => {
e.reply('get-version-reply', app.getVersion());
});
6 changes: 2 additions & 4 deletions src/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import Topbar from "../Topbar";
import About from "../../routes/About";
import File from "../../routes/File";
import Text from "../../routes/Text";
import Drawerbar from "../Drawerbar";
import {CssBaseline} from "@material-ui/core";
import DropZone from "../DropZone";

function App() {
const App = () => {

let themeIndex = useSelector(state => state.MainReducer.themeIndex);

Expand All @@ -36,7 +35,6 @@ function App() {
<BrowserRouter>
<DropZone>
<Topbar/>
<Drawerbar/>
<CssBaseline/>
<Switch>
<Route path={"/settings"}>
Expand All @@ -59,6 +57,6 @@ function App() {
</BrowserRouter>
</ThemeProvider>
);
}
};

export default App;
2 changes: 1 addition & 1 deletion src/components/BackButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const BackButton = () => {

return (
<Button color={"primary"} onClick={() => history.goBack()}>
<ArrowLeftIcon />
<ArrowLeftIcon/>
</Button>
);
};
Expand Down
62 changes: 62 additions & 0 deletions src/components/ConfirmationDialog/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from "react";
import {useSelector} from "react-redux";
import Dialog from "@material-ui/core/Dialog";
import DialogTitle from "@material-ui/core/DialogTitle";
import DialogContent from "@material-ui/core/DialogContent";
import DialogContentText from "@material-ui/core/DialogContentText";
import DialogActions from "@material-ui/core/DialogActions";
import Button from "@material-ui/core/Button";

const ConfirmationDialog = ({open, title, content, onAccept, onCancel, onClose}) => {

const language = useSelector(state => state.MainReducer.languages[state.MainReducer.languageIndex]);

/**
* Close the AlertDialog instance
*/
const handleClose = () => {
if (onClose) onClose();
};

/**
* Accept the confirmation
*/
const accept = () => {
if (onAccept) onAccept();
handleClose();
}

/**
* Cancel the confirmation
*/
const cancel = () => {
if (onCancel) onCancel();
handleClose();
}

return (
<Dialog
open={open}
onClose={handleClose}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">{title}</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
{content}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={cancel} color="primary">
{language.no}
</Button>
<Button onClick={accept} color="primary" autoFocus>
{language.yes}
</Button>
</DialogActions>
</Dialog>
);
}

export default ConfirmationDialog;
2 changes: 1 addition & 1 deletion src/components/CryptographyMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import KeyIcon from "@material-ui/icons/VpnKey";
const useStyles = makeStyles(theme => ({
nested: {
paddingLeft: theme.spacing(4),
},
}
}));

const CryptographyMenu = ({handleIndexChange, selectedIndex}) => {
Expand Down
10 changes: 5 additions & 5 deletions src/components/CsvExport/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const CsvExport = ({children, data, fileName}) => {

return (
data ? (
<a href={href} download={fileName} target={"_self"}
style={{textDecoration: "none"}}>
{children}
</a>
) : {children}
<a href={href} download={fileName} target={"_self"}
style={{textDecoration: "none"}}>
{children}
</a>
) : {children}
);
};

Expand Down
15 changes: 6 additions & 9 deletions src/components/Drawerbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import {useSelector, useDispatch} from "react-redux";
import {useSelector} from "react-redux";
import InfoIcon from '@material-ui/icons/Info';
import BuildIcon from "@material-ui/icons/Build";
import HelpIcon from "@material-ui/icons/Help";
Expand All @@ -35,33 +35,31 @@ const useStyles = makeStyles(theme => ({
}
}));

const remote = window.require('electron').remote;
const ipcRenderer = window.require('electron').ipcRenderer;

const Drawerbar = () => {
const Drawerbar = ({open, onClose}) => {

const language = useSelector(state => state.MainReducer.languages[state.MainReducer.languageIndex]);
const open = useSelector(state => state.MainReducer.drawerOpen);
const selectedItem = useSelector(state => state.MainReducer.selectedListItem);

const history = useHistory();

const classes = useStyles();
const theme = useTheme();
const dispatch = useDispatch();

/**
* Function that is called when the drawer should close
*/
const handleDrawerClose = () => {
dispatch({type: "SET_DRAWEROPEN", drawerOpen: false});
onClose();
};

/**
* Handle a page change
* @param index The index of the page
*/
const handleIndexChange = (index) => {
dispatch({type: "SET_DRAWEROPEN", drawerOpen: false});
onClose();
if (selectedItem === index) return;

switch (index) {
Expand Down Expand Up @@ -133,12 +131,11 @@ const Drawerbar = () => {
<Divider/>

<List>
<ListItem onClick={() => remote.getGlobal("mainWindow").close()} button>
<ListItem onClick={() => ipcRenderer.send('handle-close')} button>
<ListItemIcon><CloseIcon color="inherit"/></ListItemIcon>
<ListItemText primary={language.exit}/>
</ListItem>
</List>

</Drawer>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/components/DropZone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const DropZone = ({children}) => {
{children}
</div>
);

};

export default DropZone;
1 change: 1 addition & 0 deletions src/components/Loadingbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import CircularProgress from "@material-ui/core/CircularProgress";

const Loadingbar = () => {

return (
<div style={{display: 'flex', justifyContent: 'center'}}>
<CircularProgress/>
Expand Down
14 changes: 3 additions & 11 deletions src/components/Theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,24 @@ import React from "react";
import {makeStyles} from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardActionArea from '@material-ui/core/CardActionArea';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';
import blank from "./blank.png";

const useStyles = makeStyles({
media: {
height: 80,
height: 60,
},
});

const Theme = ({title, description, color, selected, actionText, onAction}) => {
const Theme = ({title, description, color, selected, onAction}) => {

const classes = useStyles();
const variant = selected ? "contained" : "text";
const action = onAction ? onAction : null;

return (
<Card>
<Card raised={!selected}>
<CardActionArea onClick={action}>
<CardMedia
className={classes.media}
Expand All @@ -39,11 +36,6 @@ const Theme = ({title, description, color, selected, actionText, onAction}) => {
</Typography>
</CardContent>
</CardActionArea>
<CardActions>
<Button size="small" color="primary" variant={variant} disabled={selected} onClick={action}>
{actionText}
</Button>
</CardActions>
</Card>
)
};
Expand Down
Loading

0 comments on commit 17bef42

Please sign in to comment.