From ee6db917edb9c50ba42a38eaebf5d11c1d31a1d7 Mon Sep 17 00:00:00 2001 From: MahmoudYounes Date: Wed, 4 Jul 2018 06:48:46 +0200 Subject: [PATCH 01/21] Calling welcome one time (#87) Fixes #86 --- AUTHORS.md | 1 + app/components/App.js | 2 +- app/components/Home.js | 21 ++++++++++++++++----- main.js | 6 ++++++ utils/api.electron.js | 30 ++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 utils/api.electron.js diff --git a/AUTHORS.md b/AUTHORS.md index 0ce9c6a..16075b4 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -14,6 +14,7 @@ If you make a contribution here, you may add your name and email address here. - Austin Daniel (austindanielfrench@gmail.com) - Bekir Durak (bekirdurak97@gmail.com) - Andrew Cheng (cheng0807@gmail.com) +- Mahmoud Younes (m.younesbadr@gmail.com) diff --git a/app/components/App.js b/app/components/App.js index b5eb409..db26d7d 100644 --- a/app/components/App.js +++ b/app/components/App.js @@ -14,7 +14,7 @@ export default () => ( component={route.component} /> ))} - + diff --git a/app/components/Home.js b/app/components/Home.js index eb77f21..2232c00 100644 --- a/app/components/Home.js +++ b/app/components/Home.js @@ -1,6 +1,17 @@ import React from 'react' -export default () => ( -
-

Deer

-
-) +import { Redirect } from 'react-router-dom' +import { checkRedirectToWelcomePage, setNotFirstTimeFlag } from '../../utils/api.electron' + +export default () => { + if (checkRedirectToWelcomePage()) { + setNotFirstTimeFlag() + return ( + + ) + } + return ( +
+

Deer

+
+ ) +} diff --git a/main.js b/main.js index f26959f..2b2334e 100644 --- a/main.js +++ b/main.js @@ -6,6 +6,7 @@ const windowState = require('electron-window-state') const os = require('os') const initLogger = require('./utils/logger') const appInfo = require('./package.json') +const Store = require('electron-store') // Let electron reloads by itself when webpack watches changes in ./app/ if (isDev) { @@ -23,6 +24,11 @@ let win // a global reference of the logger object. let logger +// global reference for electron store +// keep all user hidden, app specific options here +var electronStore = new Store() +global.electronStore = electronStore + // Create an instance of the app. Returns false if first instance var shouldQuit = app.makeSingleInstance(function (commandLine, workingDirectory) { if (win) { diff --git a/utils/api.electron.js b/utils/api.electron.js new file mode 100644 index 0000000..0235c5d --- /dev/null +++ b/utils/api.electron.js @@ -0,0 +1,30 @@ +import electron from 'electron' + +// fetching electron store object +let electronStore = electron.remote.getGlobal('electronStore') + +/** + * check whether to redirect to the welcome page or no. + * this value is saved in electron store in show-welcome flag. + * returns true if first time to open Deer, otherwise, false + */ +var checkRedirectToWelcomePage = function () { + if (electronStore.has('show-welcome')) { + return electronStore.get('show-welcome') + } + return true +} + +/** + * called to mark that the user has already opened Deer once. + * sets the show-welcome flag in electron store to false. + */ +var setNotFirstTimeFlag = function () { + electronStore.set('show-welcome', false) +} + +// export the functions defined here +module.exports = { + checkRedirectToWelcomePage, + setNotFirstTimeFlag +} From 3fc7ff7cd637fb96adca17d4f234e386857e06c1 Mon Sep 17 00:00:00 2001 From: Ahmed Ismail <33787886+ai-zahran@users.noreply.github.com> Date: Wed, 4 Jul 2018 17:25:19 +0200 Subject: [PATCH 02/21] Fix broken link to docs/README.md (#95) * Fix broken link to docs/README.md * Fix broken link in README.MD The link to the docs was set to ./docs/index.md. It was changed to ./docs/README,.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ccb465..da29c22 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,10 @@ ### Getting started -Check [Our Docs](./docs/index.md) for **building** and **installing** instructions. +Check [Our Docs](./docs/README.md) for **building** and **installing** instructions. -If you would like to contribute to Deer, see [Our Docs](./docs/index.md) too. +If you would like to contribute to Deer, see [Our Docs](./docs/README.md) too. ### Get in touch! From 344a6cf86666cbc53b2deafc09aad2da9a466bd6 Mon Sep 17 00:00:00 2001 From: Ahmed Ismail <33787886+ai-zahran@users.noreply.github.com> Date: Wed, 4 Jul 2018 17:34:46 +0200 Subject: [PATCH 03/21] Fixes #93: Split lines in packaging documentation (#93) (#96) --- docs/Packaging.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Packaging.md b/docs/Packaging.md index 7825161..9aa2395 100644 --- a/docs/Packaging.md +++ b/docs/Packaging.md @@ -4,7 +4,7 @@ Now you can build and distribute Deer easily and generate binaries for various p ## For Linux -Currently, Deer supports deb, rpm and zip packages +Currently, Deer supports deb, rpm and zip packages. To generate the packages use, the one you need according to your distributions. ``` bash npm run release:linux:deb @@ -14,7 +14,7 @@ npm run release:linux:zip ## For Mac OS -Currently, Deer supports dmg package +Currently, Deer supports dmg package. To generate the packages, use the one you need according to your distributions. ``` bash npm run release:mac @@ -22,7 +22,7 @@ npm run release:mac ## For Windows -Currently, Deer supports ia32 and x64 architectures. +Currently, Deer supports ia32 and x64 architectures. To generate the packages, use the one you need according to your architecture. ``` bash npm run release:win32 From ffbb66aae47dfe08e866cec3e89d1faa99061e0c Mon Sep 17 00:00:00 2001 From: Abdelrhman Ahmed Date: Wed, 11 Jul 2018 02:27:20 +0200 Subject: [PATCH 04/21] Fixes #99 : Implement Header component (#100) --- app/components/App.js | 28 +++++++++++++--------------- app/components/Header.js | 18 ++++++++++++++++++ app/components/Home.js | 8 ++++++-- main.js | 3 +-- 4 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 app/components/Header.js diff --git a/app/components/App.js b/app/components/App.js index db26d7d..2cd7092 100644 --- a/app/components/App.js +++ b/app/components/App.js @@ -3,19 +3,17 @@ import { Switch, Route, BrowserRouter, Redirect } from 'react-router-dom' import routes from '../routes' export default () => ( -
- - - {routes.map((route, index) => ( - - ))} - - - -
+ + + {routes.map((route, index) => ( + + ))} + + + ) diff --git a/app/components/Header.js b/app/components/Header.js new file mode 100644 index 0000000..80d8ad7 --- /dev/null +++ b/app/components/Header.js @@ -0,0 +1,18 @@ +import React from 'react' +import { Button } from 'reactstrap' +export default () => ( + +) diff --git a/app/components/Home.js b/app/components/Home.js index 2232c00..b8f802c 100644 --- a/app/components/Home.js +++ b/app/components/Home.js @@ -1,6 +1,10 @@ import React from 'react' import { Redirect } from 'react-router-dom' -import { checkRedirectToWelcomePage, setNotFirstTimeFlag } from '../../utils/api.electron' +import Header from './Header' +import { + checkRedirectToWelcomePage, + setNotFirstTimeFlag +} from '../../utils/api.electron' export default () => { if (checkRedirectToWelcomePage()) { @@ -11,7 +15,7 @@ export default () => { } return (
-

Deer

+
) } diff --git a/main.js b/main.js index 2b2334e..166a98c 100644 --- a/main.js +++ b/main.js @@ -59,8 +59,7 @@ function createWindow () { minHeight: 600, backgroundColor: '#F8F8FF', icon: 'app/assets/images/Deer-128.png', - show: false, - resizable: false + show: false }) logger.info('Deer window is created') From 19545489fe311903bb76d76294603c9eea678d9c Mon Sep 17 00:00:00 2001 From: Abdelrhman Ahmed Date: Sun, 12 Aug 2018 19:20:28 +0200 Subject: [PATCH 05/21] Fixes #89: Adds layout of home component (#102) --- app/assets/styles/index.css | 15 +++++++++++++++ app/components/Home.js | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/app/assets/styles/index.css b/app/assets/styles/index.css index 2da9207..0b4b49f 100644 --- a/app/assets/styles/index.css +++ b/app/assets/styles/index.css @@ -53,3 +53,18 @@ left: 35%; top: 45%; } + +.home-sidebar { + position: sticky; + top: 48px; + height: calc(100vh - 48px); + flex: 0 1 320px; + -webkit-box-flex: 0; + border-right: 2px solid ghostwhite; + overflow: auto; + padding: 5px!important; +} + +.home-content { + padding: 0px; +} diff --git a/app/components/Home.js b/app/components/Home.js index b8f802c..ce33816 100644 --- a/app/components/Home.js +++ b/app/components/Home.js @@ -16,6 +16,10 @@ export default () => { return (
+
+
+
+
) } From f45e1c954f830ce662bd24b44af2b05a3a9bf1cd Mon Sep 17 00:00:00 2001 From: Abdelrhman Ahmed Date: Sun, 12 Aug 2018 20:41:34 +0200 Subject: [PATCH 06/21] Fixes #103: Implement HomeContent component (#104) - Implement HomeContent component - Add default route to be loaded when Deer loads --- app/assets/styles/index.css | 5 +++-- app/components/Home.js | 7 +++++-- app/components/HomeContent.js | 7 +++++++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 app/components/HomeContent.js diff --git a/app/assets/styles/index.css b/app/assets/styles/index.css index 0b4b49f..b69a659 100644 --- a/app/assets/styles/index.css +++ b/app/assets/styles/index.css @@ -49,8 +49,9 @@ .middle-page { @extend .font-style-base; - position: fixed; - left: 35%; + position: sticky; + justify-content: center; + display: flex; top: 45%; } diff --git a/app/components/Home.js b/app/components/Home.js index ce33816..6349848 100644 --- a/app/components/Home.js +++ b/app/components/Home.js @@ -1,6 +1,7 @@ import React from 'react' -import { Redirect } from 'react-router-dom' +import { Redirect, Route } from 'react-router-dom' import Header from './Header' +import HomeContent from './HomeContent' import { checkRedirectToWelcomePage, setNotFirstTimeFlag @@ -18,7 +19,9 @@ export default () => {
-
+
+ +
) diff --git a/app/components/HomeContent.js b/app/components/HomeContent.js new file mode 100644 index 0000000..8c8b10c --- /dev/null +++ b/app/components/HomeContent.js @@ -0,0 +1,7 @@ +import React from 'react' + +export default () => ( +
+

Please select a note or add a new one

+
+) From 93c2b4a75bbf5fd4673bae08bf58e503b4138461 Mon Sep 17 00:00:00 2001 From: Abdelrhman Ahmed Date: Sun, 12 Aug 2018 22:31:22 +0200 Subject: [PATCH 07/21] Fixes #92: Add editor component (#105) --- app/actions/noteEditor.js | 5 +++++ app/assets/styles/index.css | 24 +++++++++++++++++++++++- app/components/Header.js | 1 + app/components/Home.js | 21 +++++++++++++-------- app/components/NoteEditor.js | 22 ++++++++++++++++++++++ app/constants/actions.js | 3 ++- app/containers/NoteEditor.js | 18 ++++++++++++++++++ app/reducers/index.js | 4 +++- app/reducers/noteEditor.js | 18 ++++++++++++++++++ package.json | 1 + 10 files changed, 106 insertions(+), 11 deletions(-) create mode 100644 app/actions/noteEditor.js create mode 100644 app/components/NoteEditor.js create mode 100644 app/containers/NoteEditor.js create mode 100644 app/reducers/noteEditor.js diff --git a/app/actions/noteEditor.js b/app/actions/noteEditor.js new file mode 100644 index 0000000..2568c33 --- /dev/null +++ b/app/actions/noteEditor.js @@ -0,0 +1,5 @@ +import { createAction } from 'redux-actions' +import { ACTIONS } from '../constants/actions' + +// Used for updating editor state. +export const onSaveEditorState = createAction(ACTIONS.UPDATE_EDITOR_STATE) diff --git a/app/assets/styles/index.css b/app/assets/styles/index.css index b69a659..cb33643 100644 --- a/app/assets/styles/index.css +++ b/app/assets/styles/index.css @@ -54,7 +54,10 @@ display: flex; top: 45%; } - +.home-container { + padding: 0px; + margin-left: -3px; +} .home-sidebar { position: sticky; top: 48px; @@ -69,3 +72,22 @@ .home-content { padding: 0px; } + +.NoteEditor { + font-family: 'Inconsolata', 'Menlo', 'Consolas', monospace; + font-size: 15px; + font-weight: bold; + color: black; + line-height: 30px; + cursor: text; + background: linear-gradient(transparent, transparent 28px, green 30px); + background-size: 30px 30px; + min-height: calc(100vh - 48px); + border-left: 3px solid #D44147; + padding: 5px; + padding-left: 10px; +} + +.NoteEditor-hidePlaceholder { + display: none; +} diff --git a/app/components/Header.js b/app/components/Header.js index 80d8ad7..6dded75 100644 --- a/app/components/Header.js +++ b/app/components/Header.js @@ -1,5 +1,6 @@ import React from 'react' import { Button } from 'reactstrap' + export default () => (