diff --git a/src/_nav.1.js b/src/_nav.1.js new file mode 100644 index 000000000..b588fbb3e --- /dev/null +++ b/src/_nav.1.js @@ -0,0 +1,28 @@ +export default { + items: [ + { + name: 'Novera Fund', + url: '/fund', + icon: 'icon-speedometer', + badge: { + variant: 'info', + text: 'NEW', + }, + }, + { + name: 'Your Portfolio', + url: '/portfolio', + icon: 'icon-pie-chart', + }, + { + name: 'About', + url: '/about', + icon: 'icon-puzzle', + }, + { + name: 'News Feed', + url: '/news', + icon: 'icon-bell', + }, + ], +}; diff --git a/src/containers/DefaultLayout/DefaultHeader.js b/src/containers/DefaultLayout/DefaultHeader.js index f4d856b4f..51361a3cd 100644 --- a/src/containers/DefaultLayout/DefaultHeader.js +++ b/src/containers/DefaultLayout/DefaultHeader.js @@ -28,19 +28,8 @@ class DefaultHeader extends Component { /> - - - {/**/} ); } diff --git a/src/containers/DefaultLayout/DefaultLayout.js b/src/containers/DefaultLayout/DefaultLayout.js index 72f3a4a7c..a298937f4 100644 --- a/src/containers/DefaultLayout/DefaultLayout.js +++ b/src/containers/DefaultLayout/DefaultLayout.js @@ -5,22 +5,19 @@ import { Container } from 'reactstrap'; import { AppAside, AppBreadcrumb, - AppFooter, AppHeader, AppSidebar, - AppSidebarFooter, AppSidebarForm, AppSidebarHeader, - AppSidebarMinimizer, AppSidebarNav, } from '@coreui/react'; // sidebar nav config -import navigation from '../../_nav'; +import navigation from '../../_nav.1'; // routes config import routes from '../../routes'; +import Dashboard from '../../views/Dashboard/Dashboard'; const DefaultAside = React.lazy(() => import('./DefaultAside')); -const DefaultFooter = React.lazy(() => import('./DefaultFooter')); const DefaultHeader = React.lazy(() => import('./DefaultHeader')); class DefaultLayout extends Component { @@ -36,8 +33,8 @@ class DefaultLayout extends Component { return (
- - this.signOut(e)}/> + + this.signOut(e)} />
@@ -45,13 +42,11 @@ class DefaultLayout extends Component { - + - -
- + @@ -72,17 +67,12 @@ class DefaultLayout extends Component {
- + {/* - + */}
- - - - -
); } diff --git a/src/routes.js b/src/routes.js index e45082b85..76cee4cc6 100644 --- a/src/routes.js +++ b/src/routes.js @@ -39,6 +39,13 @@ const User = React.lazy(() => import('./views/Users/User')); // https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config const routes = [ + // Novera custom routes + { path: '/fund', exact: true, name: 'Users', component: Dashboard }, + { path: '/portfolio', exact: true, name: 'Users', component: Users }, + { path: '/about', exact: true, name: 'Users', component: Users }, + { path: '/news', exact: true, name: 'Users', component: Cards }, + + // default app routes { path: '/', exact: true, name: 'Home', component: DefaultLayout }, { path: '/dashboard', name: 'Dashboard', component: Dashboard }, { path: '/theme', exact: true, name: 'Theme', component: Colors }, diff --git a/src/views/Dashboard/Dashboard.js b/src/views/Dashboard/Dashboard.js index f0521a7c9..314b92566 100644 --- a/src/views/Dashboard/Dashboard.js +++ b/src/views/Dashboard/Dashboard.js @@ -416,7 +416,7 @@ const mainChartOpts = { mode: 'index', position: 'nearest', callbacks: { - labelColor: function(tooltipItem, chart) { + labelColor: function (tooltipItem, chart) { return { backgroundColor: chart.data.datasets[tooltipItem.datasetIndex].borderColor } } } @@ -483,212 +483,17 @@ class Dashboard extends Component { return (
- - - - - - { this.setState({ card1: !this.state.card1 }); }}> - - - - - Action - Another action - Disabled action - Something else here - - - -
9.823
-
Members online
-
-
- -
-
- - - - - - - { this.setState({ card2: !this.state.card2 }); }}> - - - - - Action - Another action - Something else here - - - -
9.823
-
Members online
-
-
- -
-
- - - - - - - { this.setState({ card3: !this.state.card3 }); }}> - - - - - Action - Another action - Something else here - - - -
9.823
-
Members online
-
-
- -
-
- - - - - - - { this.setState({ card4: !this.state.card4 }); }}> - - - - - Action - Another action - Something else here - - - -
9.823
-
Members online
-
-
- -
-
- -
- - - - - - - Traffic -
November 2015
- - - - - - - - - - - -
-
- -
-
- - - -
Visits
- 29.703 Users (40%) - - - -
Unique
- 24.093 Users (20%) - - - -
Pageviews
- 78.706 Views (60%) - - - -
New Users
- 22.123 Users (80%) - - - -
Bounce Rate
- Average Rate (40.15%) - - -
-
-
- -
- - - - - ({ variant: 'facebook', friends: '89k', feeds: '459' })} > -
- -
-
-
- - - - - ({ variant: 'twitter', followers: '973k', tweets: '1.792' })} > -
- -
-
-
- - - - - ({ variant: 'linkedin', contacts: '500+', feeds: '292' })} > -
- -
-
-
- - - - - ({ variant: 'google-plus', followers: '894', circles: '92' })} > -
- -
-
-
- -
+ {/* SUMMARY CARD ROW */} - Traffic {' & '} Sales + NOVERA Fund Charts - + {/*
@@ -889,238 +694,272 @@ class Dashboard extends Component { title="" data-original-title="show more">
- + */}

