Skip to content

Commit

Permalink
show on wallet and connections view
Browse files Browse the repository at this point in the history
  • Loading branch information
NidhiKJha committed Sep 7, 2023
1 parent 5dfd904 commit da47dee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
38 changes: 9 additions & 29 deletions ui/pages/routes/routes.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export default class Routes extends Component {
theme: PropTypes.string,
sendStage: PropTypes.string,
isNetworkUsed: PropTypes.bool,
unapprovedTransactions: PropTypes.object,
allAccountsOnNetworkAreEmpty: PropTypes.bool,
isTestNet: PropTypes.bool,
currentChainId: PropTypes.string,
Expand Down Expand Up @@ -473,37 +472,18 @@ export default class Routes extends Component {
return isHandlingPermissionsRequest || isHandlingAddEthereumChainRequest;
}

hideFooter() {
const { location, sendStage, unapprovedTransactions } = this.props;
const isTransactionEditPage = [
SEND_STAGES.EDIT,
SEND_STAGES.DRAFT,
SEND_STAGES.ADD_RECIPIENT,
].includes(sendStage);
const isConfirmationPage = Boolean(
matchPath(location.pathname, {
path: CONFIRM_TRANSACTION_ROUTE,
exact: false,
}),
);
const isSwapsPage = Boolean(
matchPath(location.pathname, { path: SWAPS_ROUTE, exact: false }),
showFooter() {
const { location } = this.props;
const isHomePage = Boolean(
matchPath(location.pathname, { path: DEFAULT_ROUTE, exact: true }),
);
const isSwapsBuildQuotePage = Boolean(
matchPath(location.pathname, { path: BUILD_QUOTE_ROUTE, exact: false }),
const isConnectionsPage = Boolean(
matchPath(location.pathname, { path: CONNECTIONS, exact: true }),
);

const hasUnapprovedTransactions =
Object.keys(unapprovedTransactions).length > 0;

const hideFooterOnPages =
isSwapsPage ||
isTransactionEditPage ||
isConfirmationPage ||
isSwapsBuildQuotePage ||
hasUnapprovedTransactions;
const showFooterOnPages = isHomePage || isConnectionsPage;

return hideFooterOnPages;
return showFooterOnPages;
}

showOnboardingHeader() {
Expand Down Expand Up @@ -633,7 +613,7 @@ export default class Routes extends Component {
{!isLoading && isNetworkLoading ? <LoadingNetwork /> : null}
{this.renderRoutes()}
</Box>
{!this.hideFooter() && <AppFooter location={location} />}
{this.showFooter() && <AppFooter location={location} />}
{isUnlocked ? <Alerts history={this.props.history} /> : null}
</div>
);
Expand Down
2 changes: 0 additions & 2 deletions ui/pages/routes/routes.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
getCurrentChainId,
getShouldShowSeedPhraseReminder,
isCurrentProviderCustom,
getUnapprovedTransactions,
} from '../../selectors';
import {
lockMetamask,
Expand Down Expand Up @@ -60,7 +59,6 @@ function mapStateToProps(state) {
isNetworkUsed: getIsNetworkUsed(state),
allAccountsOnNetworkAreEmpty: getAllAccountsOnNetworkAreEmpty(state),
isTestNet: getIsTestnet(state),
unapprovedTransactions: getUnapprovedTransactions(state),
currentChainId: getCurrentChainId(state),
shouldShowSeedPhraseReminder: getShouldShowSeedPhraseReminder(state),
forgottenPassword: state.metamask.forgottenPassword,
Expand Down

0 comments on commit da47dee

Please sign in to comment.