import { CompactCard } from '@automattic/components'; import { find, get } from 'lodash'; import { connect } from 'react-redux'; import { getCurrentUser } from 'calypso/state/current-user/selectors'; import SocialLoginActionButton from './action-button'; const SocialLoginService = ( { service, icon, isConnected, redirectUri, socialConnectionEmail, socialServiceResponse, } ) => (
{ icon }

{ service === 'github' ? 'GitHub' : service }

{ socialConnectionEmail &&

{ ' - ' + socialConnectionEmail }

}
); export default connect( ( state, { service } ) => { const currentUser = getCurrentUser( state ); const connections = currentUser.social_login_connections || []; const socialLoginConnection = find( connections, { service } ); return { isConnected: !! socialLoginConnection, socialConnectionEmail: get( socialLoginConnection, 'service_user_email', '' ), }; } )( SocialLoginService );