mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-22 17:08:55 +00:00
b7ba8ac22d
* Nest Routes * Update routing for subtabs * Revert 'remove subtabs component' * Update contract routes * Update subtabs component * Remove typo * Update routing to handle disabled subroutes * add disable prop to request payment tab * Update request payment disabled condition * Add CaptureRouteNotFound & RouteNotFound components * Update ENS routing * Remove any type * Display 404 before unlocking wallet
60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
import translate from 'translations';
|
|
import { Interact } from './components/Interact';
|
|
import { Deploy } from './components/Deploy';
|
|
import './index.scss';
|
|
import { reset, TReset } from 'actions/transaction';
|
|
import { resetWallet, TResetWallet } from 'actions/wallet';
|
|
import TabSection from 'containers/TabSection';
|
|
import React, { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { Switch, Route, Redirect, RouteComponentProps } from 'react-router';
|
|
import SubTabs from 'components/SubTabs';
|
|
import { RouteNotFound } from 'components/RouteNotFound';
|
|
|
|
interface Props {
|
|
reset: TReset;
|
|
resetWallet: TResetWallet;
|
|
}
|
|
|
|
const tabs = [
|
|
{
|
|
path: 'interact',
|
|
name: translate('Interact')
|
|
},
|
|
{
|
|
path: 'deploy',
|
|
name: translate('Deploy')
|
|
}
|
|
];
|
|
|
|
class Contracts extends Component<Props & RouteComponentProps<{}>> {
|
|
public render() {
|
|
const { match } = this.props;
|
|
const currentPath = match.url;
|
|
|
|
return (
|
|
<TabSection isUnavailableOffline={true}>
|
|
<div className="SubTabs-tabs">
|
|
<SubTabs tabs={tabs} match={match} />
|
|
</div>
|
|
<section className="Tab-content Contracts">
|
|
<div className="Contracts-content">
|
|
<Switch>
|
|
<Route
|
|
exact={true}
|
|
path={currentPath}
|
|
render={() => <Redirect from={`${currentPath}`} to={`${currentPath}/interact`} />}
|
|
/>
|
|
<Route exact={true} path={`${currentPath}/interact`} component={Interact} />
|
|
<Route exact={true} path={`${currentPath}/deploy`} component={Deploy} />
|
|
<RouteNotFound />
|
|
</Switch>
|
|
</div>
|
|
</section>
|
|
</TabSection>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default connect(null, { reset, resetWallet })(Contracts);
|