From 34f1ca0ba8573357b3da13ef785b0b9c9513b8fc Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Wed, 4 May 2016 14:41:13 -0700 Subject: [PATCH] rm(fullcontact): Deprecated in favor of new contact sidebar --- .../lib/fullcontact-store.coffee | 41 ------ .../sidebar-fullcontact/lib/main.cjsx | 16 --- .../lib/sidebar-fullcontact-details.cjsx | 132 ------------------ .../lib/sidebar-fullcontact.cjsx | 37 ----- .../sidebar-fullcontact/package.json | 13 -- .../stylesheets/sidebar-fullcontact.less | 72 ---------- 6 files changed, 311 deletions(-) delete mode 100644 internal_packages/sidebar-fullcontact/lib/fullcontact-store.coffee delete mode 100644 internal_packages/sidebar-fullcontact/lib/main.cjsx delete mode 100644 internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact-details.cjsx delete mode 100644 internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact.cjsx delete mode 100755 internal_packages/sidebar-fullcontact/package.json delete mode 100644 internal_packages/sidebar-fullcontact/stylesheets/sidebar-fullcontact.less diff --git a/internal_packages/sidebar-fullcontact/lib/fullcontact-store.coffee b/internal_packages/sidebar-fullcontact/lib/fullcontact-store.coffee deleted file mode 100644 index 0d45b7dea..000000000 --- a/internal_packages/sidebar-fullcontact/lib/fullcontact-store.coffee +++ /dev/null @@ -1,41 +0,0 @@ -_ = require 'underscore' -Reflux = require 'reflux' -request = require 'request' -{Contact, - AccountStore - ContactStore, - DatabaseStore, - FocusedContactsStore} = require 'nylas-exports' - -FullContactStore = Reflux.createStore - init: -> - - dataForContact: (contact) -> - return {} unless contact - if contact.thirdPartyData["FullContact"] - return contact.thirdPartyData["FullContact"] - else - @_attachFullcontactDataToContact(contact) - return {} - - _attachFullcontactDataToContact: (contact) -> - email = contact.email.toLowerCase().trim() - return if email.length is 0 - - url = "https://api.fullcontact.com/v2/person.json?email=#{email}&apiKey=eadcbaf0286562a" - request url, (err, resp, data) => - return if err - return if resp.statusCode != 200 - try - data = JSON.parse(data) - contact.title = data.organizations?[0]?["title"] - contact.company = data.organizations?[0]?["name"] - contact.thirdPartyData ?= {} - contact.thirdPartyData["FullContact"] = data - - DatabaseStore.inTransaction (t) => - t.persistModel(contact) - .then => - @trigger() - -module.exports = FullContactStore diff --git a/internal_packages/sidebar-fullcontact/lib/main.cjsx b/internal_packages/sidebar-fullcontact/lib/main.cjsx deleted file mode 100644 index fbd4080dd..000000000 --- a/internal_packages/sidebar-fullcontact/lib/main.cjsx +++ /dev/null @@ -1,16 +0,0 @@ -_ = require 'underscore' -React = require "react" -SidebarFullContact = require "./sidebar-fullcontact" -{ComponentRegistry, WorkspaceStore} = require "nylas-exports" - -module.exports = - item: null - - activate: (@state={}) -> - # ComponentRegistry.register SidebarFullContact, - # role: "MessageListSidebar:ContactCard" - - deactivate: -> - # ComponentRegistry.unregister(SidebarFullContact) - - serialize: -> @state diff --git a/internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact-details.cjsx b/internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact-details.cjsx deleted file mode 100644 index 9bb5e7e4f..000000000 --- a/internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact-details.cjsx +++ /dev/null @@ -1,132 +0,0 @@ -_ = require 'underscore' -React = require "react" - -{Actions} = require 'nylas-exports' -{RetinaImg} = require 'nylas-component-kit' - -class SidebarFullContactDetails extends React.Component - @displayName: "SidebarFullContactDetails" - - @propTypes: - contact: React.PropTypes.object - fullContactData: React.PropTypes.object - - render: => -
-
- {@_profilePhoto()} -

{@_name()}

