     settings: 'Settings'
     collaborators: 'Collaborators'
     talk: 'Talk'
-    loading: 'Loading'
+  collectionsPageWrapper:
+    error: 'There was an error retrieving this collection.'
 
 CollectionPage = React.createClass
   displayName: 'CollectionPage'

Translate = require 'react-translate-component'
counterpart = require 'counterpart'
Avatar = require '../partials/avatar'
auth = require '../api/auth'
LoadingIndicator = require '../components/loading-indicator'
HandlePropChanges = require '../lib/handle-prop-changes'
TitleMixin = require '../lib/title-mixin'



  getInitialState: ->
    collection: null
    user: null
    roles: null
    error: false
    loading: false

  propChangeHandlers:
    'params.owner': 'fetchCollection'
    'params.name': 'fetchCollection'

  fetchCollection: ->
    @setState loading: true

    auth.checkCurrent().then (user) =>
      apiClient.type('collections')
        .get(owner: @props.params?.owner, slug: @props.params?.name, include: 'owner')
        .then ([collection]) =>
          unless collection then @setState error: true

          apiClient.type('collection_roles')
            .get(collection_id: collection.id)
            .then (roles) =>
              @setState
                collection: collection
                user: user
                roles: roles
        .catch =>
          @setState error: true
        .then =>
          @setState loading: false

  componentDidMount: ->
    auth.listen 'change', @fetchCollection
