mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Move home notifications upwards in DOM (#8138)
The notifications displayed on the home screen were being passed through the `TransactionView` and `TransactionList` components before being rendered. This was unnecessary because the notifications are absolutely positioned. They are now rendered directly in the home component where they're defined. A helper function has been written to improve readability.
This commit is contained in:
parent
f4c279e6ff
commit
fa3497e39b
@ -10,13 +10,11 @@ export default class TransactionList extends PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
children: null,
|
|
||||||
pendingTransactions: [],
|
pendingTransactions: [],
|
||||||
completedTransactions: [],
|
completedTransactions: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
children: PropTypes.node,
|
|
||||||
pendingTransactions: PropTypes.array,
|
pendingTransactions: PropTypes.array,
|
||||||
completedTransactions: PropTypes.array,
|
completedTransactions: PropTypes.array,
|
||||||
selectedToken: PropTypes.object,
|
selectedToken: PropTypes.object,
|
||||||
@ -155,7 +153,6 @@ export default class TransactionList extends PureComponent {
|
|||||||
return (
|
return (
|
||||||
<div className="transaction-list">
|
<div className="transaction-list">
|
||||||
{ this.renderTransactions() }
|
{ this.renderTransactions() }
|
||||||
{ this.props.children }
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,6 @@ export default class TransactionView extends PureComponent {
|
|||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
}
|
|
||||||
|
|
||||||
static defaultProps = {
|
|
||||||
children: null,
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<div className="transaction-view">
|
<div className="transaction-view">
|
||||||
@ -28,9 +20,7 @@ export default class TransactionView extends PureComponent {
|
|||||||
<div className="transaction-view__balance-wrapper">
|
<div className="transaction-view__balance-wrapper">
|
||||||
<TransactionViewBalance />
|
<TransactionViewBalance />
|
||||||
</div>
|
</div>
|
||||||
<TransactionList>
|
<TransactionList />
|
||||||
{ this.props.children }
|
|
||||||
</TransactionList>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,9 @@ export default class Home extends PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
renderNotifications () {
|
||||||
const { t } = this.context
|
const { t } = this.context
|
||||||
const {
|
const {
|
||||||
forgottenPassword,
|
|
||||||
history,
|
history,
|
||||||
hasDaiV1Token,
|
hasDaiV1Token,
|
||||||
shouldShowSeedPhraseReminder,
|
shouldShowSeedPhraseReminder,
|
||||||
@ -101,20 +100,7 @@ export default class Home extends PureComponent {
|
|||||||
threeBoxLastUpdated,
|
threeBoxLastUpdated,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
if (forgottenPassword) {
|
|
||||||
return <Redirect to={{ pathname: RESTORE_VAULT_ROUTE }} />
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="main-container">
|
|
||||||
<div className="home__container">
|
|
||||||
<Media
|
|
||||||
query="(min-width: 576px)"
|
|
||||||
render={() => <WalletView />}
|
|
||||||
/>
|
|
||||||
{ !history.location.pathname.match(/^\/confirm-transaction/)
|
|
||||||
? (
|
|
||||||
<TransactionView>
|
|
||||||
<MultipleNotifications>
|
<MultipleNotifications>
|
||||||
{
|
{
|
||||||
shouldShowSeedPhraseReminder
|
shouldShowSeedPhraseReminder
|
||||||
@ -163,9 +149,32 @@ export default class Home extends PureComponent {
|
|||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
</MultipleNotifications>
|
</MultipleNotifications>
|
||||||
</TransactionView>
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const {
|
||||||
|
forgottenPassword,
|
||||||
|
history,
|
||||||
|
} = this.props
|
||||||
|
|
||||||
|
if (forgottenPassword) {
|
||||||
|
return <Redirect to={{ pathname: RESTORE_VAULT_ROUTE }} />
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="main-container">
|
||||||
|
<div className="home__container">
|
||||||
|
<Media
|
||||||
|
query="(min-width: 576px)"
|
||||||
|
render={() => <WalletView />}
|
||||||
|
/>
|
||||||
|
{ !history.location.pathname.match(/^\/confirm-transaction/)
|
||||||
|
? (
|
||||||
|
<TransactionView />
|
||||||
)
|
)
|
||||||
: null }
|
: null }
|
||||||
|
{ this.renderNotifications() }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user