-
{@_email()}
-
-
-
{@_title()}
-
{@_company()}
-
-
- {@_socialProfiles()} -
- {@_noInfo()} -
- - _socialProfiles: => - profiles = @_profiles() - return profiles.map (profile) => -
- -
- {@_username(profile)} - {@_twitterBio(profile)} -
-
- - _profiles: => - profiles = @props.fullContactData.socialProfiles ? [] - profiles = _.filter profiles, (p) => @_supportedProfileTypes[p.typeId] - - _supportedProfileTypes: - twitter: true - linkedin: true - facebook: true - - _showSocialProfiles: => - @_profiles().length > 0 - - _username: (profile) => - if (profile.username ? "").length > 0 - if profile.typeId is "twitter" - return "@#{profile.username}" - else - return profile.username - else - return profile.typeName - - _noInfo: => - if not @_showSocialProfiles() and not @_showSubheader() -
No additional information available.
- else return "" - - _twitterBio: (profile) => - return "" unless profile.typeId is "twitter" - return "" unless profile.bio?.length > 0 - - # http://stackoverflow.com/a/13398311/793472 - twitterRegex = /(^|[^@\w])@(\w{1,15})\b/g - replace = '$1@$2' - bio = profile.bio.replace(twitterRegex, replace) -
- - _showSubheader: => - @_title().length > 0 or @_company().length > 0 - - _name: => - (@props.fullContactData.contactInfo?.fullName) ? @props.contact?.name ? "" - - _email: => - email = @props.contact.email ? "" - if @_name().toLowerCase().trim() isnt email.toLowerCase().trim() - return email - else return "" - - _title: => - org = @_primaryOrg() - return "" unless org? - if org.current and org.title? - return org.title - else if not org.current and org.title? - return "Former #{org.title}" - else return "" - - _company: => - location = @props.fullContactData.demographics?.locationGeneral ? "" - name = @_primaryOrg()?.name ? "" - if name.length > 0 and location.length > 0 - return "#{name} (#{location})" - else if name.length > 0 - return name - else if location.length > 0 - return "(#{location})" - else return "" - - _primaryOrg: => - orgs = @props.fullContactData.organizations ? [] - org = _.findWhere orgs, isPrimary: true - if not org? then org = orgs[0] - return org - - _profilePhoto: => - photos = @props.fullContactData.photos ? [] - photo = _.findWhere photo, isPrimary: true - if not photo? then photo = _.findWhere photo, typeId: "linkedin" - if not photo? then photo = photos[0] - if photo? and photo.url? - return - else return "" - - -module.exports = SidebarFullContactDetails diff --git a/internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact.cjsx b/internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact.cjsx deleted file mode 100644 index 1ed5d46d8..000000000 --- a/internal_packages/sidebar-fullcontact/lib/sidebar-fullcontact.cjsx +++ /dev/null @@ -1,37 +0,0 @@ -_ = require 'underscore' -React = require "react" -ReactCSSTransitionGroup = require 'react-addons-css-transition-group' -FullContactStore = require "./fullcontact-store" - -{InjectedComponentSet} = require 'nylas-component-kit' - -SidebarFullContactDetails = require "./sidebar-fullcontact-details" - -class SidebarFullContact extends React.Component - @displayName: "SidebarFullContact" - - @propTypes: - contact: React.PropTypes.object - - constructor: (@props) -> - @state = @_getStateFromStores() - - componentDidMount: => - @unsubscribe = FullContactStore.listen(@_onChange) - - componentWillUnmount: => - @unsubscribe() - - render: => - - - _onChange: => - @setState(@_getStateFromStores()) - - _getStateFromStores: => - focusedContactData: FullContactStore.dataForContact(@props.contact) - - -module.exports = SidebarFullContact diff --git a/internal_packages/sidebar-fullcontact/package.json b/internal_packages/sidebar-fullcontact/package.json deleted file mode 100755 index d5aa0c1e8..000000000 --- a/internal_packages/sidebar-fullcontact/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "sidebar-fullcontact", - "version": "0.1.0", - "main": "./lib/main", - "description": "View user data on the sidebar via fullcontact", - "license": "GPL-3.0", - "private": true, - "engines": { - "nylas": "*" - }, - "dependencies": { - } -} diff --git a/internal_packages/sidebar-fullcontact/stylesheets/sidebar-fullcontact.less b/internal_packages/sidebar-fullcontact/stylesheets/sidebar-fullcontact.less deleted file mode 100644 index 933665375..000000000 --- a/internal_packages/sidebar-fullcontact/stylesheets/sidebar-fullcontact.less +++ /dev/null @@ -1,72 +0,0 @@ -@import "ui-variables"; - -.contact-card-fullcontact { - padding-bottom: 0; - order: 1; - flex-shrink: 0; - - color: @text-color; - -webkit-user-select:text; - img.content-mask { background-color: @text-color; } - - h1.name { - font-size: 20px; - font-weight: @font-weight-normal; - margin: 0; - padding: 0.6em 0 0.4em 0; - text-overflow: ellipsis; - overflow: hidden; - } - - .profile-photo { - max-width: 42px; - max-height: 42px; - display: block; - float: right; - margin-left: @spacing-standard; - } - - .header { - &:before, &:after { content: " "; display: table; } - &:after { clear: both; } - } - - .subheader { - color: @text-color-subtle; - padding: 0 0 @spacing-standard 0; - font-size: @font-size-smaller; - } - - .email { - word-break: break-all; - } -} - -.social-profiles { - border-top: 1px solid @border-color-divider; - padding-top: 7px; -} -.social-profile { - margin-top: 0.5em; - .social-icon { - margin-top: 6px; - float: left; - } - .social-link { - padding-left: @spacing-double; - font-size: @font-size-smaller; - a { - text-decoration: none; - } - } -} - -.sidebar-extra-info { - font-size: 12px; - font-weight: @font-weight-medium; - color: @text-color-subtle; -} -.sidebar-no-info { - font-size: @font-size-smaller; - color: fade(@text-color, 30%); -}