_ = require 'underscore-plus'
React = require "react"
SidebarFullContactChip = require "./sidebar-fullcontact-chip.cjsx"
{Actions} = require 'inbox-exports'
module.exports =
SidebarFullContactDetails = React.createClass
render: ->
keys = Object.keys @props.data
status = @props.data?.status
if keys.length > 0 and status is 200
{@_makeHeader()}
{@_makeProfiles()}
else
_makeHeader: ->
{@props.data.contactInfo?.fullName}
{@_getBio()}
{@props.data.demographics?.locationGeneral}
{@props.email}
_makeProfiles: ->
{@_getSocialProfiles()}
_getProfilePhoto: ->
photos = @props.data.photos
url = ''
for photo in photos
if photo.typeId == 'linkedin'
return photo.url
else if photo.typeId == 'gravatar'
return photo.url
else if photo.typeId == 'facbook'
return photo.url
else
url = photo.url
return url
_getBio: ->
@socialData = {}
for profile in @props.data.socialProfiles
@socialData[profile.typeId] = profile
if @socialData.linkedin?
return {@socialData.linkedin.bio}
return
_getSocialProfiles: ->
rankedProfiles = ['linkedin', 'aboutme', 'twitter', 'googleplus',
'facebook', 'angellist', 'flickr', 'foursquare',
'github', 'bitbucket', 'goodreads', 'dribbble',
'hackernews', 'klout', 'lastfm', 'pinterest',
'quora', 'skype', 'soundcloud', 'stackoverflow',
'tripit', 'youtube', 'wordpress']
body = []
for profile in rankedProfiles
if @socialData[profile]?
if @socialData[profile].url?
body.push
for k,v of @socialData
if k not in rankedProfiles
if v.url?
body.push
return body