Skip to content

Commit 00cc607

Browse files
author
Matthew Foyle
committed
fix/style
1 parent c44f71a commit 00cc607

File tree

8 files changed

+77
-30
lines changed

8 files changed

+77
-30
lines changed

public/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
-->
1111
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
1212
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
13+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css"></link>
1314
<!--
1415
Notice the use of %PUBLIC_URL% in the tags above.
1516
It will be replaced with the URL of the `public` folder during the build.

src/actions/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as types from '../constants/ActionTypes';
2+
3+
export function TFH() {
4+
return {
5+
type: types.TFH,
6+
name
7+
};
8+
}

src/components/Nav.js

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class Nav extends Component {
3030
<TimeNav />
3131
</Menu>
3232

33-
3433
<Route exact path="/" component={Orders}/>
3534
<Route path="/revenue" component={Revenue}/>
3635
<Route path="/best-sellers" component={BestSellers}/>

src/components/Revenue.js

+21-22
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,50 @@ class Revenue extends Component {
4545
return moment().subtract(num, frame).format('YYYY-MM-DD');
4646
};
4747

48-
var OrdersLessThanX = (oldNum, oldFrame, newNum, newFrame) => {
49-
this.state.orders.data.filter(function(order) {
50-
return order.meta.timestamps.created_at.slice(0,10) > past(oldNum, oldFrame) && order.meta.timestamps.created_at.slice(0,10) < past(newNum, newFrame);
51-
})
52-
}
48+
// var OrdersLessThanX = (oldNum, oldFrame, newNum, newFrame) => {
49+
// this.state.orders.data.filter(function(order) {
50+
// return order.meta.timestamps.created_at.slice(0,10) > past(oldNum, oldFrame) && order.meta.timestamps.created_at.slice(0,10) < past(newNum, newFrame);
51+
// })
52+
// }
5353

5454
var OrdersLessThanSevenDaysAgo = this.state.orders.data.filter(function(order) {
55-
return order.meta.timestamps.created_at.slice(0,10) > past(7, 'days');;
56-
})
55+
return order.meta.timestamps.created_at.slice(0,10) > past(7, 'days');
56+
});
5757

5858
OrdersLessThanSevenDaysAgo.forEach(function(order) {
5959
revenue7 = revenue7 + order.meta.display_price.with_tax.amount/100
60-
})
60+
});
6161

6262
var OrdersLessThanFourteenDaysAgo = this.state.orders.data.filter(function(order) {
6363
return order.meta.timestamps.created_at.slice(0,10) > past(14, 'days') && order.meta.timestamps.created_at.slice(0,10) < past(7, 'days');
64-
})
64+
});
6565

6666
OrdersLessThanFourteenDaysAgo.forEach(function(order) {
6767
revenue14 = revenue14 + order.meta.display_price.with_tax.amount/100
68-
})
68+
});
6969

7070

7171
var OrdersLessThanOneMonthAgo = this.state.orders.data.filter(function(order) {
7272
return order.meta.timestamps.created_at.slice(0,10) > past(1, 'month');
73-
})
73+
});
74+
7475
OrdersLessThanOneMonthAgo.forEach(function(order) {
7576
revenueMonth = revenueMonth + order.meta.display_price.with_tax.amount/100
76-
})
77+
});
7778

7879
var OrdersLessThanTwoMonthAgo = this.state.orders.data.filter(function(order) {
7980
return order.meta.timestamps.created_at.slice(0,10) > past(2, 'months');
80-
})
81+
});
82+
8183
OrdersLessThanTwoMonthAgo.forEach(function(order) {
8284
revenueTwoMonths = revenueTwoMonths + order.meta.display_price.with_tax.amount/100
83-
})
84-
85-
var round_revTwoMonths = Math.round(revenueTwoMonths);
86-
var formatted_revTwoMonths = format({prefix: '$'})(round_revTwoMonths);
85+
});
8786

88-
var round_revMonth = Math.round(revenueMonth);
89-
var formatted_revMonth = format({prefix: '$'})(round_revMonth);
87+
// var round_revTwoMonths = Math.round(revenueTwoMonths);
88+
// var formatted_revTwoMonths = format({prefix: '$'})(round_revTwoMonths);
89+
//
90+
// var round_revMonth = Math.round(revenueMonth);
91+
// var formatted_revMonth = format({prefix: '$'})(round_revMonth);
9092

9193
var round_rev7 = Math.round(revenue7);
9294
var formatted_rev7 = format({prefix: '$'})(round_rev7);
@@ -96,7 +98,6 @@ class Revenue extends Component {
9698

9799
var diff = percentDiff(round_rev14, round_rev7, true);
98100

99-
100101
// console.log(round_revMonth)
101102
// console.log(round_revTwoMonths)
102103

@@ -137,8 +138,6 @@ class Revenue extends Component {
137138
</Col>
138139
</Row>
139140

140-
141-
142141
</Grid>
143142
</div>
144143
)

src/components/TimeNav.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@ import React, { Component } from 'react';
22
import { Menu } from 'semantic-ui-react';
33

44
class TimeNav extends Component {
5-
state = {}
5+
6+
constructor(props) {
7+
super();
8+
this.state = {time: null};
9+
}
10+
11+
componentDidMount() {
12+
};
613

714
handleItemClick = (e, { name }) => this.setState({ activeItem: name })
815

916
render() {
1017
const { activeItem } = this.state
1118

12-
1319
return (
1420
<Menu.Menu position='right'>
1521
<Menu.Item name='24h' active={activeItem === '24 Hours'} onClick={this.handleItemClick}>

src/constants/ActionTypes.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const TFH = '24H';
2+
export const SD = 'SD';

src/index.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
32
import App from './App';
4-
import registerServiceWorker from './registerServiceWorker';
3+
import { Provider } from 'react-redux';
4+
import { render } from 'react-dom';
5+
//import registerServiceWorker from './registerServiceWorker';
6+
import { createStore } from 'redux';
7+
import ChartsApp from './reducers/reducers.js';
58
import 'semantic-ui-css/semantic.min.css';
69
import './index.css';
710

8-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css"></link>;
11+
let store = createStore(ChartsApp)
912

10-
ReactDOM.render(<App />, document.getElementById('root'));
11-
registerServiceWorker();
13+
render(
14+
<Provider store={store}>
15+
<App />
16+
</Provider>,
17+
document.getElementById('root')
18+
);

src/reducers/reducers.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import * as types from '../constants/ActionTypes';
2+
3+
const ChartsApp = () => {
4+
5+
};
6+
7+
const initialState = {
8+
time : 1
9+
}
10+
11+
12+
export function time(state = initialState, action) {
13+
switch (action.type) {
14+
15+
case types.TFH:
16+
17+
return state;
18+
19+
default:
20+
return state;
21+
}
22+
}
23+
24+
25+
export default ChartsApp;

0 commit comments

Comments
 (0)