 React = require 'react'
 ROLES = require './roles'
 talkClient = require '../../api/talk'
-
-intersperse = (arr, item) ->
-  arr.reduce((acc, x, i) ->
-    if arr.length - 1 isnt i
-      acc.concat(x, item)
-    else
-      acc.concat(x)
-  , [])
 
 getUserRoleNames =  (user, section) ->
   talkClient.type('roles').get


      <textarea ref="boardDescription" placeholder="Board Description"></textarea><br />

      {if @state.mostPowerfulRole
        roleNames = @roleDisplayLabels(@state.mostPowerfulRole)
        <div>
          {roleRankText}
          <h4>Can Read:</h4>
          <span>Users of this status or lower will be able to read content in this board</span>
          <div className="roles-read">{roleNames.map(@roleReadLabel)}</div>

          <h4>Can Write:</h4>
          <span>Users of this status or lower will be able to post content in this board</span>
          <div className="roles-write">{roleNames.map(@roleWriteLabel)}</div>
        </div>
      }

      <button type="submit"><i className="fa fa-plus-circle" /> Create Board</button>
      {if @state.error

  .then (roles) ->
    roles.map (role) -> role.name

roleRankText =
  <span>
    Roles rank from most private to least private in the order: <strong>{ROLES.join(' > ')}</strong>
  </span>

module?.exports = React.createClass
