You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.3 KiB
73 lines
2.3 KiB
4 years ago
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
7 years ago
|
import {
|
||
|
ENVIRONMENT_TYPE_POPUP,
|
||
|
ENVIRONMENT_TYPE_NOTIFICATION,
|
||
4 years ago
|
} from '../../../../../shared/constants/app';
|
||
|
import { getEnvironmentType } from '../../../../../app/scripts/lib/util';
|
||
4 years ago
|
import NetworkDisplay from '../../network-display';
|
||
|
import Identicon from '../../../ui/identicon';
|
||
|
import { shortenAddress } from '../../../../helpers/utils/util';
|
||
|
import AccountMismatchWarning from '../../../ui/account-mismatch-warning/account-mismatch-warning.component';
|
||
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
||
7 years ago
|
|
||
4 years ago
|
export default function ConfirmPageContainerHeader({
|
||
5 years ago
|
onEdit,
|
||
|
showEdit,
|
||
|
accountAddress,
|
||
|
showAccountInHeader,
|
||
|
children,
|
||
|
}) {
|
||
4 years ago
|
const t = useI18nContext();
|
||
|
const windowType = getEnvironmentType();
|
||
4 years ago
|
const isFullScreen =
|
||
|
windowType !== ENVIRONMENT_TYPE_NOTIFICATION &&
|
||
4 years ago
|
windowType !== ENVIRONMENT_TYPE_POPUP;
|
||
7 years ago
|
|
||
5 years ago
|
if (!showEdit && isFullScreen) {
|
||
4 years ago
|
return children;
|
||
5 years ago
|
}
|
||
|
return (
|
||
|
<div className="confirm-page-container-header">
|
||
7 years ago
|
<div className="confirm-page-container-header__row">
|
||
4 years ago
|
{showAccountInHeader ? (
|
||
|
<div className="confirm-page-container-header__address-container">
|
||
|
<div className="confirm-page-container-header__address-identicon">
|
||
|
<Identicon address={accountAddress} diameter={24} />
|
||
4 years ago
|
</div>
|
||
4 years ago
|
<div className="confirm-page-container-header__address">
|
||
|
{shortenAddress(accountAddress)}
|
||
5 years ago
|
</div>
|
||
4 years ago
|
<AccountMismatchWarning address={accountAddress} />
|
||
|
</div>
|
||
|
) : (
|
||
|
<div
|
||
|
className="confirm-page-container-header__back-button-container"
|
||
|
style={{
|
||
|
visibility: showEdit ? 'initial' : 'hidden',
|
||
|
}}
|
||
|
>
|
||
4 years ago
|
<img src="/images/caret-left.svg" alt="" />
|
||
4 years ago
|
<span
|
||
|
className="confirm-page-container-header__back-button"
|
||
|
onClick={() => onEdit()}
|
||
|
>
|
||
|
{t('edit')}
|
||
|
</span>
|
||
|
</div>
|
||
|
)}
|
||
|
{!isFullScreen && <NetworkDisplay />}
|
||
7 years ago
|
</div>
|
||
4 years ago
|
{children}
|
||
5 years ago
|
</div>
|
||
4 years ago
|
);
|
||
5 years ago
|
}
|
||
7 years ago
|
|
||
5 years ago
|
ConfirmPageContainerHeader.propTypes = {
|
||
|
accountAddress: PropTypes.string,
|
||
|
showAccountInHeader: PropTypes.bool,
|
||
|
showEdit: PropTypes.bool,
|
||
|
onEdit: PropTypes.func,
|
||
|
children: PropTypes.node,
|
||
4 years ago
|
};
|