chore: more changes
continuous-integration/drone/push Build is passing Details

main
parent e2a14fa340
commit a5405a4bf1

@ -101,8 +101,10 @@ export const SubmitActionAnswerAtTime = ({
sendAction: (action: Action) => void sendAction: (action: Action) => void
onTeamQuestionIndex?: Receiver<{ team: string; question: string }> onTeamQuestionIndex?: Receiver<{ team: string; question: string }>
}) => { }) => {
const [answer, setAnswer] = useState<ActionAnswer>({ type ActionTimeAnswer = Omit<ActionAnswer, 'timestamp'> & { timestampRaw: string }
timestamp: '',
const [answer, setAnswer] = useState<ActionTimeAnswer>({
timestampRaw: '',
question: '', question: '',
team: '', team: '',
outcome: 'correct', outcome: 'correct',
@ -122,11 +124,11 @@ export const SubmitActionAnswerAtTime = ({
type="text" type="text"
class="fill" class="fill"
placeholder={'Tempo in formato HH:mm:ss...'} placeholder={'Tempo in formato HH:mm:ss...'}
value={answer.timestamp} value={answer.timestampRaw}
onInput={e => setAnswer({ ...answer, timestamp: e.currentTarget.value })} onInput={e => setAnswer({ ...answer, timestampRaw: e.currentTarget.value })}
/> />
<button onClick={() => setAnswer({ ...answer, timestamp: formatDate(new Date(), 'HH:mm:ss') })}> <button onClick={() => setAnswer({ ...answer, timestampRaw: formatDate(new Date(), 'HH:mm:ss') })}>
Aggiorna Tempo Aggiorna Tempo
</button> </button>
</div> </div>
@ -176,7 +178,7 @@ export const SubmitActionAnswerAtTime = ({
<div class="stack-h"> <div class="stack-h">
<button <button
onClick={() => { onClick={() => {
if (answer.timestamp.trim() === '') { if (answer.timestampRaw.trim() === '') {
alert('Inserisci un tempo valido') alert('Inserisci un tempo valido')
return return
} }
@ -184,7 +186,7 @@ export const SubmitActionAnswerAtTime = ({
sendAction({ sendAction({
...answer, ...answer,
type: 'answer', type: 'answer',
timestamp: parse(answer.timestamp, 'HH:mm:ss', new Date()).toISOString(), timestamp: parse(answer.timestampRaw, 'HH:mm:ss', new Date()).toISOString(),
}) })
}} }}
> >
@ -300,7 +302,6 @@ export const SubmitAction = ({
<> <>
<SubmitActionAnswer room={room} sendAction={sendAction} onTeamQuestionIndex={onTeamQuestionIndex} /> <SubmitActionAnswer room={room} sendAction={sendAction} onTeamQuestionIndex={onTeamQuestionIndex} />
<SubmitActionAnswerAtTime room={room} sendAction={sendAction} onTeamQuestionIndex={onTeamQuestionIndex} /> <SubmitActionAnswerAtTime room={room} sendAction={sendAction} onTeamQuestionIndex={onTeamQuestionIndex} />
<SubmitActionJolly room={room} sendAction={sendAction} onTeamQuestionIndex={onTeamQuestionIndex} /> <SubmitActionJolly room={room} sendAction={sendAction} onTeamQuestionIndex={onTeamQuestionIndex} />
</> </>
) )

Loading…
Cancel
Save