2022-01-25 18:48:41 +01:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
2023-01-20 16:14:40 +01:00
|
|
|
import {
|
|
|
|
HardwareKeyringNames,
|
|
|
|
HardwareKeyringTypes,
|
|
|
|
} from '../../../../shared/constants/hardware-wallets';
|
2022-01-25 18:48:41 +01:00
|
|
|
|
|
|
|
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) {
|
2023-01-20 16:14:40 +01:00
|
|
|
case HardwareKeyringTypes.qr:
|
|
|
|
label = HardwareKeyringNames.qr;
|
2022-01-25 18:48:41 +01:00
|
|
|
break;
|
2023-01-20 16:14:40 +01:00
|
|
|
case HardwareKeyringTypes.imported:
|
2022-01-25 18:48:41 +01:00
|
|
|
label = t('imported');
|
|
|
|
break;
|
2023-01-20 16:14:40 +01:00
|
|
|
case HardwareKeyringTypes.trezor:
|
|
|
|
label = HardwareKeyringNames.trezor;
|
2022-01-25 18:48:41 +01:00
|
|
|
break;
|
2023-01-20 16:14:40 +01:00
|
|
|
case HardwareKeyringTypes.ledger:
|
|
|
|
label = HardwareKeyringNames.ledger;
|
2022-01-25 18:48:41 +01:00
|
|
|
break;
|
2023-01-20 16:14:40 +01:00
|
|
|
case HardwareKeyringTypes.lattice:
|
|
|
|
label = HardwareKeyringNames.lattice;
|
2022-01-25 18:48:41 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>{label ? <div className="keyring-label allcaps">{label}</div> : null}</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
KeyRingLabel.propTypes = {
|
|
|
|
keyring: PropTypes.object,
|
|
|
|
};
|