 projectSection = require '../talk/lib/project-section'
 parseSection = require '../talk/lib/parse-section'
 QuickSubjectCommentForm= require '../talk/quick-subject-comment-form'
-{Navigation} = require 'react-router'
+{Navigation, Link} = require 'react-router'
 {Markdown} = require 'markdownz'
 alert = require '../lib/alert'
 SignInPrompt = require '../partials/sign-in-prompt'

      [owner, name] = project.slug.split('/')
      @transitionTo('project-talk-discussion', {owner: owner, name: name, board: discussion.board_id, discussion: discussion.id})

  render: ->
    {subject} = @state


          }</PromiseRenderer>

          {if @props.user
            {# TODO remove subject.get('project'), replace with params but browser freezes on get to projects with slug}
            project = subject.get('project')
            boards = project.then (project) -> talkClient.type('boards').get(section: projectSection(project), subject_default: false)
            subjectDefaultBoard = project.then (project) -> talkClient.type('boards').get(section: projectSection(project), subject_default: true)

            <PromiseRenderer promise={Promise.all([boards, subjectDefaultBoard])}>{([boards, subjectDefaultBoard]) =>
              defaultExists = subjectDefaultBoard.length
              if boards.length or defaultExists
                <div>
                  <div className="tabbed-content">
                    <div className="tabbed-content-tabs">
                      <div className="subject-page-tabs">
                        <div className="tabbed-content-tab #{if @state.tab is 0 then 'active' else ''}" onClick={=> @setState({tab: 0})}>
                          <span>Add a note about this subject</span>
                        </div>

                        <div className="tabbed-content-tab #{if @state.tab is 1 then 'active' else ''}" onClick={=> @setState({tab: 1})}>
                          <span>Start a new discussion</span>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div>
                    {if @state.tab is 0
                      if defaultExists
                        <QuickSubjectCommentForm subject={subject} user={@props.user} />
                      else
                        <p>
                          There is no default board for subject comments setup yet, Please{' '}
                          <button className="link-style" onClick={=> @setState(tab: 1)}>start a new discussion</button>{' '}
                          or {@linkToClassifier('return to classifying')}
                        </p>
                     else if @state.tab is 1
                      <NewDiscussionForm
                        user={@props.user}
                        subject={subject}
                        onCreateDiscussion={@onCreateDiscussion} />
                        }
                  </div>
                </div>
              else
                <p>There are no discussion boards setup for this project yet. Check back soon!</p>
            }</PromiseRenderer>
          else
            <p>Please <button className="link-style" type="button" onClick={promptToSignIn}>sign in</button> to contribute to subject discussions</p>}
