Skip to content

Commit

Permalink
A more stable version. Readme changes. Window sizes fiexed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Areas committed Jan 24, 2018
1 parent c5c0335 commit beae36b
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 51 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# m2-list
This is a small todo-list application. It is built by electron.
I build this from **electron-quick-start** repo, and use a lot of code in that repo.
# idea of this application
When you start to work, there are so many things appear in your mind. So you can just write them down and continue your work. After that, you have a list, and this application will give you list item randomly. Then you choose to do it or just get another item.
# command available
<p align="center">
<h3 align="center">m2-list</h3>
<p align="center">It is a small todo-list application.</p>
</p>

## Idea
When I start to work, there are so many things appearing in my mind. I just write them down and continue my work. After doing that, I have a list. And this application helps me record such things and give me one randomly to do. Then I choose to do it or just get another list item.

## Quick-start
- You can [download the Windows release](https://github.com/ginhton/m2-list/releases/download/v0.1/m2-windows.exe).
- You can [download the Linux release](https://github.com/ginhton/m2-list/releases/download/v0.1/m2-linux.AppImage).
- Clone the repo: `git clone https://github.com/ginhton/m2-list.git`

## Commands available
* `add something-to-do`: this will add something to the whole list.
* `list`: this will list all the things your list.
* `clear`: clear all the things that appears in your list.
* `get`: get a random item from your list, and then you can start to do it.
* `done`: this will mark the item you *get* before done, and remove that item from your list.
* `save`: save current list. And you can close this application.
* `restore`: restore list if you saved list before.
# how to build
* first, you can clone this repo.
* Then, you enter that directory, and run "yarn".
* Then, you run "yarn build" to get distribute version.
* Or you can run "yarn start" to run directly.
* `quit`: quit.
35 changes: 22 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/papercss@1.4.1/dist/paper.min.css">
<title>2 Min App</title>
<style type="text/css">
html,body { padding: 0px; margin: 0px; height: 100%; }
html,body { padding: 0px; margin: 0px; height: 100%; width: 100%; }
body {
-webkit-app-region: drag;
overflow: hidden;
background-color: rgba(255, 120, 192, 0.3);
/* background-color: rgba(255, 120, 192, 0.3); */
background-color: white;
}
#container {
width: 100%;
margin: 0px;
height:100%;
}
Expand All @@ -20,8 +24,8 @@
padding-top: 34px;
}
#title {
color: white;
font-size: 2.6em;
color: gray;
font-size: 2.1em;
text-align: center;
}

Expand Down Expand Up @@ -57,19 +61,24 @@
border-radius: 2%;
font-size: 1.8em;
}
li {
font-size: 20px;
}
</style>
</head>
<body>
<body class="card">
<!-- All of the Node.js APIs are available in this renderer process. -->
<div id="container">
<h2 id="title"> 2 Min APP </h2>
<ul id="list">
</ul>
<div id="input-area">
<input type="text" id="command" />
<div id="container" class="paper container">
<div class="card">
<div class="card-body">
<h2 id="title" class="card-title"> 2 Min APP </h2>
<ul id="list">
</ul>
<div id="input-area">
<input type="text" id="command" />
</div>
</div>
</div>
</div>

<script>
// You can also require other files to run in this process
require('./renderer.js')
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ function help() {
show("clear: remove all the items in your list")
show("save: save current list in local storage")
show("restore: restore list from local storage. This will override current list.")
show("quit: close current window.")
current = -1
}

function nothing() {
// nothing here
clearAndShow("invalid command..");
console.log("nothing happened");
// console.log("nothing happened");
}

function clearAndShow(item) {
Expand Down
23 changes: 1 addition & 22 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,36 @@
const electron = require('electron')
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow

const path = require('path')
const url = require('url')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow

function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600, frame: false})
mainWindow = new BrowserWindow({ width: 800, height: 600, frame: false, resizable: false })

// and load the index.html of the app.
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))

// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"author": "ginhton",
"devDependencies": {
"electron": "1.7.9",
"electron": "1.7.11",
"electron-builder": "^19.43.4"
}
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,9 @@ electron-publish@19.43.0:
fs-extra-p "^4.4.4"
mime "^2.0.3"

electron@1.7.9:
version "1.7.9"
resolved "http://registry.npm.taobao.org/electron/download/electron-1.7.9.tgz#add54e9f8f83ed02f6519ec10135f698b19336cf"
electron@1.7.11:
version "1.7.11"
resolved "http://registry.npm.taobao.org/electron/download/electron-1.7.11.tgz#993b6aa79e0e79a7cfcc369f4c813fbd9a0b08d9"
dependencies:
"@types/node" "^7.0.18"
electron-download "^3.0.1"
Expand Down

0 comments on commit beae36b

Please sign in to comment.