import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Button from '../../ui/button'; import SiteIcon from '../../ui/site-icon'; import { stripHttpsSchemeWithoutPort } from '../../../helpers/utils/util'; import SiteOrigin from '../../ui/site-origin'; export default class ConnectedSitesList extends Component { static contextTypes = { t: PropTypes.func, }; static propTypes = { connectedSubjects: PropTypes.arrayOf( PropTypes.shape({ name: PropTypes.string, iconUrl: PropTypes.string, origin: PropTypes.string, }), ).isRequired, onDisconnect: PropTypes.func.isRequired, }; render() { const { connectedSubjects, onDisconnect } = this.props; const { t } = this.context; return (
{connectedSubjects.map((subject) => (
))}
); } getSubjectDisplayName(subject) { if (subject.extensionId) { return this.context.t('externalExtension'); } // We strip https schemes only, and only if the URL has no port. return stripHttpsSchemeWithoutPort(subject.origin); } }