mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 06:07:06 +01:00
5802805597
Co-authored-by: Gregório Granado Magalhães <greg.magalhaes@gmail.com> Co-authored-by: George Marshall <georgewrmarshall@gmail.com> Co-authored-by: georgewrmarshall <george.marshall@consensys.net> Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com> Co-authored-by: brad-decker <bhdecker84@gmail.com>
70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
import React, { useContext } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import AccountListItem from '../../account-list-item';
|
|
import { I18nContext } from '../../../../contexts/i18n';
|
|
import Tooltip from '../../../ui/tooltip';
|
|
import InfoIcon from '../../../ui/icon/info-icon.component';
|
|
import { SEVERITIES } from '../../../../helpers/constants/design-system';
|
|
|
|
import PermissionsConnectHeader from '../../permissions-connect-header';
|
|
|
|
export default function SignatureRequestSIWEHeader({
|
|
fromAccount,
|
|
domain,
|
|
isSIWEDomainValid,
|
|
subjectMetadata,
|
|
}) {
|
|
const t = useContext(I18nContext);
|
|
|
|
return (
|
|
<div className="signature-request-siwe-header">
|
|
<PermissionsConnectHeader
|
|
iconUrl={subjectMetadata.iconUrl}
|
|
iconName={subjectMetadata.name}
|
|
headerTitle={t('SIWESiteRequestTitle')}
|
|
headerText={t('SIWESiteRequestSubtitle')}
|
|
siteOrigin={domain}
|
|
className={isSIWEDomainValid ? '' : 'bad-domain'}
|
|
rightIcon={
|
|
!isSIWEDomainValid && (
|
|
<Tooltip
|
|
position="bottom"
|
|
html={<p>{t('SIWEDomainWarningBody', [domain])}</p>}
|
|
wrapperClassName="signature-request-siwe-header__tooltip"
|
|
containerClassName="signature-request-siwe-header__tooltip__container"
|
|
>
|
|
<InfoIcon severity={SEVERITIES.DANGER} />
|
|
</Tooltip>
|
|
)
|
|
}
|
|
/>
|
|
{fromAccount && (
|
|
<AccountListItem
|
|
account={fromAccount}
|
|
className="signature-request-siwe-header__account-list-item"
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
SignatureRequestSIWEHeader.propTypes = {
|
|
/**
|
|
* The account that is requesting permissions
|
|
*/
|
|
fromAccount: PropTypes.object,
|
|
/**
|
|
* The domain that the request is for
|
|
*/
|
|
domain: PropTypes.string,
|
|
/**
|
|
* Whether the domain is valid
|
|
*/
|
|
isSIWEDomainValid: PropTypes.bool,
|
|
/**
|
|
* The metadata for the subject. This is used to display the icon and name
|
|
* and is selected from the domain in the SIWE request.
|
|
*/
|
|
subjectMetadata: PropTypes.object,
|
|
};
|