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