Newer
Older
import CozyBar from 'components/Header/CozyBar'
import { UserActionState } from 'enums'
import React, { useState } from 'react'
import { useAppSelector } from 'store/hooks'
import ActionChoose from './ActionChoose/ActionChoose'
import ActionDone from './ActionDone/ActionDone'
import ActionOnGoing from './ActionOnGoing/ActionOnGoing'
const { currentChallenge } = useAppSelector(state => state.ecolyo.challenge)
const [headerHeight, setHeaderHeight] = useState<number>(0)
switch (challenge.action.state) {
case UserActionState.UNSTARTED:
return <ActionChoose userChallenge={challenge} />
case UserActionState.ONGOING:
return <ActionOnGoing userAction={challenge.action} />
case UserActionState.NOTIFICATION:
return <ActionDone currentChallenge={challenge} />
default:
return <ActionChoose userChallenge={challenge} />
<CozyBar titleKey="common.title_action" displayBackArrow={true} />
desktopTitleKey="common.title_action"
<Content heightOffset={headerHeight}>
{currentChallenge && renderAction(currentChallenge)}
</Content>
</>
)
}
export default ActionView