robosats/frontend/src/components/HomePage.js

51 lines
1.9 KiB
JavaScript
Raw Normal View History

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";
import UserGenPage from "./UserGenPage";
import MakerPage from "./MakerPage";
import BookPage from "./BookPage";
import OrderPage from "./OrderPage";
2022-01-31 12:53:20 +00:00
import BottomBar from "./BottomBar";
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-02-01 19:43:33 +00:00
avatarLoaded: false,
buyChecked: false,
sellChecked: false,
bookType:2,
bookCurrency:0,
2022-04-01 14:52:44 +00:00
bookCurrencyCode:'ANY',
2022-01-31 12:53:20 +00:00
}
}
setAppState=(newState)=>{
this.setState(newState)
}
redirectTo(location) {
this.props.history.push(location);
}
render() {
return (
<Router >
2022-01-31 12:53:20 +00:00
<div className='appCenter'>
<Switch>
<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-01-31 12:53:20 +00:00
<Route path='/make' component={MakerPage}/>
<Route path='/book' render={(props) => <BookPage {...props} buyChecked={this.state.buyChecked} sellChecked={this.state.sellChecked} type={this.state.bookType} currencyCode={this.state.bookCurrencyCode} currency={this.state.bookCurrency} setAppState={this.setAppState} />}/>
2022-01-31 12:53:20 +00:00
<Route path="/order/:orderId" component={OrderPage}/>
</Switch>
</div>
<div className='bottomBar'>
<BottomBar redirectTo={this.redirectTo} {...this.state} setAppState={this.setAppState} />
</div>
</Router>
);
}
}