1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00
metamask-extension/ui/pages/first-time-flow/seed-phrase/seed-phrase.component.js
Mark Stacey e067379f48
Remove the partially-applied dark mode styles used for beta (#12489)
The beta build currently has a couple of UI elements (the horizontal
logo and the app header) set to "dark mode", even though nothing else
in our UI supports dark mode yet. These styles have been removed. We
should make the entire UI support dark mode all at once at a later
date.

Also the horizontal logo used for beta was named incorrectly; the dark
and non-dark logos were swapped. They have been switched back so that
the logo that ends with `-dark` is for dark mode.
2021-10-28 17:29:20 -02:30

101 lines
3.0 KiB
JavaScript

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Switch, Route } from 'react-router-dom';
import HTML5Backend from 'react-dnd-html5-backend';
import { DragDropContextProvider } from 'react-dnd';
import {
INITIALIZE_SEED_PHRASE_ROUTE,
INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE,
INITIALIZE_BACKUP_SEED_PHRASE_ROUTE,
INITIALIZE_SEED_PHRASE_INTRO_ROUTE,
DEFAULT_ROUTE,
} from '../../../helpers/constants/routes';
import MetaFoxLogo from '../../../components/ui/metafox-logo';
import ConfirmSeedPhrase from './confirm-seed-phrase';
import RevealSeedPhrase from './reveal-seed-phrase';
import SeedPhraseIntro from './seed-phrase-intro';
export default class SeedPhrase extends PureComponent {
static propTypes = {
history: PropTypes.object,
seedPhrase: PropTypes.string,
verifySeedPhrase: PropTypes.func,
};
state = {
verifiedSeedPhrase: '',
};
componentDidMount() {
const { seedPhrase, history, verifySeedPhrase } = this.props;
if (!seedPhrase) {
verifySeedPhrase().then((verifiedSeedPhrase) => {
if (verifiedSeedPhrase) {
this.setState({ verifiedSeedPhrase });
} else {
history.push(DEFAULT_ROUTE);
}
});
}
}
render() {
const { seedPhrase, history } = this.props;
const { verifiedSeedPhrase } = this.state;
const pathname = history?.location?.pathname;
const introClass =
pathname === INITIALIZE_SEED_PHRASE_INTRO_ROUTE ? 'intro' : '';
return (
<DragDropContextProvider backend={HTML5Backend}>
<div className={`first-time-flow__wrapper ${introClass}`}>
<MetaFoxLogo />
<Switch>
<Route
exact
path={INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE}
render={(routeProps) => (
<ConfirmSeedPhrase
{...routeProps}
seedPhrase={seedPhrase || verifiedSeedPhrase}
/>
)}
/>
<Route
exact
path={INITIALIZE_SEED_PHRASE_ROUTE}
render={(routeProps) => (
<RevealSeedPhrase
{...routeProps}
seedPhrase={seedPhrase || verifiedSeedPhrase}
/>
)}
/>
<Route
exact
path={INITIALIZE_BACKUP_SEED_PHRASE_ROUTE}
render={(routeProps) => (
<RevealSeedPhrase
{...routeProps}
seedPhrase={seedPhrase || verifiedSeedPhrase}
/>
)}
/>
<Route
exact
path={INITIALIZE_SEED_PHRASE_INTRO_ROUTE}
render={(routeProps) => (
<SeedPhraseIntro
{...routeProps}
seedPhrase={seedPhrase || verifiedSeedPhrase}
/>
)}
/>
</Switch>
</div>
</DragDropContextProvider>
);
}
}