fix: github linting issues (#1510)

This commit is contained in:
Dhruwang Jariwala
2023-11-06 15:10:23 +05:30
committed by GitHub
parent 0c69f8ad43
commit e0fe7f1af7
6 changed files with 23 additions and 14 deletions
@@ -34,11 +34,14 @@ export default function OpenTextQuestion({
// setIsValid(isValidInput);
onChange({ [question.id]: inputValue });
};
const openTextRef = useCallback((currentElement: HTMLInputElement | HTMLTextAreaElement | null) => {
if (currentElement && autoFocus) {
currentElement.focus();
}
}, []);
const openTextRef = useCallback(
(currentElement: HTMLInputElement | HTMLTextAreaElement | null) => {
if (currentElement && autoFocus) {
currentElement.focus();
}
},
[autoFocus]
);
return (
<form
@@ -72,6 +72,7 @@ export default function PictureSelectionQuestion({
if (!question.allowMulti && Array.isArray(value) && value.length > 1) {
onChange({ [question.id]: [] });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [question.allowMulti]);
const questionChoices = question.choices;
@@ -17,7 +17,6 @@ export default function ProgressBar({ survey, questionId, brandColor }: Progress
useEffect(() => {
// calculate progress
setProgress(calculateProgress(questionId, survey, progress));
function calculateProgress(questionId: string, survey: TSurveyWithTriggers, progress: number) {
if (survey.questions.length === 0) return 0;
if (questionId === "end") return 1;
@@ -59,9 +58,10 @@ export default function ProgressBar({ survey, questionId, brandColor }: Progress
updatedProgress = progress + PROGRESS_INCREMENT;
}
setPrevQuestionIdx(currentQustionIdx);
setProgress(calculateProgress(questionId, survey, progress));
return updatedProgress;
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [questionId, survey, setPrevQuestionIdx]);
return <Progress progress={progress} brandColor={brandColor} />;
@@ -21,13 +21,16 @@ function SubmitButton({
focus = false,
type = "submit",
}: SubmitButtonProps) {
const buttonRef = useCallback((currentButton: HTMLButtonElement | null) => {
if (currentButton && focus) {
setTimeout(() => {
currentButton.focus();
}, 200);
}
}, []);
const buttonRef = useCallback(
(currentButton: HTMLButtonElement | null) => {
if (currentButton && focus) {
setTimeout(() => {
currentButton.focus();
}, 200);
}
},
[focus]
);
return (
<button
@@ -54,6 +54,7 @@ export function Survey({
if (prefillResponseData) {
onSubmit(prefillResponseData, true);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
let currIdx = currentQuestionIndex;
let currQues = currentQuestion;
@@ -24,6 +24,7 @@ export default function WelcomeCard({
return (
<div>
{fileUrl && (
/* eslint-disable-next-line @next/next/no-img-element */
<img src={fileUrl} className="mb-8 max-h-96 w-1/3 rounded-lg object-contain" alt="Company Logo" />
)}