import React from 'react'; import PropTypes from 'prop-types'; import Dropdown from '../../ui/dropdown'; import Box from '../../ui/box'; import { Color } from '../../../helpers/constants/design-system'; import { Text } from '../../component-library'; import { useI18nContext } from '../../../hooks/useI18nContext'; const JwtDropdown = (props) => { const t = useI18nContext(); const { currentJwt, jwtList } = props; return ( {t('selectJWT')} item === currentJwt) ? [] : [ { value: currentJwt, name: currentJwt.length > 9 ? `...${currentJwt.slice(-9)}` : currentJwt, }, ]), ...jwtList.map((text) => { return { value: text, name: `...${text?.slice(-9)}`, }; }), ]} onChange={(opt) => props.onChange(opt.value)} /> ); }; JwtDropdown.propTypes = { jwtList: PropTypes.array, currentJwt: PropTypes.string, onChange: PropTypes.func, }; export default JwtDropdown;