import React, { useState } from 'react'; import PhaseHeader from './PhaseHeader'; import ClosureIcon from '../../icons/Closure'; import { RingProps } from '../../../model/components/ring'; import RoundedButton from '../../common/RoundedButton'; import RoundedLink from '../../common/RoundedLink'; import updatePhaseAndScore from '../../../utils/updatePhaseAndScore'; import { Phases } from '../../../model/common'; import EndOfPhase from './EndOfPhase'; const Closure: React.FC = ({ ring, user }) => { const { closure: { video }, } = ring; const { answers } = user; const phase = answers?.find((ans) => ans.ring.id === ring.id)?.phase || 0; const showFeedback = phase < 4; const [showEndOfPhase, setShowEnd] = useState(false); const [score, setScore] = useState(0); const onFinish = async (): Promise => { const response = await updatePhaseAndScore(user, 4, ring.id); setShowEnd(true); setScore(response.data.team.totalScore); }; return ( <> {showEndOfPhase && ( )}
} phase="Cierre" onDark />
{showFeedback ? ( ) : ( )}