Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nylira committed Jan 21, 2017
0 parents commit 8f88415
Show file tree
Hide file tree
Showing 43 changed files with 990 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015", "stage-0"],
"plugins": ["transform-runtime"]
}
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
app/node_modules/**
app/dist/**
app/electron.js
test/unit/coverage/**
test/unit/*.js
test/e2e/*.js
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
node: true
},
extends: 'standard',
plugins: [
'html'
],
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
}
}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.DS_Store
app/dist/index.html
app/dist/build.js
app/dist/styles.css
builds/*
coverage
node_modules
npm-debug.log
npm-debug.log.*
thumbs.db
!.gitkeep
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# basecoin-ui

> An interface for Basecoin.
## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:9080
npm run dev

# build electron app for production
npm run build

# lint all JS/Vue component files in `app/src`
npm run lint

# run webpack in production
npm run pack
```
More information can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/docs/npm_scripts.html).

---

This project was generated from [electron-vue](https://github.com/SimulatedGREG/electron-vue) using [vue-cli](https://github.com/vuejs/vue-cli). Documentation about this project can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
# basecoin-ui
Empty file added app/dist/.gitkeep
Empty file.
59 changes: 59 additions & 0 deletions app/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict'

const electron = require('electron')
const path = require('path')
const app = electron.app
const BrowserWindow = electron.BrowserWindow

let mainWindow
let config = {}

if (process.env.NODE_ENV === 'development') {
config = require('../config')
config.url = `http://localhost:${config.port}`
} else {
config.devtron = false
config.url = `file://${__dirname}/dist/index.html`
}

function createWindow () {
/**
* Initial window options
*/
mainWindow = new BrowserWindow({
height: 600,
width: 800
})

mainWindow.loadURL(config.url)

if (process.env.NODE_ENV === 'development') {
BrowserWindow.addDevToolsExtension(path.join(__dirname, '../node_modules/devtron'))

let installExtension = require('electron-devtools-installer')

installExtension.default(installExtension.VUEJS_DEVTOOLS)
.then((name) => mainWindow.webContents.openDevTools())
.catch((err) => console.log('An error occurred: ', err))
}

mainWindow.on('closed', () => {
mainWindow = null
})

console.log('mainWindow opened')
}

