rm(Nilas-contact-elements): Remove unused package

This commit is contained in:
Ben Gotow 2016-02-01 18:51:38 -08:00
parent 06062fdfe8
commit ea5e8e0b9e
7 changed files with 0 additions and 140 deletions

View file

@ -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.*

View file

@ -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"
<span className={className} onClick={@_onClick}>
<span className="contact-name">{@_getParticipantDisplay()}</span>
</span>
_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

View file

@ -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) =>
<ContactChip key={p.toString()} clickable={@props.clickable} participant={p} />
<span>
{chips}
</span>
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

View file

@ -1,7 +0,0 @@
{ComponentRegistry} = require 'nylas-exports'
Participants = require './Participants'
module.exports =
activate: (state) ->
ComponentRegistry.register Participants,
role: 'Participants'

View file

@ -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
}

View file

@ -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;
}
}

View file

@ -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: -> <div></div>
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(
<ThreadList />
)