Skip to content

Commit

Permalink
Update dependencies, minor fixes, update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukszy-dev committed Mar 1, 2021
1 parent bf9ff5c commit aec1f72
Show file tree
Hide file tree
Showing 32 changed files with 9,632 additions and 12,483 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module.exports = {
extends: [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
plugins: ["prettier", "@typescript-eslint"],
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 2020,
sourceType: "module",
ecmaFeatures: {
jsx: true
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
Expand Down
102 changes: 0 additions & 102 deletions .snyk

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Łukasz Szypliński
Copyright (c) 2021 Łukasz Szypliński

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
# Kangaroo [![Build Status](https://api.travis-ci.com/WilsonDev/kangaroo.svg?branch=master)](https://travis-ci.com/WilsonDev/kangaroo) [![Known Vulnerabilities](https://snyk.io/test/github/WilsonDev/kangaroo/badge.svg)](https://snyk.io/test/github/WilsonDev/kangaroo/badge.svg/)
### Snippet manager
# Kangaroo [![Build Status](https://api.travis-ci.com/WilsonDev/kangaroo.svg?branch=master)](https://travis-ci.com/WilsonDev/kangaroo) [![MIT Licensed](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](https://opensource.org/licenses/MIT)

![kangaroo](https://user-images.githubusercontent.com/5923943/79024494-62fe8100-7b83-11ea-9402-27a02005d211.png)
<div align="center">
<br>
<img src="./public/logo.png" alt="logo" width="200">
<br>
<br>
</div>

Simple **snippet** manager

## Available Scripts
<br>

In the project directory, you can run:
## Screenshots

### `npm start`
![kangaroo](https://user-images.githubusercontent.com/5923943/79024494-62fe8100-7b83-11ea-9402-27a02005d211.png)

Runs the app in the development mode.<br>
## Developement

The app will reload if you make edits.<br>
You will also see any lint errors in the console.
### Install dependencies
```bash
$ git clone https://github.com/WilsonDev/kangaroo.git
$ cd kangaroo && npm install
```

### `npm run build`
### Run
```bash
$ npm build && yarn start
```

Builds the app for production to the `dist` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
## Licensing

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!
This code is licensed under the [MIT license](LICENSE.md). Check out the LICENSE file for more information.
38 changes: 28 additions & 10 deletions electron/actions.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
const { Menu, MenuItem, app } = require('electron');
const { GH_AUTH_TOKEN, BACKUP_GIST_ID, LAST_SYNCHRONIZED_GIST_DATE, THEME } = require('./constants');

const initActions = (ipcMain, store) => {
ipcMain.on('LOAD_GH_DATA', (event) => {
const initActions = (ipcMain, window, store) => {
ipcMain.handle('LOAD_GH_DATA', () => {
const token = store.get(GH_AUTH_TOKEN);
const backupGistId = store.get(BACKUP_GIST_ID);
const gistDate = store.get(LAST_SYNCHRONIZED_GIST_DATE);

event.sender.send('LOAD_GH_DATA_REPLY', {
return {
token,
backupGistId,
gistDate,
});
};
});

ipcMain.on('SET_GH_DATA', (_event, data) => {
ipcMain.handle('SET_GH_DATA', (_event, data) => {
const { token, backupGistId, gistDate } = data;

if (token) {
Expand All @@ -29,19 +30,36 @@ const initActions = (ipcMain, store) => {
}
});

ipcMain.on('DELETE_GH_DATA', () => {
ipcMain.handle('DELETE_GH_DATA', () => {
store.delete(GH_AUTH_TOKEN);
store.delete(BACKUP_GIST_ID);
store.delete(LAST_SYNCHRONIZED_GIST_DATE);
});

ipcMain.on('SWITCH_THEME', (_event, theme) => {
ipcMain.handle('SWITCH_THEME', (_event, theme) => {
store.set(THEME, theme);
return theme;
});

ipcMain.on('GET_THEME', (event) => {
const theme = store.get(THEME);
event.sender.send('GET_THEME_REPLY', theme);
ipcMain.handle('GET_THEME', () => {
return store.get(THEME);
});

ipcMain.handle('GET_USER_DATA_PATH', () => {
return app.getPath('userData');
});

const contextMenu = new Menu();
const deleteMenuItem = new MenuItem({
label: 'Delete',
click: () => {
window.webContents.send('DELETE_SNIPPET');
}
});
contextMenu.append(deleteMenuItem);

ipcMain.handle('OPEN_CONTEXT_MENU', (_event) => {
contextMenu.popup();
});
};

Expand Down
11 changes: 6 additions & 5 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const createWindow = () => {
titleBarStyle: 'hiddenInset',
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
height: 600,
width: 880,
Expand Down Expand Up @@ -48,7 +49,7 @@ const createWindow = () => {
generateMenu(mainWindow);

mainWindow.once('ready-to-show', () => {
initActions(ipcMain, store);
initActions(ipcMain, mainWindow, store);
mainWindow.show();
});

Expand All @@ -67,10 +68,6 @@ app.setAboutPanelOptions({
applicationVersion: process.env.npm_package_version,
});

app.on('ready', () => {
createWindow();
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
Expand All @@ -82,3 +79,7 @@ app.on('activate', () => {
createWindow();
}
});

app.whenReady().then(() => {
createWindow();
});
Loading

0 comments on commit aec1f72

Please sign in to comment.