app.on('ready', createWindow)

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
})
Binary file added app/icons/icon.icns
Binary file not shown.
Binary file added app/icons/icon.ico
Binary file not shown.
11 changes: 11 additions & 0 deletions app/index.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="app"></div>
<!-- webpack builds are automatically injected -->
</body>
</html>
15 changes: 15 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "basecoin-ui",
"version": "0.0.0",
"description": "An interface for Basecoin.",
"main": "electron.js",
"dependencies": {
"vue": "^2.0.1",
"vue-electron": "^1.0.0",
"vue-resource": "^1.0.3",
"vue-router": "^2.0.0",
"vuex": "^2.0.0"
},
"devDependencies": {},
"author": "Peng Zhong <[email protected]>"
}
40 changes: 40 additions & 0 deletions app/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<style>
@import url(https://fonts.googleapis.com/css?family=Lato:300);
* {
margin: 0;
padding: 0;
}
html,
body { height: 100%; }
body {
align-items: center;
background:
radial-gradient(
ellipse at center,
rgba(255, 255, 255, 1) 0%,
rgba(229, 229, 229, .85) 100%
);
background-position: center;
display: flex;
font-family: Lato, Helvetica, sans-serif;
justify-content: center;
text-align: center;
}
</style>

<template>
<div>
<router-view></router-view>
</div>
</template>

<script>
import store from 'src/vuex/store'
export default {
store
}
</script>
31 changes: 31 additions & 0 deletions app/src/components/LandingPageView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<style scoped>
img {
margin-top: -25px;
width: 450px;
}
</style>

<template>
<div>
<img src="./LandingPageView/assets/logo.png" alt="electron-vue">
<h1>Welcome.</h1>
<current-page></current-page>
<versions></versions>
<links></links>
</div>
</template>

<script>
import CurrentPage from './LandingPageView/CurrentPage'
import Links from './LandingPageView/Links'
import Versions from './LandingPageView/Versions'
export default {
components: {
CurrentPage,
Links,
Versions
},
name: 'landing-page'
}
</script>
33 changes: 33 additions & 0 deletions app/src/components/LandingPageView/CurrentPage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<style scoped>
code {
background-color: rgba(40, 56, 76, .5);
border-radius: 3px;
color: #fff;
font-weight: bold;
padding: 3px 6px;
margin: 0 3px;
vertical-align: bottom;
}
p { line-height: 24px; }
</style>

<template>
<p>
You are currently at <code>`{{ $route.path }}`</code> on the <code>`{{ $route.name }}`</code> view.
</p>
</template>

<script>
export default {
created () {
// Set $route values that are not preset during unit testing
if (process.env.NODE_ENV === 'testing') {
this.$route = {
name: 'landing-page',
path: '/landing-page'
}
}
}
}
</script>
25 changes: 25 additions & 0 deletions app/src/components/LandingPageView/Links.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<style scoped>
a {
color: rgb(50, 174, 110);
text-decoration: none;
}
a:hover {
color: rgb(40, 56, 76);
}
ul {
list-style-type: none;
margin-top: 10px;
}
li { display: inline-block; }
</style>

<template>
<ul>
<li><a href="https://simulatedgreg.gitbooks.io/electron-vue/content/index.html">documentation</a></li> |
<li><a href="http://electron.atom.io/">electron</a></li> |
<li><a href="http://vuejs.org/">vue.js</a></li>
</ul>
</template>
18 changes: 18 additions & 0 deletions app/src/components/LandingPageView/Versions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<p>
You are using electron v{{ versions['atom-shell'] }} with node v{{ versions.node }} on the {{ platform }} platform.
</p>
</template>

<script>
import os from 'os'
export default {
data () {
return {
platform: os.platform(),
versions: process.versions
}
}
}
</script>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions app/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Vue from 'vue'
import Electron from 'vue-electron'
import Resource from 'vue-resource'
import Router from 'vue-router'

import App from './App'
import routes from './routes'

Vue.use(Electron)
Vue.use(Resource)
Vue.use(Router)
Vue.config.debug = true

const router = new Router({
scrollBehavior: () => ({ y: 0 }),
routes
})

/* eslint-disable no-new */
new Vue({
router,
...App
}).$mount('#app')
11 changes: 11 additions & 0 deletions app/src/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default [
{
path: '/',
name: 'landing-page',
component: require('components/LandingPageView')
},
{
path: '*',
redirect: '/'
}
]
9 changes: 9 additions & 0 deletions app/src/vuex/actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as types from './mutation-types'

export const decrementMain = ({ commit }) => {
commit(types.DECREMENT_MAIN_COUNTER)
}

export const incrementMain = ({ commit }) => {
commit(types.INCREMENT_MAIN_COUNTER)
}
1 change: 1 addition & 0 deletions app/src/vuex/getters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const mainCounter = state => state.counters.main
19 changes: 19 additions & 0 deletions app/src/vuex/modules/counters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as types from '../mutation-types'

const state = {
main: 0
}

const mutations = {
[types.DECREMENT_MAIN_COUNTER] (state) {
state.main--
},
[types.INCREMENT_MAIN_COUNTER] (state) {
state.main++
}
}

export default {
state,
mutations
}
9 changes: 9 additions & 0 deletions app/src/vuex/modules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const files = require.context('.', false, /\.js$/)
const modules = {}

files.keys().forEach((key) => {
if (key === './index.js') return
modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
})

export default modules
2 changes: 2 additions & 0 deletions app/src/vuex/mutation-types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const DECREMENT_MAIN_COUNTER = 'DECREMENT_MAIN_COUNTER'
export const INCREMENT_MAIN_COUNTER = 'INCREMENT_MAIN_COUNTER'
Loading

0 comments on commit 8f88415

Please sign in to comment.