Commit 14b70eeb authored by Chi Kei Chan's avatar Chi Kei Chan

Fix routes for assets path

parent 6b5621fe
...@@ -19,17 +19,13 @@ class NavigationTabs extends Component { ...@@ -19,17 +19,13 @@ class NavigationTabs extends Component {
}; };
} }
renderTab(name, path) { renderTab(name, path, regex) {
const { push } = this.props.history; const { push } = this.props.history;
const { selectedPath } = this.state;
return ( return (
<Tab <Tab
text={name} text={name}
onClick={() => { onClick={() => push(path)}
push(path); isSelected={regex.test(this.props.location.pathname)}
this.setState({ selectedPath: path });
}}
isSelected={selectedPath.indexOf(path) > -1}
/> />
) )
} }
...@@ -37,9 +33,9 @@ class NavigationTabs extends Component { ...@@ -37,9 +33,9 @@ class NavigationTabs extends Component {
render() { render() {
return ( return (
<Tabs className={this.props.className}> <Tabs className={this.props.className}>
{ this.renderTab('Swap', '/swap') } { this.renderTab('Swap', '/swap', /swap/) }
{ this.renderTab('Send', '/send') } { this.renderTab('Send', '/send', /send/) }
{ this.renderTab('Pool', '/pool') } { this.renderTab('Pool', '/add-liquidity', /add-liquidity|remove-liquidity|create-exchange/) }
</Tabs> </Tabs>
); );
} }
......
...@@ -53,7 +53,8 @@ class App extends Component { ...@@ -53,7 +53,8 @@ class App extends Component {
> >
<Route exact path="/swap" component={Swap} /> <Route exact path="/swap" component={Swap} />
<Route exact path="/send" component={Send} /> <Route exact path="/send" component={Send} />
<Route path="/pool" component={Pool} /> <Route exact path="/add-liquidity" component={Pool} />
<Route exact path="/create-exchange" component={Pool} />
<Redirect exact from="/" to="/swap" /> <Redirect exact from="/" to="/swap" />
</AnimatedSwitch> </AnimatedSwitch>
</BrowserRouter> </BrowserRouter>
......
...@@ -25,11 +25,11 @@ class ModeSelector extends Component { ...@@ -25,11 +25,11 @@ class ModeSelector extends Component {
switch (view) { switch (view) {
case ADD: case ADD:
return history.push('/pool/add'); return history.push('/add-liquidity');
case REMOVE: case REMOVE:
return history.push('/pool/remove'); return history.push('/remove-liquidity');
case CREATE: case CREATE:
return history.push('/pool/create'); return history.push('/create-exchange');
default: default:
return; return;
} }
......
...@@ -15,10 +15,9 @@ class Pool extends Component { ...@@ -15,10 +15,9 @@ class Pool extends Component {
<Header /> <Header />
</MediaQuery> </MediaQuery>
<Switch> <Switch>
<Route exact path="/pool/add" component={AddLiquidity} /> <Route exact path="/add-liquidity" component={AddLiquidity} />
{/*<Route exact path="/remove" component={Send} />*/} {/*<Route exact path="/remove" component={Send} />*/}
<Route exact path="/pool/create" component={CreateExchange} /> <Route exact path="/create-exchange" component={CreateExchange} />
<Redirect exact from="/pool" to="/pool/add" />
</Switch> </Switch>
</div> </div>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment