import classnames from 'classnames'; import PropTypes from 'prop-types'; import React, { useState } from 'react'; import { flatten } from 'lodash'; import CheckBox from '../../ui/check-box'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { getPermissionDescription } from '../../../helpers/utils/permission'; const ConnectedAccountsPermissions = ({ permissions }) => { const t = useI18nContext(); const [expanded, setExpanded] = useState(false); const toggleExpanded = () => { setExpanded((_expanded) => !_expanded); }; if (!permissions.length) { return null; } const permissionLabels = flatten( permissions.map(({ key, value }) => getPermissionDescription(t, key, value), ), ); return (

{t('permissions')}

); }; ConnectedAccountsPermissions.propTypes = { permissions: PropTypes.arrayOf( PropTypes.shape({ key: PropTypes.string.isRequired, }), ), }; ConnectedAccountsPermissions.defaultProps = { permissions: [], }; ConnectedAccountsPermissions.displayName = 'ConnectedAccountsPermissions'; export default React.memo(ConnectedAccountsPermissions);