Pass the ESLINT and Typescript build

This commit is contained in:
Lucien Astié 2024-08-10 13:22:32 +02:00
parent cea7a5bc9d
commit 32c3debad4
8 changed files with 115 additions and 98 deletions

View file

@ -1,7 +1,7 @@
import { useState } from 'react'
import { IconSquareX } from '@tabler/icons-react'
export default function EditCustomQuestions({dataRef, questionList = [], setQuestions}){
export default function EditCustomQuestions({dataRef, questionList = [], setQuestions}: any){
let questionTemp = questionList
console.log(questionTemp)
const [forceUpdate, setForceUpdate] = useState(0)
@ -11,7 +11,7 @@ export default function EditCustomQuestions({dataRef, questionList = [], setQues
setForceUpdate(oldFu => oldFu + 1)
}
function removeQuestion(index){
function removeQuestion(index: number){
questionTemp.splice(index, 1)
setForceUpdate(oldFu => oldFu + 1)
}
@ -21,15 +21,15 @@ export default function EditCustomQuestions({dataRef, questionList = [], setQues
<div className="modal-box flex flex-col space-y-8">
<h3 className="font-bold text-lg">Edit custom questions!</h3>
<div className="flex flex-col space-y-4">
{ questionTemp.map((question, index) => {
{ questionTemp.map((question: any, index: number) => {
return(
<div className="flex flex-row space-x-4">
<input type="text" key={index} className="input input-bordered w-full max-w-xs" placeholder="Question" defaultValue={question.text} onChange={(e) => {questionTemp[index].text = e.target.value}}/>
<select onChange={(e) => {questionTemp[index].type = e.target.value}} className="select select-bordered w-24 max-w-xs">
<option>Text</option>
<option>Photo</option>
</select>
<IconSquareX onClick={() => removeQuestion(index)} className="w-12 h-12"/>
<div className="flex flex-row space-x-4" key={index}>
<input type="text" className="input input-bordered w-full max-w-xs" placeholder="Question" defaultValue={question.text} onChange={(e) => {questionTemp[index].text = e.target.value}}/>
<select onChange={(e) => {questionTemp[index].type = e.target.value}} className="select select-bordered w-24 max-w-xs">
<option>Text</option>
<option>Photo</option>
</select>
<IconSquareX onClick={() => removeQuestion(index)} className="w-12 h-12"/>
</div>
)
})}

View file

@ -1,4 +1,4 @@
export default function ModeCard({ mode, selected, onChange }){
export default function ModeCard({ mode, selected, onChange }: any){
const Icon = mode.icon
return <>
<div onClick={onChange} className={`w-24 h-24 rounded-md flex p-4 flex-col items-center ${selected ? "bg-primary" : "bg-zinc-300"}`}>