2022-01-02 00:19:18 +00:00
|
|
|
import React, { Component } from "react";
|
2022-01-31 12:53:20 +00:00
|
|
|
import { BrowserRouter as Router, Switch, Route, Link, Redirect,useHistory } from "react-router-dom";
|
2022-01-02 00:19:18 +00:00
|
|
|
|
2022-01-02 15:19:49 +00:00
|
|
|
import UserGenPage from "./UserGenPage";
|
2022-01-02 00:19:18 +00:00
|
|
|
import MakerPage from "./MakerPage";
|
|
|
|
import BookPage from "./BookPage";
|
|
|
|
import OrderPage from "./OrderPage";
|
2022-01-31 12:53:20 +00:00
|
|
|
import BottomBar from "./BottomBar";
|
|
|
|
|
2022-01-02 00:19:18 +00:00
|
|
|
export default class HomePage extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2022-01-31 12:53:20 +00:00
|
|
|
this.state = {
|
|
|
|
nickname: null,
|
|
|
|
token: null,
|
2022-05-03 20:21:04 +00:00
|
|
|
copiedToken: false,
|
2022-02-01 19:43:33 +00:00
|
|
|
avatarLoaded: false,
|
2022-04-24 15:18:17 +00:00
|
|
|
buyChecked: false,
|
|
|
|
sellChecked: false,
|
2022-05-16 11:37:30 +00:00
|
|
|
type:2,
|
|
|
|
currency:0,
|
2022-04-01 14:52:44 +00:00
|
|
|
bookCurrencyCode:'ANY',
|
2022-05-02 16:32:15 +00:00
|
|
|
bookOrders:new Array(),
|
|
|
|
bookLoading: true,
|
2022-01-31 12:53:20 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-02 19:28:34 +00:00
|
|
|
|
2022-01-31 12:53:20 +00:00
|
|
|
setAppState=(newState)=>{
|
|
|
|
this.setState(newState)
|
|
|
|
}
|
|
|
|
|
|
|
|
redirectTo(location) {
|
|
|
|
this.props.history.push(location);
|
2022-01-02 00:19:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Router >
|
2022-01-31 12:53:20 +00:00
|
|
|
<div className='appCenter'>
|
|
|
|
<Switch>
|
2022-03-05 17:32:27 +00:00
|
|
|
<Route exact path='/' render={(props) => <UserGenPage {...props} {...this.state} setAppState={this.setAppState}/>}/>
|
|
|
|
<Route path='/ref/:refCode' render={(props) => <UserGenPage {...props} {...this.state} setAppState={this.setAppState}/>}/>
|
2022-05-03 22:23:27 +00:00
|
|
|
<Route path='/make' render={(props) => <MakerPage {...props} {...this.state} setAppState={this.setAppState}/>}/>
|
2022-05-03 20:21:04 +00:00
|
|
|
<Route path='/book' render={(props) => <BookPage {...props} {...this.state} setAppState={this.setAppState} />}/>
|
2022-05-03 22:23:27 +00:00
|
|
|
<Route path="/order/:orderId" render={(props) => <OrderPage {...props} {...this.state} setAppState={this.setAppState}/>}/>
|
2022-01-31 12:53:20 +00:00
|
|
|
</Switch>
|
|
|
|
</div>
|
|
|
|
<div className='bottomBar'>
|
|
|
|
<BottomBar redirectTo={this.redirectTo} {...this.state} setAppState={this.setAppState} />
|
|
|
|
</div>
|
2022-01-02 00:19:18 +00:00
|
|
|
</Router>
|
|
|
|
);
|
|
|
|
}
|
2022-05-02 19:28:34 +00:00
|
|
|
}
|