diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..edfe1bc --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + stage: 0 +} diff --git a/.gitignore b/.gitignore index c055b19..9f2676b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ jspm_packages node_modules +credentials.js diff --git a/cfg/base.js b/cfg/base.js index 74c8a91..e42577a 100644 --- a/cfg/base.js +++ b/cfg/base.js @@ -35,7 +35,7 @@ module.exports = { { test: /\.(js|jsx)$/, include: path.join(__dirname, 'src'), - loader: 'eslint-loader' + loader: 'babel-loader!eslint-loader' } ], loaders: [ @@ -60,7 +60,7 @@ module.exports = { loader: 'style-loader!css-loader!stylus-loader' }, { - test: /\.(png|jpg|gif|woff|woff2)$/, + test: /\.(png|jpg|gif|eot|woff|woff2)/, loader: 'url-loader?limit=8192' } ] diff --git a/package.json b/package.json index 09da43c..726b217 100644 --- a/package.json +++ b/package.json @@ -2,18 +2,18 @@ "name": "hibikeshare", "private": true, "version": "0.0.1", - "description": "YOUR DESCRIPTION - Generated by generator-react-webpack", + "description": "Hi Bikeshare Generated by generator-react-webpack", "main": "", "scripts": { "start": "node server.js --env=dev", "test": "karma start", "posttest": "npm run lint", "serve": "node server.js --env=dev", - "serve:dist": "node server.js --env=dist", - "dist": "npm run copy & webpack --env=dist", - "lint": "eslint ./src", - "copy": "copyfiles -f ./src/index.html ./src/favicon.ico ./dist", - "clean": "rimraf dist/*", + "serve:./public/app/dist": "node server.js --env=./public/app/dist", + "./public/app/dist": "npm run copy & webpack --env=./public/app/dist", + "lint": "eslint ./public/app/src", + "copy": "copyfiles -f ./public/app/src/index.html ./public/app/src/favicon.ico ././public/app/dist", + "clean": "rimraf ./public/app/dist/*", "release:major": "npm version major && npm publish && git push --follow-tags", "release:minor": "npm version minor && npm publish && git push --follow-tags", "release:patch": "npm version patch && npm publish && git push --follow-tags" @@ -52,18 +52,23 @@ "webpack-dev-server": "^1.10.1" }, "dependencies": { - "body-parser": "^1.14.1", - "cookie-parser": "^1.4.0", - "debug": "^2.2.0", - "express": "^4.13.3", - "jade": "^1.11.0", - "leaflet-hoverboard": "^1.1.5", + "d3": "^3.5.6", + "es6-promise": "^3.0.2", + "file-loader": "^0.8.4", + "fynx": "^2.0.0-alpha7", + "immutable": "^3.7.5", + "leaflet": "^0.7.5", + "leaflet-hash": "^0.2.1", "lodash": "^3.10.1", - "morgan": "^1.6.1", + "mapbox-gl": "^0.11.1", "normalize.css": "^3.0.3", - "nunjucks": "^2.1.0", + "omniscient": "^3.3.0", + "pbf": "^1.3.5", + "qs": "^5.1.0", "react": "^0.13.3", + "reqwest-without-xhr2": "^2.0.2", "sass-loader": "^1.0.1", - "serve-favicon": "^2.3.0" + "url-loader": "^0.5.6", + "vector-tile": "^1.1.3" } } diff --git a/public/app/src/actions/README.md b/public/app/src/actions/README.md deleted file mode 100644 index 7267347..0000000 --- a/public/app/src/actions/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# About this folder -This folder will hold all of your **flux** actions if you are using flux. -You can include actions into your components or stores like this: - -```javascript -let react = require('react/addons'); -let MyAction = require('actions/MyAction'); -class MyComponent extends React.Component { - constructor(props) { - super(props); - MyAction.exampleMethod(); - } -} -``` diff --git a/public/app/src/actions/actions.js b/public/app/src/actions/actions.js new file mode 100644 index 0000000..c039476 --- /dev/null +++ b/public/app/src/actions/actions.js @@ -0,0 +1,7 @@ +import {createActions, createAsyncActions} from 'fynx'; + +export default createActions([ + // routeActions.js + 'initRoutes', + 'allRoutes' +]); diff --git a/public/app/src/actions/routeActions.js b/public/app/src/actions/routeActions.js new file mode 100644 index 0000000..b13d2b1 --- /dev/null +++ b/public/app/src/actions/routeActions.js @@ -0,0 +1,36 @@ +import {default as actions} from './actions'; +import qs from 'qs'; +import request from 'reqwest-without-xhr2'; +import routeStore from '../stores/routeStore.js'; +import {Promise} from 'es6-promise'; + +const server = 'http://services.arcgis.com/tNJpAOha4mODLkXz/ArcGIS/rest/services/BikePaths/FeatureServer/0/query'; + +/** + * Fetches routes from api server + */ +actions.initRoutes.listen(() => { + let params = { + where:'1=1', + geometryType:'esriGeometryEnvelope', + spatialRel:'esriSpatialRelIntersects', + units:'esriSRUnit_Meter', + outFields:'*', + returnGeometry:'true', + returnIdsOnly:'false', + returnCountOnly:'false', + returnExtentOnly:'false', + returnDistinctValues:'false', + returnZ:'false', + returnM:'false', + f:'pjson' + } + let url = `${server}?${qs.stringify(params)}`; + request({ + url: url, + type: 'json' + }).then((data) => { + routeStore().set('routes', data.features); + console.log(routeStore().get('routes')); + }); +}); diff --git a/public/app/src/components/Main.js b/public/app/src/components/Main.js index f56c7f8..05b639e 100644 --- a/public/app/src/components/Main.js +++ b/public/app/src/components/Main.js @@ -1,17 +1,37 @@ require('normalize.css'); -require('styles/App.css'); import React from 'react/addons'; +import {default as actions} from '../actions/actions.js'; +import routeActions from '../actions/routeActions.js'; +import store from '../stores/routeStore.js'; +import { + vector_api_key, + mapbox_access_token +} from '../globals/credentials.js'; + +import {mapboxStyles} from '../globals/mapbox.js'; +import {connect} from 'fynx-decorators'; let yeomanImage = require('../images/yeoman.png'); +@connect(store, 'data') class AppComponent extends React.Component { + componentDidMount() { + actions.initRoutes(); + L.mapbox.accessToken = mapbox_access_token; + this.map = new L.mapbox.map('map', 'russellvea2.nl7ij7em', { + center: [21.456597,-157.857164], + zoom: 12 + }) + } + + componentWillUpdate() { + + } + render() { return ( -
- Yeoman Generator -
blah
-
+
); } } diff --git a/public/app/src/globals/mapbox.js b/public/app/src/globals/mapbox.js new file mode 100644 index 0000000..1760f70 --- /dev/null +++ b/public/app/src/globals/mapbox.js @@ -0,0 +1,56 @@ +import {vector_api_key} from './credentials.js'; + + +const styles = { + "sans": "Open Sans Regular, Arial Unicode MS Regular", + "sans-it": "Open Sans Italic, Arial Unicode MS Regular", + "sans-md": "Open Sans Semibold, Arial Unicode MS Bold", + "sans-bd": "Open Sans Bold, Arial Unicode MS Bold", + "big-label": "#cb4b49", + "medium-label": "#f27a87", + "small-label": "#384646", + "label-halo": "rgba(255,255,255,0.5)", + "label-halo-dark": "rgba(0,0,0,0.2)", + land: "#ededed", + water: "#7acad0", + park: "#c2cd44", + building: "#afd3d3", + highway: "#5d6765", + road: "#c0c4c2", + path: "#5d6765", + subway: "#ef7369", + "highway-width": { + "base": 1.55, + "stops": [[4, 0.5], [8, 1.5], [20, 40]] + }, + "road-width": { + "base": 1.55, + "stops": [[4, 0.25], [20, 30]] + }, + "path-width": { + "base": 1.8, + "stops": [[10, 0.15], [20, 15]] + }, + "road-misc-width": { + "base": 1, + "stops": [[4, 0.25], [20, 30]] + }, + "stream-width":{ + "base": 0.5, + "stops": [[4, 0.5], [10, 1.5], [20, 5]] + } + }; + +/** + * Source: https://github.com/mapzen/mapboxgl-vector-tiles/blob/master/index.html + */ +export const mapboxStyles = { + "version": 8, + "glyphs": "mapbox://fontstack/{fontstack}/{range}.pbf", + "sources": { + "osm": { + "type": "vector", + "tiles": [`https://vector.mapzen.com/osm/all/{z}/{x}/{y}.mvt?api_key=${vector_api_key}`] + } + }, +} diff --git a/public/app/src/index.html b/public/app/src/index.html index 30a07e5..619165f 100644 --- a/public/app/src/index.html +++ b/public/app/src/index.html @@ -6,11 +6,13 @@ +
APPLICATION CONTENT
+ diff --git a/public/app/src/stores/README.md b/public/app/src/stores/README.md deleted file mode 100644 index 5ee1aeb..0000000 --- a/public/app/src/stores/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# About this folder -This folder will hold all of your **flux** stores. -You can include them into your components like this: - -```javascript -let react = require('react/addons'); -let MyStore = require('stores/MyStore'); -class MyComponent extends React.Component { - constructor(props) { - super(props); - MyStore.doSomething(); - } -} -``` diff --git a/public/app/src/stores/routeStore.js b/public/app/src/stores/routeStore.js new file mode 100644 index 0000000..ba79dfd --- /dev/null +++ b/public/app/src/stores/routeStore.js @@ -0,0 +1,6 @@ +import {fromJS} from 'immutable'; +import {createCursorStore} from 'fynx'; + +export default createCursorStore(fromJS({ + routes: [] +})); diff --git a/test.tm2/.thumb.png b/test.tm2/.thumb.png new file mode 100644 index 0000000..73f2cda Binary files /dev/null and b/test.tm2/.thumb.png differ diff --git a/test.tm2/README.md b/test.tm2/README.md new file mode 100644 index 0000000..7df3d4d --- /dev/null +++ b/test.tm2/README.md @@ -0,0 +1,3 @@ +mapbox-studio-default-style +=========================== +Default style used by new style projects in Mapbox Studio. diff --git a/test.tm2/bookmarks.yml b/test.tm2/bookmarks.yml new file mode 100644 index 0000000..aa67ec1 --- /dev/null +++ b/test.tm2/bookmarks.yml @@ -0,0 +1,14 @@ +- place_name: 4161 Nuuanu Pali Dr Honolulu, Hawaii 96817 United States + zoom: 13 + center: + - 21.346064612734615 + - -157.81156539916992 + tags: + - userbookmark +- place_name: 1508 Ala Leleu St Honolulu, Hawaii 96818 United States + zoom: 14 + center: + - 21.3565 + - -157.901 + tags: + - userbookmark diff --git a/test.tm2/project.xml b/test.tm2/project.xml new file mode 100644 index 0000000..436bc55 --- /dev/null +++ b/test.tm2/project.xml @@ -0,0 +1,695 @@ + + + + + + © Mapbox © OpenStreetMap Improve this map]]> + -180,-85.0511,180,85.0511 + -157.901,21.3565,14 + + png8:m=h + 22 + 0 + + + + + + + + + + + waterway + + + + water + + + + + + + + + + + + + + + + tunnel + + + + road + + + + bridge + + + + admin + + + + country_label_line + + + + country_label + + + + + + + + + + place_label + + + + water_label + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test.tm2/project.yml b/test.tm2/project.yml new file mode 100644 index 0000000..02ee2f9 --- /dev/null +++ b/test.tm2/project.yml @@ -0,0 +1,27 @@ +_prefs: + mapid: russellvea2.8b899a17 + saveCenter: true +_properties: + bridge: + "group-by": layer +attribution: "© Mapbox © OpenStreetMap Improve this map" +bounds: + - -180 + - -85.0511 + - 180 + - 85.0511 +center: + - -157.901 + - 21.3565 + - 14 +description: Bikeshare +format: "png8:m=h" +interactivity_layer: '' +layers: null +maxzoom: 22 +minzoom: 0 +name: Bikeshare Hawaii +source: "mapbox:///mapbox.mapbox-streets-v5" +styles: + - style.mss +template: '' diff --git a/test.tm2/style.mss b/test.tm2/style.mss new file mode 100644 index 0000000..185fe46 --- /dev/null +++ b/test.tm2/style.mss @@ -0,0 +1,153 @@ +// Languages: name (local), name_en, name_fr, name_es, name_de +@name: '[name_en]'; + +// Fonts // +@sans: 'Source Sans Pro Regular'; +@sans_italic: 'Source Sans Pro Italic'; +@sans_bold: 'Source Sans Pro Semibold'; + +// Common Colors // +@land: #8BD3AC; +@water: #4DC9F2; + +@blue: #4DC9F2; +@green: #8BD3AC; +@yellow: #FED030; + +Map { background-color: @green; } + +// Political boundaries // + +#admin[admin_level=2][maritime=0] { + line-join: round; + line-color: #bbe; + line-width: 1.4; + [zoom>=6] { line-width: 2; } + [zoom>=8] { line-width: 4; } + [disputed=1] { line-dasharray: 4,4; } +} + +// Places // + +#country_label[zoom>=3] { + text-name: @name; + text-face-name: @sans_bold; + text-fill: #66a; + text-size: 12; + [zoom>=3][scalerank=1], + [zoom>=4][scalerank=2], + [zoom>=5][scalerank=3], + [zoom>=6][scalerank>3] { + text-size: 14; + } + [zoom>=4][scalerank=1], + [zoom>=5][scalerank=2], + [zoom>=6][scalerank=3], + [zoom>=7][scalerank>3] { + text-size: 16; + } +} + +#country_label_line { line-color: fadeout(#66a,75%); } + +#place_label[localrank<=2] { + [type='city'][zoom<=15] { + text-name: @name; + text-face-name: @sans_bold; + text-fill: #444; + text-size: 16; + [zoom>=10] { text-size: 18; } + [zoom>=12] { text-size: 24; } + } + [type='town'][zoom<=17] { + text-name: @name; + text-face-name: @sans; + text-fill: #333; + text-size: 14; + [zoom>=10] { text-size: 16; } + [zoom>=12] { text-size: 20; } + } + [type='village'] { + text-name: @name; + text-face-name: @sans; + text-fill: #444; + text-size: 12; + [zoom>=12] { text-size: 14; } + [zoom>=14] { text-size: 18; } + } + [type='hamlet'], + [type='suburb'], + [type='neighbourhood'] { + text-name: @name; + text-face-name: @sans; + text-fill: #666; + text-size: 12; + [zoom>=14] { text-size: 14; } + [zoom>=16] { text-size: 16; } + } +} + +// Water Features // + +#water { + polygon-fill: @blue; + polygon-gamma: 0.6; +} + +#water_label { + [zoom<=13], // automatic area filtering @ low zooms + [zoom>=14][area>500000], + [zoom>=16][area>10000], + [zoom>=17] { + text-name: @name; + text-face-name: @sans_italic; + text-fill: darken(@water, 30%); + text-size: 13; + text-wrap-width: 100; + text-wrap-before: true; + } +} + +#waterway { + [type='river'], + [type='canal'] { + line-color: @water; + line-width: 0.5; + [zoom>=12] { line-width: 1; } + [zoom>=14] { line-width: 2; } + [zoom>=16] { line-width: 3; } + } + [type='stream'] { + line-color: @water; + line-width: 0.5; + [zoom>=14] { line-width: 1; } + [zoom>=16] { line-width: 2; } + [zoom>=18] { line-width: 3; } + } +} + +// Roads & Railways // + +#tunnel { opacity: 0.5; } + +#road, +#tunnel, +#bridge { + ['mapnik::geometry_type'=2] { + line-color: @yellow; + line-width: 0.5; + [class='motorway'], + [class='main'] { + [zoom>=10] { line-width: 1; } + [zoom>=12] { line-width: 2; } + [zoom>=14] { line-width: 3; } + [zoom>=16] { line-width: 5; } + } + [class='street'], + [class='street_limited'] { + [zoom>=14] { line-width: 1; } + [zoom>=16] { line-width: 2; } + } + [class='street_limited'] { line-dasharray: 4,1; } + } +}