// first login form seen by the user when starting the app

import '../../css/pane'
import '../../css/login/start-up-form'

import React, { PropTypes } from 'react'
import { Link } from 'react-router'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'

import actions from './../../actions'
import CorpusList from './CorpusList'

const StartUpForm = (props) => {

  return (
    <form className="start-up-form">
      <h2 className="pane-centered-title">Welcome to Hyphe</h2>

      <div className="form-group">
        <select
          className="form-control server-list"
          onChange={ (evt) => props.actions.fetchCorpora(evt.target.value) }
        >
          <option>Please select a server instance</option>
          { props.servers.map((server) =>
            <option key={ server.url } value={ server.url }>{ server.name }</option>
          ) }
        </select>
      </div>
      <div className="form-group">
        <Link className="btn btn-primary" to="/login/server-form">Add server</Link>
      </div>

      <hr />

      { props.ui.loaders.corpora
        ? <span>Loading corpora…</span>
        : <CorpusList actions={ props.actions } corpora={ props.corpora } />
      }
    </form>
  )

}

StartUpForm.propTypes = {
  corpora: PropTypes.object.isRequired,
  servers: PropTypes.array.isRequired,
  ui: PropTypes.object.isRequired
}

const mapStateToProps = (state) => ({
  corpora: state.corpora.list,
  servers: state.servers.list,
  ui: state.ui
})

const mapDispatchToProps = (dispatch) => ({
  actions: bindActionCreators(actions, dispatch)
})

const connectedStartUpForm = connect(mapStateToProps, mapDispatchToProps)(StartUpForm)

export default connectedStartUpForm

@@ -353,16 +353,69 @@
 sList'%0A%0A
+import %7B FormattedMessage as T %7D from 'react-intl'%0A%0A%0A
 const St
@@ -534,24 +534,26 @@
 le%22%3E
-Welcome to Hyphe
+%3CT id=%22welcome%22 /%3E
 %3C/h2
@@ -762,39 +762,32 @@
 ion%3E
-Please 
+%3CT id=%22
 select
- a 
+-
 server
- instance
+%22 /%3E
 %3C/op
@@ -1069,18 +1069,29 @@
 rm%22%3E
-Add 
+%3CT id=%22add-
 server
+%22 /%3E
 %3C/Li
@@ -1175,24 +1175,34 @@
 pan%3E
-L
+%3CT id=%22l
 oading
- 
+-
 corpora
-%E2%80%A6
+%22 /%3E
 %3C/sp

Translate StartupForm