2021-11-05 10:12:23 +01:00
|
|
|
/* eslint-disable no-negated-condition */
|
2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import Identicon from '../../../../ui/identicon';
|
2021-11-23 19:18:44 +01:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const ConfirmPageContainerSummary = (props) => {
|
2018-10-17 01:03:29 +02:00
|
|
|
const {
|
|
|
|
action,
|
|
|
|
title,
|
|
|
|
titleComponent,
|
|
|
|
subtitleComponent,
|
|
|
|
hideSubtitle,
|
|
|
|
className,
|
|
|
|
identiconAddress,
|
|
|
|
nonce,
|
2021-01-28 18:59:45 +01:00
|
|
|
origin,
|
2021-11-05 10:12:23 +01:00
|
|
|
hideTitle,
|
2022-01-10 17:23:53 +01:00
|
|
|
image,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = props;
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2022-01-10 17:23:53 +01:00
|
|
|
const renderImage = () => {
|
|
|
|
if (image) {
|
|
|
|
return (
|
|
|
|
<img
|
|
|
|
className="confirm-page-container-summary__icon"
|
|
|
|
width={36}
|
|
|
|
src={image}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
} else if (identiconAddress) {
|
|
|
|
return (
|
|
|
|
<Identicon
|
|
|
|
className="confirm-page-container-summary__icon"
|
|
|
|
diameter={36}
|
|
|
|
address={identiconAddress}
|
|
|
|
image={image}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
};
|
2021-11-29 17:08:24 +01:00
|
|
|
|
2018-06-23 08:52:45 +02:00
|
|
|
return (
|
|
|
|
<div className={classnames('confirm-page-container-summary', className)}>
|
2021-01-28 18:59:45 +01:00
|
|
|
{origin === 'metamask' ? null : (
|
|
|
|
<div className="confirm-page-container-summary__origin">{origin}</div>
|
|
|
|
)}
|
2018-06-23 08:52:45 +02:00
|
|
|
<div className="confirm-page-container-summary__action-row">
|
2020-11-03 00:41:28 +01:00
|
|
|
<div className="confirm-page-container-summary__action">{action}</div>
|
|
|
|
{nonce && (
|
|
|
|
<div className="confirm-page-container-summary__nonce">
|
|
|
|
{`#${nonce}`}
|
|
|
|
</div>
|
|
|
|
)}
|
2018-06-23 08:52:45 +02:00
|
|
|
</div>
|
2022-01-10 17:23:53 +01:00
|
|
|
<>
|
|
|
|
<div className="confirm-page-container-summary__title">
|
|
|
|
{renderImage()}
|
|
|
|
{!hideTitle ? (
|
|
|
|
<div className="confirm-page-container-summary__title-text">
|
|
|
|
{titleComponent || title}
|
|
|
|
</div>
|
|
|
|
) : null}
|
2020-11-03 00:41:28 +01:00
|
|
|
</div>
|
2022-01-10 17:23:53 +01:00
|
|
|
{hideSubtitle ? null : (
|
|
|
|
<div className="confirm-page-container-summary__subtitle">
|
|
|
|
{subtitleComponent}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</>
|
2018-06-23 08:52:45 +02:00
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
};
|
2018-06-23 08:52:45 +02:00
|
|
|
|
|
|
|
ConfirmPageContainerSummary.propTypes = {
|
|
|
|
action: PropTypes.string,
|
|
|
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
2022-01-10 17:23:53 +01:00
|
|
|
image: PropTypes.string,
|
2018-10-17 01:03:29 +02:00
|
|
|
titleComponent: PropTypes.node,
|
|
|
|
subtitleComponent: PropTypes.node,
|
2018-06-23 08:52:45 +02:00
|
|
|
hideSubtitle: PropTypes.bool,
|
|
|
|
className: PropTypes.string,
|
|
|
|
identiconAddress: PropTypes.string,
|
|
|
|
nonce: PropTypes.string,
|
2021-01-28 18:59:45 +01:00
|
|
|
origin: PropTypes.string.isRequired,
|
2021-11-05 10:12:23 +01:00
|
|
|
hideTitle: PropTypes.boolean,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export default ConfirmPageContainerSummary;
|