- - - - - - - - + + {/* */} + + + + + {/* */} + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
UserCountryUsagePayment MethodActivity
PositionUnit PriceNAVPSNAVActivity
-
- admin@bootstrapmaster.com - -
-
-
Yiorgos Avraamu
-
- New | Registered: Jan 1, 2015 -
-
- - -
-
- 50% -
-
- Jun 11, 2015 - Jul 10, 2015 -
-
- -
- - -
Last login
- 10 sec ago -
-
- admin@bootstrapmaster.com - -
-
-
Avram Tarasios
-
- - Recurring | Registered: Jan 1, 2015 -
-
- - -
-
- 10% -
-
- Jun 11, 2015 - Jul 10, 2015 -
-
- -
- - -
Last login
- 5 minutes ago -
-
- admin@bootstrapmaster.com - -
-
-
Quintin Ed
-
- New | Registered: Jan 1, 2015 -
-
- - -
-
- 74% -
-
- Jun 11, 2015 - Jul 10, 2015 -
-
- -
- - -
Last login
- 1 hour ago -
-
- admin@bootstrapmaster.com - -
-
-
Enéas Kwadwo
-
- New | Registered: Jan 1, 2015 -
-
- - -
-
- 98% -
-
- Jun 11, 2015 - Jul 10, 2015 -
-
- -
- - -
Last login
- Last month -
-
- admin@bootstrapmaster.com - -
-
-
Agapetus Tadeáš
-
- New | Registered: Jan 1, 2015 -
-
- - -
-
- 22% -
-
- Jun 11, 2015 - Jul 10, 2015 -
-
- -
- - -
Last login
- Last week -
-
- admin@bootstrapmaster.com - -
-
-
Friderik Dávid
-
- New | Registered: Jan 1, 2015 -
-
- - -
-
- 43% -
-
- Jun 11, 2015 - Jul 10, 2015 -
-
- -
- - -
Last login
- Yesterday -
+
BTCLong
+
+ BTCL +
+
+
999999
+
+
$888888
+
+
$777777
+
+
BTCShort
+
+ BTCS +
+
+
999999
+
+
$888888
+
+
$777777
+
+
Total Fund Nav
+
+
$777777
+
+ + {/* SUMMARY CARD ROW */} + + {/* + + + + { this.setState({ card1: !this.state.card1 }); }}> + + + + + Action + Another action + Disabled action + Something else here + + + +
9.823
+
Members online
+
+
+ +
+
+ */} + + {/* + + + + { this.setState({ card2: !this.state.card2 }); }}> + + + + + Action + Another action + Something else here + + + +
9.823
+
Members online
+
+
+ +
+
+ + + + + + + { this.setState({ card3: !this.state.card3 }); }}> + + + + + Action + Another action + Something else here + + + +
9.823
+
Members online
+
+
+ +
+
+ */} + + {/* + + + + { this.setState({ card4: !this.state.card4 }); }}> + + + + + Action + Another action + Something else here + + + +
9.823
+
Members online
+
+
+ +
+
+ */} +
+ + {/* GRAPH ROW */} + + + + + + + Traffic +
November 2015
+ + + + + + + + + + + +
+
+ +
+
+ + + +
Visits
+ 29.703 Users (40%) + + + +
Unique
+ 24.093 Users (20%) + + + +
Pageviews
+ 78.706 Views (60%) + + + +
New Users
+ 22.123 Users (80%) + + + +
Bounce Rate
+ Average Rate (40.15%) + + +
+
+
+ +
+ + {/* SOCIAL MEDIA CARD ROW */} + + {/* + + ({ variant: 'facebook', friends: '89k', feeds: '459' })} > +
+ +
+
+
+ + + + + ({ variant: 'twitter', followers: '973k', tweets: '1.792' })} > +
+ +
+
+
+ + + + + ({ variant: 'linkedin', contacts: '500+', feeds: '292' })} > +
+ +
+
+
+ + + + + ({ variant: 'google-plus', followers: '894', circles: '92' })} > +
+ +
+
+
+ */} +
+ +
); } diff --git a/src/views/Pages/Login/Login.js b/src/views/Pages/Login/Login.js index faf1d9b78..71ea496ca 100644 --- a/src/views/Pages/Login/Login.js +++ b/src/views/Pages/Login/Login.js @@ -3,12 +3,88 @@ import { Link } from 'react-router-dom'; import { Button, Card, CardBody, CardGroup, Col, Container, Form, Input, InputGroup, InputGroupAddon, InputGroupText, Row } from 'reactstrap'; class Login extends Component { + + constructor(props) { + super(props); + + // FIXME: consistently use either username or email + this.state = { + username: "", + password: "" + }; + + this.handleChange = this.handleChange.bind(this); + this.handleLogin = this.handleLogin.bind(this); + this.handleAuthCheck = this.handleAuthCheck.bind(this); + } + + handleLogin() { + // e.preventDefault(); + fetch("http://192.168.0.143:3000/login", { + method: 'POST', + credentials: 'same-origin', + body: JSON.stringify({ "email": this.state.username, "pw": this.state.password }), + headers: new Headers({ + 'Content-Type': 'application/json' + }) + }).then(res => res.json()) + .then(response => { + console.log("response", response) + if (response.error) { + console.log("login error: ") + console.log(response.error); + } else { + console.log("logged in") + this.props.history.push('/dashboard') + } + }) + .catch(error => { + console.error(error) + }); + } + + handleAuthCheck() { + fetch("http://192.168.0.143:3000/logincheck", { + method: 'GET', + credentials: 'same-origin', + headers: new Headers({ + 'Content-Type': 'application/json' + }) + }).then(res => res.json()) + .then(response => { + if (response.error) { + } else { + console.log(response); + if (!response.data.loggedin) { + console.log("not logged in, can't view route") + this.props.history.push('/'); //redirect back to home route with "react-router-dom" + } else { + console.log("log in check: OK") + } + } + }) + .catch(error => { + console.error(error) + }); + } + + // simple validation. Could be made more robust + validateForm() { + return this.state.email.length > 0 && this.state.password.length > 0; + } + + async handleChange(event){ + console.log(event.target.id) + await this.setState({[event.target.id] : event.target.value }) + console.log("state", this.state); + } + render() { return (
- + @@ -21,7 +97,7 @@ class Login extends Component { - + @@ -29,11 +105,11 @@ class Login extends Component { - + - + @@ -42,7 +118,7 @@ class Login extends Component { - + {/*

Sign up

@@ -53,7 +129,7 @@ class Login extends Component {
-
+
*/}