     height: @getHeight()
     isEnrollmentCodeValid: false
     isEnrollmentTargetPast: false
+    isCoursePast: false
 
   componentWillReceiveProps: (nextProps) ->
     @setState(height: @getHeight(nextProps)) if @props.isLaunching isnt nextProps.isLaunching


  setIsEnrollmentCodeValid: (eventChannel, data) ->
    if eventChannel.event is 'validated.failure'
      @setState(isEnrollmentTargetPast: includes(map(data, 'code'), 'course_ended'))
    else if eventChannel.event is 'validated.success'
      @props.setIsEnrollmentCodeValid?(true)
      @setState(isEnrollmentCodeValid: true)

  mixins: [UserStatusMixin]



  render: ->
    {isLaunching, defaultHeight} = @props
    {height, isEnrollmentCodeValid, isCoursePast} = @state
    user = @getUser()
    isEnrolled =  @isEnrolled()
    isLoggedIn = user.isLoggedIn()

    finePrint = if isEnrolled
      if isCoursePast
        <SemesterIsPast {...@props}/>
      else
        <SwitchSections {...@props}/>
