diff --git a/src/index.js b/src/index.js index c7002fb..c3dd63d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { hashHistory } from 'react-router'; -import Routes from './routes'; +import Routes from './routes/routes'; import './index.css'; +import './fonts/font.css'; + ReactDOM.render( , diff --git a/src/about/index.css b/src/lib/components/AboutPage/index.css similarity index 100% rename from src/about/index.css rename to src/lib/components/AboutPage/index.css diff --git a/src/about/index.js b/src/lib/components/AboutPage/index.js similarity index 89% rename from src/about/index.js rename to src/lib/components/AboutPage/index.js index 9d45b90..b595bad 100644 --- a/src/about/index.js +++ b/src/lib/components/AboutPage/index.js @@ -2,15 +2,12 @@ * Created by terencelimzw on 26/12/16. */ -import React, {Component } from 'react'; -import Card from '../lib/card' +import React, {PureComponent } from 'react'; +import Card from '../Card'; import './index.css'; -export default class About extends Component { - // static propTypes = {} - // static defaultProps = {} - // state = {} +export default class About extends PureComponent { render() { // const { className, ...props } = this.props; diff --git a/src/lib/card/index.css b/src/lib/components/Card/index.css similarity index 100% rename from src/lib/card/index.css rename to src/lib/components/Card/index.css diff --git a/src/lib/card/index.js b/src/lib/components/Card/index.js similarity index 94% rename from src/lib/card/index.js rename to src/lib/components/Card/index.js index 8665e66..397e8c0 100644 --- a/src/lib/card/index.js +++ b/src/lib/components/Card/index.js @@ -6,7 +6,6 @@ */ import React, {PropTypes} from "react"; -import "../../fonts/font.css" import "./index.css"; const Card = ({children,title,width}) => ( diff --git a/src/lib/chart/index.css b/src/lib/components/ChartSVG/index.css similarity index 100% rename from src/lib/chart/index.css rename to src/lib/components/ChartSVG/index.css diff --git a/src/lib/chart/index.js b/src/lib/components/ChartSVG/index.js similarity index 100% rename from src/lib/chart/index.js rename to src/lib/components/ChartSVG/index.js diff --git a/src/lib/heatmap/index.css b/src/lib/components/Heatmap/index.css similarity index 100% rename from src/lib/heatmap/index.css rename to src/lib/components/Heatmap/index.css diff --git a/src/lib/heatmap/index.js b/src/lib/components/Heatmap/index.js similarity index 98% rename from src/lib/heatmap/index.js rename to src/lib/components/Heatmap/index.js index de3fbed..c6686c6 100644 --- a/src/lib/heatmap/index.js +++ b/src/lib/components/Heatmap/index.js @@ -10,7 +10,7 @@ const HeatMap = ({gridSize,stroke,strokeOpacity,colorRange,data,onMouseOver,onMo var domain = [0,(raw_data?d3.max(raw_data.map(d=>d3.max(d))):0)] var colorScale = d3.scaleLinear().range(colorRange).domain(domain) return ( - + {data.map((d, i) => { return ( d.avail.map((a, b) => ( diff --git a/src/lib/axes/index.css b/src/lib/components/HeatmapAxes/index.css similarity index 100% rename from src/lib/axes/index.css rename to src/lib/components/HeatmapAxes/index.css diff --git a/src/lib/axes/index.js b/src/lib/components/HeatmapAxes/index.js similarity index 100% rename from src/lib/axes/index.js rename to src/lib/components/HeatmapAxes/index.js diff --git a/src/lib/nav/index.css b/src/lib/components/Navbar/index.css similarity index 100% rename from src/lib/nav/index.css rename to src/lib/components/Navbar/index.css diff --git a/src/lib/nav/index.js b/src/lib/components/Navbar/index.js similarity index 96% rename from src/lib/nav/index.js rename to src/lib/components/Navbar/index.js index cf1e4e2..9690257 100644 --- a/src/lib/nav/index.js +++ b/src/lib/components/Navbar/index.js @@ -5,7 +5,6 @@ import React, {PropTypes} from "react"; import {Link} from "react-router"; import "./index.css"; -import "../../fonts/font.css" const Navbar = ({title,links}) => { diff --git a/src/notfound/index.css b/src/lib/components/NotFoundPage/index.css similarity index 100% rename from src/notfound/index.css rename to src/lib/components/NotFoundPage/index.css diff --git a/src/notfound/index.js b/src/lib/components/NotFoundPage/index.js similarity index 94% rename from src/notfound/index.js rename to src/lib/components/NotFoundPage/index.js index d21ec57..ce9027a 100644 --- a/src/notfound/index.js +++ b/src/lib/components/NotFoundPage/index.js @@ -3,7 +3,7 @@ */ import React, {Component } from 'react'; -import Card from '../lib/card' +import Card from '../Card' import './index.css'; diff --git a/src/lib/select/index.css b/src/lib/components/Select/index.css similarity index 100% rename from src/lib/select/index.css rename to src/lib/components/Select/index.css diff --git a/src/lib/select/index.js b/src/lib/components/Select/index.js similarity index 99% rename from src/lib/select/index.js rename to src/lib/components/Select/index.js index b11b822..37470fb 100644 --- a/src/lib/select/index.js +++ b/src/lib/components/Select/index.js @@ -4,6 +4,7 @@ import React, {PropTypes} from "react"; import "./index.css"; + const Select = ({options,text,onChange,value}) => { return (
diff --git a/src/lib/tooltip/index.css b/src/lib/components/Tooltip/index.css similarity index 100% rename from src/lib/tooltip/index.css rename to src/lib/components/Tooltip/index.css diff --git a/src/lib/tooltip/index.js b/src/lib/components/Tooltip/index.js similarity index 78% rename from src/lib/tooltip/index.js rename to src/lib/components/Tooltip/index.js index 6ed2d42..3055ffb 100644 --- a/src/lib/tooltip/index.js +++ b/src/lib/components/Tooltip/index.js @@ -1,12 +1,6 @@ -/** - * Created by terencelimzw on 24/12/16. - */ -/** - * Created by terencelimzw on 24/12/16. - */ import React, {PropTypes} from "react"; -import "./index.css"; +import "./index.css" const Tooltip = ({show,x,y,message}) => { const classes = show ? "tooltip show" : "tooltip"; diff --git a/src/main/index.css b/src/lib/containers/AppShell/index.css similarity index 100% rename from src/main/index.css rename to src/lib/containers/AppShell/index.css diff --git a/src/main/index.js b/src/lib/containers/AppShell/index.js similarity index 73% rename from src/main/index.js rename to src/lib/containers/AppShell/index.js index aff20c1..54afc1a 100644 --- a/src/main/index.js +++ b/src/lib/containers/AppShell/index.js @@ -1,16 +1,9 @@ -/** - * Created by terencelimzw on 26/12/16. - */ - -import React, {Component } from 'react'; -import Navbar from '../lib/nav'; +import React, {Component} from 'react'; +import Navbar from '../../components/Navbar'; import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; import './index.css'; -export default class About extends Component { - // static propTypes = {} - // static defaultProps = {} - // state = {} +export default class AppShell extends Component { render() { // const { className, ...props } = this.props; diff --git a/src/app/index.css b/src/lib/containers/Module/index.css similarity index 100% rename from src/app/index.css rename to src/lib/containers/Module/index.css diff --git a/src/app/index.js b/src/lib/containers/Module/index.js similarity index 86% rename from src/app/index.js rename to src/lib/containers/Module/index.js index 6ed9fca..f4cd531 100644 --- a/src/app/index.js +++ b/src/lib/containers/Module/index.js @@ -1,17 +1,16 @@ import React, { Component } from 'react'; -import Card from '../lib/card'; -import HeatMap from '../lib/heatmap' -import Axis from '../lib/axes' -import ChartSVG from '../lib/chart' -import Tooltip from '../lib/tooltip' -import Select from '../lib/select' +import Card from '../../components/Card'; +import HeatMap from '../../components/Heatmap'; +import Axis from '../../components/HeatmapAxes'; +import ChartSVG from '../../components/ChartSVG'; +import Tooltip from '../../components/Tooltip'; +import Select from '../../components/Select'; import {json} from 'd3-request' import * as d3 from 'd3' import './index.css'; -import '../fonts/font.css' -class App extends Component { +class Module extends Component { constructor(props) { super(props); this.state = {hover:false,x:0,y:0,value:0}; @@ -35,10 +34,10 @@ class App extends Component { update_timestamp: update_timestamp }); }; - json("http://222.164.236.19:9003/latest.json", - (error,data)=>{ - if (error) { - console.log(error); + // json("http://222.164.236.19:9003/latest.json", + // (error,data)=>{ + // if (error) { + // console.log(error); json("https://raw.githubusercontent.com/terencelimzhengwei/active-sg-badminton/master/data/latest.json", (error,data)=>{ if (error) { @@ -47,11 +46,11 @@ class App extends Component { setData(data); } ) - } else { - setData(data); - } - } - ); + // } else { + // setData(data); + // } + // } + // ); } render() { @@ -125,4 +124,4 @@ class App extends Component { } } -export default App; +export default Module; diff --git a/src/logo.svg b/src/logo.svg deleted file mode 100644 index 6b60c10..0000000 --- a/src/logo.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/routes.js b/src/routes/routes.js similarity index 66% rename from src/routes.js rename to src/routes/routes.js index d406445..03a6744 100644 --- a/src/routes.js +++ b/src/routes/routes.js @@ -5,10 +5,10 @@ import React from 'react'; import { Router, Route } from 'react-router'; -import App from './app'; -import About from './about'; -import Main from './main'; -import NotFound from './notfound'; +import App from '../lib/containers/Module' +import About from '../lib/components/AboutPage'; +import Main from '../lib/containers/AppShell'; +import NotFound from '../lib/components/NotFoundPage'; const Routes = (props) => (