import React from "react"

import IdeaGenerationLowerThirdContent from "./idea_generation_lower_third_content"
import VotingLowerThirdContent from "./voting_lower_third_content"
import LowerThirdAnimationWrapper from "./lower_third_animation_wrapper"
import stageConfigs from "../configs/stage_configs"

import * as AppPropTypes from "../prop_types"
import STAGES from "../configs/stages"

const { VOTING, CLOSED } = STAGES

const LowerThird = props => {
  const { stage } = props

  const stageConfig = stageConfigs[stage]

  function stageSpecificContent() {
    if (stage === VOTING) {
      return <VotingLowerThirdContent {...props} config={stageConfig} />
    }
    return <IdeaGenerationLowerThirdContent {...props} config={stageConfig} />
  }

  return (
    <LowerThirdAnimationWrapper displayContents={stage !== CLOSED} stage={stage}>
      {stageSpecificContent()}
    </LowerThirdAnimationWrapper>
  )
}

LowerThird.defaultProps = {
  currentUser: { is_facilitator: false },
}

LowerThird.propTypes = {
  currentUser: AppPropTypes.presence,
  ideas: AppPropTypes.ideas.isRequired,
  retroChannel: AppPropTypes.retroChannel.isRequired,
  stage: AppPropTypes.stage.isRequired,
}

export default LowerThird

import React from "react"

import IdeaGenerationLowerThirdContent from "./idea_generation_lower_third_content"
import VotingLowerThirdContent from "./voting_lower_third_content"
import LowerThirdAnimationWrapper from "./lower_third_animation_wrapper"
import stageConfigs from "../configs/stage_configs"

import * as AppPropTypes from "../prop_types"
import STAGES from "../configs/stages"

const { VOTING, CLOSED } = STAGES

const LowerThird = props => {
  const { stage } = props

  const stageConfig = stageConfigs[stage]

  function stageSpecificContent() {
    if (stage === VOTING) {
      return <VotingLowerThirdContent {...props} config={stageConfig} />
    }
    return <IdeaGenerationLowerThirdContent {...props} config={stageConfig} />
  }

  return (
    <LowerThirdAnimationWrapper displayContents={stage !== CLOSED} stage={stage}>
      {stageSpecificContent()}
    </LowerThirdAnimationWrapper>
  )
}

LowerThird.propTypes = {
  currentUser: AppPropTypes.presence.isRequired,
  ideas: AppPropTypes.ideas.isRequired,
  retroChannel: AppPropTypes.retroChannel.isRequired,
  stage: AppPropTypes.stage.isRequired,
}

export default LowerThird

Remove default prop value for currentUser in LowerThird
Remove default prop value for currentUser in LowerThird

  - this default has been set in a component at the top of the heirarchy
