mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
|
import {
|
|
HardwareKeyringNames,
|
|
HardwareKeyringTypes,
|
|
} from '../../../../shared/constants/hardware-wallets';
|
|
|
|
export default function KeyRingLabel({ keyring }) {
|
|
const t = useI18nContext();
|
|
|
|
let label = null;
|
|
|
|
// Keyring value might take a while to get a value
|
|
if (!keyring) {
|
|
return null;
|
|
}
|
|
const { type } = keyring;
|
|
|
|
switch (type) {
|
|
case HardwareKeyringTypes.qr:
|
|
label = HardwareKeyringNames.qr;
|
|
break;
|
|
case HardwareKeyringTypes.imported:
|
|
label = t('imported');
|
|
break;
|
|
case HardwareKeyringTypes.trezor:
|
|
label = HardwareKeyringNames.trezor;
|
|
break;
|
|
case HardwareKeyringTypes.ledger:
|
|
label = HardwareKeyringNames.ledger;
|
|
break;
|
|
case HardwareKeyringTypes.lattice:
|
|
label = HardwareKeyringNames.lattice;
|
|
break;
|
|
default:
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<>{label ? <div className="keyring-label allcaps">{label}</div> : null}</>
|
|
);
|
|
}
|
|
|
|
KeyRingLabel.propTypes = {
|
|
keyring: PropTypes.object,
|
|
};
|