-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
draft - fixing Import Account error messages (#16895)
- Loading branch information
1 parent
1a330dd
commit 0fb1ee1
Showing
13 changed files
with
510 additions
and
703 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,36 @@ | ||
import React, { Component } from 'react'; | ||
import { Switch, Route } from 'react-router-dom'; | ||
import React from 'react'; | ||
import { Route, Switch } from 'react-router-dom'; | ||
import Box from '../../components/ui/box'; | ||
|
||
import { | ||
NEW_ACCOUNT_ROUTE, | ||
IMPORT_ACCOUNT_ROUTE, | ||
CONNECT_HARDWARE_ROUTE, | ||
IMPORT_ACCOUNT_ROUTE, | ||
NEW_ACCOUNT_ROUTE | ||
} from '../../helpers/constants/routes'; | ||
import NewAccountCreateForm from './new-account.container'; | ||
import NewAccountImportForm from './import-account'; | ||
import ConnectHardwareForm from './connect-hardware'; | ||
import NewAccountImportForm from './import-account'; | ||
import NewAccountCreateForm from './new-account.container'; | ||
|
||
export default class CreateAccountPage extends Component { | ||
render() { | ||
return ( | ||
<div className="new-account"> | ||
<div className="new-account__form"> | ||
<Switch> | ||
<Route | ||
exact | ||
path={NEW_ACCOUNT_ROUTE} | ||
component={NewAccountCreateForm} | ||
/> | ||
<Route | ||
exact | ||
path={IMPORT_ACCOUNT_ROUTE} | ||
component={NewAccountImportForm} | ||
/> | ||
<Route | ||
exact | ||
path={CONNECT_HARDWARE_ROUTE} | ||
component={ConnectHardwareForm} | ||
/> | ||
</Switch> | ||
</div> | ||
</div> | ||
); | ||
} | ||
export default function CreateAccountPage() { | ||
return ( | ||
<Box className="new-account"> | ||
<Switch> | ||
<Route | ||
exact | ||
path={NEW_ACCOUNT_ROUTE} | ||
component={NewAccountCreateForm} | ||
/> | ||
<Route | ||
exact | ||
path={IMPORT_ACCOUNT_ROUTE} | ||
component={NewAccountImportForm} | ||
/> | ||
<Route | ||
exact | ||
path={CONNECT_HARDWARE_ROUTE} | ||
component={ConnectHardwareForm} | ||
/> | ||
</Switch> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { | ||
ButtonPrimary, | ||
ButtonSecondary, | ||
} from '../../../components/component-library'; | ||
import Box from '../../../components/ui/box/box'; | ||
import { | ||
BLOCK_SIZES, | ||
JustifyContent, | ||
} from '../../../helpers/constants/design-system'; | ||
import { useI18nContext } from '../../../hooks/useI18nContext'; | ||
import * as actions from '../../../store/actions'; | ||
|
||
export default function BottomButtons({ | ||
importAccountFunc, | ||
isPrimaryDisabled, | ||
}) { | ||
const t = useI18nContext(); | ||
const dispatch = useDispatch(); | ||
const warning = useSelector((state) => state.appState.warning); | ||
|
||
return ( | ||
<Box | ||
justifyContent={JustifyContent.spaceBetween} | ||
marginTop={warning ? 0 : 8} // These buttons need a margin on the top only if there's no warning message | ||
> | ||
<ButtonSecondary | ||
width={BLOCK_SIZES.FIVE_TWELFTHS} | ||
onClick={() => { | ||
dispatch(actions.hideWarning()); | ||
history.back(); | ||
}} | ||
> | ||
{t('cancel')} | ||
</ButtonSecondary> | ||
<ButtonPrimary | ||
width={BLOCK_SIZES.FIVE_TWELFTHS} | ||
onClick={importAccountFunc} | ||
disabled={isPrimaryDisabled} | ||
> | ||
{t('import')} | ||
</ButtonPrimary> | ||
</Box> | ||
); | ||
} |
18 changes: 18 additions & 0 deletions
18
ui/pages/create-account/import-account/import-account.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import NewAccountImportForm from '.'; | ||
import Box from '../../../components/ui/box'; | ||
import { _setBackgroundConnection } from '../../../store/action-queue'; | ||
|
||
export default { | ||
title: 'Pages/CreateAccount/ImportAccount', | ||
}; | ||
|
||
export const DefaultStory = (args) => { | ||
return ( | ||
<Box className="new-account"> | ||
<NewAccountImportForm {...args} /> | ||
</Box> | ||
); | ||
}; | ||
|
||
DefaultStory.storyName = 'Default'; |
Oops, something went wrong.