Skip to content

Commit

Permalink
Refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
terencelimzhengwei committed Mar 25, 2017
1 parent 88ca5e6 commit 8002b09
Show file tree
Hide file tree
Showing 25 changed files with 34 additions and 57 deletions.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -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(
<Routes history={hashHistory} />,
Expand Down
File renamed without changes.
9 changes: 3 additions & 6 deletions src/about/index.js → src/lib/components/AboutPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/lib/card/index.js → src/lib/components/Card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
import React, {PropTypes} from "react";

import "../../fonts/font.css"
import "./index.css";

const Card = ({children,title,width}) => (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<g className={"heatmap"}>
<g className={"Heatmap"}>
{data.map((d, i) => {
return (
d.avail.map((a, b) => (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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}) => {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import React, {Component } from 'react';
import Card from '../lib/card'
import Card from '../Card'

import './index.css';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import React, {PropTypes} from "react";

import "./index.css";

const Select = ({options,text,onChange,value}) => {
return (
<div className="select-container">
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
File renamed without changes.
13 changes: 3 additions & 10 deletions src/main/index.js → src/lib/containers/AppShell/index.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
File renamed without changes.
35 changes: 17 additions & 18 deletions src/app/index.js → src/lib/containers/Module/index.js
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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) {
Expand All @@ -47,11 +46,11 @@ class App extends Component {
setData(data);
}
)
} else {
setData(data);
}
}
);
// } else {
// setData(data);
// }
// }
// );
}

render() {
Expand Down Expand Up @@ -125,4 +124,4 @@ class App extends Component {
}
}

export default App;
export default Module;
7 changes: 0 additions & 7 deletions src/logo.svg

This file was deleted.

8 changes: 4 additions & 4 deletions src/routes.js → src/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => (
<Router {...props}>
Expand Down

0 comments on commit 8002b09

Please sign in to comment.