diff --git a/docs/React.md b/docs/React.md index 8d716770e..d8f80c6dc 100644 --- a/docs/React.md +++ b/docs/React.md @@ -73,13 +73,6 @@ Here are a few examples of how to use it to extend N1. Typically, packages regis role: 'Composer:ActionButton' ``` -3. Replace the `Participants` component that ships with N1 to display thread participants on your own: - - ```coffee - ComponentRegistry.register ParticipantsWithStatusDots, - role: 'Participants' - ``` - *Tip: Remember to unregister components in the `deactivate` method of your package.* diff --git a/internal_packages/inbox-contact-elements/lib/ContactChip.cjsx b/internal_packages/inbox-contact-elements/lib/ContactChip.cjsx deleted file mode 100644 index d2477e577..000000000 --- a/internal_packages/inbox-contact-elements/lib/ContactChip.cjsx +++ /dev/null @@ -1,39 +0,0 @@ -React = require "react" -{Actions} = require 'nylas-exports' -crypto = require "crypto" - -class ContactChip extends React.Component - @displayName: "ContactChip" - - render: => - className = "contact-chip" - if @props.clickable - className += " clickable" - - - {@_getParticipantDisplay()} - - - _onClick: => - return unless @props.clickable - clipboard = require('clipboard') - clipboard.writeText(@props.participant.email) - Actions.postNotification({message: "Copied #{@props.participant.email} to clipboard", type: 'success'}) - - _getParticipantDisplay: => - @props.participant.displayName() - - shouldComponentUpdate: (newProps, newState) => - (newProps.participant?.email != @props.participant?.email) || - (newProps.participant?.name != @props.participant?.name) - - componentWillMount: => - email = @props.participant.email.toLowerCase() - @md5 = crypto.createHash('md5').update(email).digest('hex') - - nameMD5 = crypto.createHash('md5').update(email + @props.participant.name).digest('hex') - n = Math.floor(parseInt(nameMD5.slice(0, 2), 16) * 360/256) - @bg = "hsl(#{n}, 50%, 50%)" - - -module.exports = ContactChip diff --git a/internal_packages/inbox-contact-elements/lib/Participants.cjsx b/internal_packages/inbox-contact-elements/lib/Participants.cjsx deleted file mode 100644 index 0599ee446..000000000 --- a/internal_packages/inbox-contact-elements/lib/Participants.cjsx +++ /dev/null @@ -1,41 +0,0 @@ -React = require "react" -_ = require "underscore" -ContactChip = require './ContactChip' - -# Parameters -# clickable (optional) - is this currently clickable? -# thread (optional) - thread context for sorting -# passed into the ParticipantChip -# - 'primary' -# - 'list' - -class Participants extends React.Component - @displayName: "Participants" - - @containerRequired: false - - render: => - chips = @getParticipants().map (p) => - - - - {chips} - - - getParticipants: => - list = @props.participants - - # Remove 'Me' if there is more than one participant - if list.length > 1 - list = _.reject list, (contact) -> contact.isMe() - - list.forEach (p) -> - p.serverId ?= p.name+p.email - - list - - shouldComponentUpdate: (newProps, newState) => - !_.isEqual(newProps.participants, @props.participants) - - -module.exports = Participants diff --git a/internal_packages/inbox-contact-elements/lib/main.coffee b/internal_packages/inbox-contact-elements/lib/main.coffee deleted file mode 100644 index a43a806c1..000000000 --- a/internal_packages/inbox-contact-elements/lib/main.coffee +++ /dev/null @@ -1,7 +0,0 @@ -{ComponentRegistry} = require 'nylas-exports' -Participants = require './Participants' - -module.exports = - activate: (state) -> - ComponentRegistry.register Participants, - role: 'Participants' diff --git a/internal_packages/inbox-contact-elements/package.json b/internal_packages/inbox-contact-elements/package.json deleted file mode 100644 index 1678d449c..000000000 --- a/internal_packages/inbox-contact-elements/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "inbox-contact-elements", - "version": "0.0.1", - "description": "Contact React Elements", - "main": "./lib/main", - "license": "GPL-3.0", - "engines": { - "nylas": "*" - }, - "private": true -} diff --git a/internal_packages/inbox-contact-elements/stylesheets/inbox-participants.less b/internal_packages/inbox-contact-elements/stylesheets/inbox-participants.less deleted file mode 100644 index 91156e8ed..000000000 --- a/internal_packages/inbox-contact-elements/stylesheets/inbox-participants.less +++ /dev/null @@ -1,28 +0,0 @@ -@import "ui-variables"; -@import "ui-mixins"; - -.contact-chip { - padding-right: 6px; - white-space: nowrap; - - .contact-img { - border-radius: 50%; - margin-top: -2px; - margin-right: 3px; - height: 14px; - width: 14px; - } -} - -.contact-chip.clickable:hover { - cursor: pointer; - border-radius: 9px; - background: darken(@background-secondary, 10%); -} - -.contact-chip:not(:last-child) { - &:after { - content: ','; - display: inline; - } -} diff --git a/internal_packages/thread-list/spec/thread-list-spec.cjsx b/internal_packages/thread-list/spec/thread-list-spec.cjsx index b008bbee5..bfc62a397 100644 --- a/internal_packages/thread-list/spec/thread-list-spec.cjsx +++ b/internal_packages/thread-list/spec/thread-list-spec.cjsx @@ -31,9 +31,6 @@ ReactTestUtils = _.extend ReactTestUtils, require "jasmine-react-helpers" ThreadStore = require "../lib/thread-store" ThreadList = require "../lib/thread-list" -ParticipantsItem = React.createClass - render: ->
- test_threads = -> [ (new Thread).fromJSON({ "id": "111", @@ -221,10 +218,6 @@ describe "ThreadList", -> ThreadStore._resetInstanceVars() - ComponentRegistry.register - name: 'Participants' - view: ParticipantsItem - @thread_list = ReactTestUtils.renderIntoDocument( )