 Wrapper = require './wrapper'
 Error = require './error'
 
+PREFIX = 'lo'
 {ExerciseActions, ExerciseStore} = require '../../stores/exercise'
 
 LoTagInput = React.createClass

    {value} = @state
    if value.match(/^\d+-\d+-\d+$/)
      ExerciseActions.setPrefixedTag(@props.exerciseId,
        prefix: 'lo', tag: value, previous: @props.tag
      )
    else
      @setState({errorMsg: 'Must match LO format'})

    exerciseId: React.PropTypes.string.isRequired

  add: ->
    ExerciseActions.addBlankPrefixedTag(@props.exerciseId, prefix: PREFIX)

  render: ->
    tags = ExerciseStore.getTagsWithPrefix(@props.exerciseId, PREFIX)

    <Wrapper label="LO" onAdd={@add}>
      {for tag in tags
