     subject: React.PropTypes.object # a subject response from panoptes
     project: React.PropTypes.object # a project response from panoptes
     user: React.PropTypes.object
+    isFavorite: React.PropTypes.bool
 
   getDefaultProps: ->
     subject: null
     project: null
     user: null
+    isFavorite: false
 
   getInitialState: ->
     favorites: null

    collection.removeLink('subjects', [@props.subject.id.toString()])

  createFavorites: ->
    display_name = getFavoritesName(@props.project)
    project = @props.project?.id
    subjects = [@props.subject.id]
    favorite = true

    links = {subjects}
    links.projects = [ project ] if project?
    collection = {favorite, display_name, links}

    @setState favorited: true
    apiClient.type('collections').create(collection).save()

  toggleFavorite: ->
    if @props.user?
      if not @state.favorites?
        @createFavorites()
        @logSubjLike 'favorite'
      else if @state.favorited
        @removeSubjectFrom(@state.favorites)

      Promise.resolve false

  componentWillMount: ->
    favorited = @props.isFavorite
    @setState {favorited}


  componentDidUpdate: (prevProps) ->
    if prevProps.subject isnt @props.subject
      favorited = @props.isFavorite
      @setState {favorited}

  addSubjectTo: (collection) ->
    @setState favorited: true
