2017-10-30 19:10:25 +00:00
|
|
|
import React, { Component } from 'react';
|
2018-06-18 01:53:00 +00:00
|
|
|
import { RouteComponentProps, Switch, Route, Redirect } from 'react-router';
|
|
|
|
|
2017-10-30 19:10:25 +00:00
|
|
|
import translate from 'translations';
|
|
|
|
import TabSection from 'containers/TabSection';
|
2018-01-22 12:24:05 +00:00
|
|
|
import SubTabs from 'components/SubTabs';
|
|
|
|
import { RouteNotFound } from 'components/RouteNotFound';
|
2018-06-18 01:53:00 +00:00
|
|
|
import SignMessage from './components/SignMessage';
|
|
|
|
import VerifyMessage from './components/VerifyMessage';
|
2017-10-30 19:10:25 +00:00
|
|
|
|
|
|
|
interface State {
|
2017-12-19 22:46:34 +00:00
|
|
|
activeTab: 'sign' | 'verify';
|
2017-10-30 19:10:25 +00:00
|
|
|
}
|
|
|
|
|
2018-01-22 12:24:05 +00:00
|
|
|
export default class SignAndVerifyMessage extends Component<RouteComponentProps<{}>, State> {
|
2017-10-30 19:10:25 +00:00
|
|
|
public state: State = {
|
|
|
|
activeTab: 'sign'
|
|
|
|
};
|
|
|
|
|
2017-12-19 22:46:34 +00:00
|
|
|
public changeTab = (activeTab: State['activeTab']) => () => this.setState({ activeTab });
|
2017-10-30 19:10:25 +00:00
|
|
|
|
|
|
|
public render() {
|
2018-03-14 20:10:14 +00:00
|
|
|
const { match, location, history } = this.props;
|
2018-01-22 12:24:05 +00:00
|
|
|
const currentPath = match.url;
|
2017-10-30 19:10:25 +00:00
|
|
|
|
2018-01-22 12:24:05 +00:00
|
|
|
const tabs = [
|
|
|
|
{
|
|
|
|
path: 'sign',
|
2018-03-22 03:50:25 +00:00
|
|
|
name: translate('NAV_SIGNMSG')
|
2018-01-22 12:24:05 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'verify',
|
2018-03-22 03:50:25 +00:00
|
|
|
name: translate('MSG_VERIFY')
|
2018-01-22 12:24:05 +00:00
|
|
|
}
|
|
|
|
];
|
2017-10-30 19:10:25 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<TabSection>
|
|
|
|
<section className="Tab-content SignAndVerifyMsg">
|
2018-03-14 20:10:14 +00:00
|
|
|
<SubTabs tabs={tabs} match={match} location={location} history={history} />
|
2018-01-22 12:24:05 +00:00
|
|
|
<Switch>
|
|
|
|
<Route
|
|
|
|
exact={true}
|
|
|
|
path={currentPath}
|
|
|
|
render={() => <Redirect from={`${currentPath}`} to={`${currentPath}/sign`} />}
|
|
|
|
/>
|
|
|
|
<Route exact={true} path={`${currentPath}/sign`} component={SignMessage} />
|
|
|
|
<Route exact={true} path={`${currentPath}/verify`} component={VerifyMessage} />
|
|
|
|
<RouteNotFound />
|
|
|
|
</Switch>
|
2017-10-30 19:10:25 +00:00
|
|
|
</section>
|
|
|
|
</TabSection>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|