Skip to content

Commit

Permalink
wip separate to component
Browse files Browse the repository at this point in the history
  • Loading branch information
pangaunn committed Jul 23, 2017
1 parent 8109239 commit a26a1b1
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 414 deletions.
18 changes: 18 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["istanbul"]
}
}
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/*.js
config/*.js
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// http://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
'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
}
}
8 changes: 8 additions & 0 deletions .postcssrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// https://github.com/michael-ciniawsky/postcss-load-config

module.exports = {
"plugins": {
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}
6 changes: 6 additions & 0 deletions config/dev.env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var merge = require('webpack-merge')
var prodEnv = require('./prod.env')

module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})
38 changes: 38 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')

module.exports = {
build: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
},
dev: {
env: require('./dev.env'),
port: 8080,
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
// (https://github.com/webpack/css-loader#sourcemaps)
// In our experience, they generally work as expected,
// just be aware of this issue when enabling this option.
cssSourceMap: false
}
}
3 changes: 3 additions & 0 deletions config/prod.env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
NODE_ENV: '"production"'
}
89 changes: 9 additions & 80 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,83 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BKKHackmap</title>
<!-- bkkhack github organization favicon -->
<link rel="icon" href="https://avatars2.githubusercontent.com/u/15698632?v=3&s=200">
<link rel="stylesheet" href="style/main.css">
</head>
<body>
<div class="projects side-column">
<div class="project-form" v-bind:class="{ open: form.isOpen }">
<input v-model="form.title" type="text" placeholder="Topic" autofocus>
<textarea v-model="form.description" placeholder="More description (optional)"></textarea>
</div>
<button class="glow-button" v-on:click="toggleForm">+ Add your hack</button>
<div v-for="project in projects"
v-on:dragstart="drag"
v-on:click="selectedProject = project"
v-bind:key="project.id"
v-bind:data-id="project.id"
v-bind:class="{ selected: selectedProject === project }"
v-bind:draggable="project.username === username"
v-cloak
class="project">
<img v-bind:src="project.avatar_thumbnail" v-bind:alt="project.username" draggable="false" />
{{project.title}}
</div>
<div class="details" v-if="projects.length === 0">
No hacks yet! You can be first!
</div>
<div class="loader" v-if="projects.loading">
<div class="loader1"></div>
<div class="loader2"></div>
<div class="loader3"></div>
</div>
</div>
<div class="center-column">
<h1>BKKHackmap</h1>
<a class="help-icon">?<div class="help-text" v-html="helpText"></div></a>
<a class="account-status" v-if="username" v-on:click="logout" v-cloak>{{username}} (Log out)</a>
<a class="account-status" v-else v-on:click="login" v-cloak>Log in</a>
<div class="droptarget"
v-on:dragover="dragover"
v-on:drop="drop">
<img src="images/carmana.svg" class="floorplan" />
<img class="marker"
v-for="project in projects"
v-if="project.x"
v-bind:key="project.id"
v-bind:draggable="project.username === username"
v-on:dragstart="drag"
v-on:click="selectedProject = project"
v-bind:class="{ selected: selectedProject === project }"
v-bind:data-id="project.id"
v-bind:style="{ left: mapWidth * project.x - 20 + 'px', top: mapHeight * project.y - 20 + 'px' }"
v-bind:src="project.avatar_thumbnail"
v-bind:alt="project.username"
v-bind:title="project.title" />
</div>
</div>
<div class="details side-column">
<template v-if="selectedProject.id" v-cloak>
<a class="edit-button" v-if="selectedProject.username === username" v-on:click="toggleEditMode">{{selectedProject.editMode ? "X" : "Edit"}}</a>
<img class="avatar"
v-bind:src="selectedProject.avatar"
v-bind:alt="selectedProject.username" />
<p><a v-bind:href="'https://github.com/' + selectedProject.username">@{{selectedProject.username}}</a> is hacking on:</p>
<template v-if="!selectedProject.editMode">
<h2>{{selectedProject.title}}</h2>
<p class='selected-project-description'>{{selectedProject.description}}</p>
</template>
<template v-else>
<input v-model="selectedProject.title" type="text" autofocus>
<textarea v-model="selectedProject.description"></textarea>
<button class="glow-button" v-on:click="updateProject">Update</button>
</template>
</template>
</div>
<script src="build/vendor.bundle.js"></script>
<script src="build/bundle.js"></script>
</body>
<head>
<meta charset="UTF-8">
<title>BKKHackmap</title>
<!-- bkkhack github organization favicon -->
<link rel="icon" href="https://avatars2.githubusercontent.com/u/15698632?v=3&s=200">
</head>
<body>
<div id="app"></div>
</body>
</html>
66 changes: 56 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,68 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack-dev-server --progress --colors",
"build:dev": "webpack",
"build:dist": "webpack -p",
"build": "if [ `git name-rev --name-only HEAD` = 'gh-pages' ]; then npm run build:dist; else npm run build:dev; fi"
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"lint": "eslint --ext .js,.vue src"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.16.1",
"vue": "^2.2.6"
"vue": "^2.3.3"
},
"devDependencies": {
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"webpack": "^2.3.2",
"webpack-dev-server": "^2.4.2"
}
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"cssnano": "^3.10.0",
"eslint": "^3.19.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^3.0.0",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"webpack-bundle-analyzer": "^2.2.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0",
"rimraf": "^2.6.0",
"url-loader": "^0.5.8",
"vue-loader": "^12.1.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
Loading

0 comments on commit a26a1b1

Please sign in to comment.