diff --git a/src/app/dashboard/applications.view.tsx b/src/app/dashboard/applications.view.tsx
index 6fd8e4b..b92f58d 100644
--- a/src/app/dashboard/applications.view.tsx
+++ b/src/app/dashboard/applications.view.tsx
@@ -2,51 +2,10 @@ import { Answer, QuestionAnswer } from "../questions/interfaces";
import { Application, BEState } from "../../utils/state";
import { List, ListItem, Metric, Title } from "@tremor/react";
import React, { useEffect, useLayoutEffect } from "react";
-import { RenderQuestion, UseQuestions, useQuestions } from "../questions/list";
+import { UseQuestions, useQuestions } from "../questions/list";
import { isEmpty, uniqBy } from "lodash";
-interface RenderEditQuestionProps extends UseQuestions {
- question: QuestionAnswer;
-}
-
-export const RenderEditQuestion = (props: RenderEditQuestionProps) => {
- const {
- questions: savedQuestions,
- handleChangeAnswer,
- handleSaveQuestion,
- setSelectedQuestion,
- selectedQuestion,
- } = useQuestions();
-
- const question = selectedQuestion;
-
- useEffect(() => {
- // console.log("savedQuestions.length", savedQuestions.length);
- const selectedSavedQuestion = savedQuestions.find(
- (q) => q?.question?.question === props?.question?.question?.question
- );
-
- if (!question && selectedSavedQuestion) {
- // console.log("selectedSavedQuestion", selectedSavedQuestion);
- setSelectedQuestion(selectedSavedQuestion);
- }
- }, [props?.question, savedQuestions]);
-
- if (!question || !question?.question) return null;
-
- return (
-
-
-
{question.question.question}
-
-
-
-
- );
-};
+import { RenderEditQuestion } from "../questions/question";
interface ApplicationsViewProps {
skipped?: boolean;
diff --git a/src/app/dashboard/questions.error.tsx b/src/app/dashboard/questions.error.tsx
index bcdd911..20f5d13 100644
--- a/src/app/dashboard/questions.error.tsx
+++ b/src/app/dashboard/questions.error.tsx
@@ -1,7 +1,8 @@
import { List, ListItem, Metric, Title } from "@tremor/react";
-import { RenderQuestion, UseQuestions } from "../questions/list";
import { QuestionAnswer } from "../questions/interfaces";
+import { RenderQuestion } from "../questions/question";
+import { UseQuestions } from "../questions/list";
import { isEmpty } from "lodash";
export const QuestionsError = (props: UseQuestions) => {
diff --git a/src/app/questions/list.tsx b/src/app/questions/list.tsx
index 681d301..8750a1e 100644
--- a/src/app/questions/list.tsx
+++ b/src/app/questions/list.tsx
@@ -17,195 +17,13 @@ import {
Textarea,
Title,
} from "@tremor/react";
+import { RenderEditQuestion, RenderQuestion } from "./question";
import { isEmpty, sortBy, uniq, uniqBy } from "lodash";
import { MinusCircleIcon } from "@heroicons/react/20/solid";
import React from "react";
import _get from "lodash/get";
-interface ICheckbox {
- title: string;
- checked: boolean;
- id: string;
- handleClick: () => void;
-}
-
-const RenderCheckbox = ({
- title,
- checked = false,
- id,
- handleClick,
-}: ICheckbox) => {
- return (
-
-
-
-
- );
-};
-
-export interface IRenderQuestion {
- autosave?: boolean;
- question: QuestionAnswer;
- handleChangeAnswer: (answer: Answer) => void;
-}
-export const RenderQuestion = ({
- autosave = false,
- question,
- handleChangeAnswer,
-}: IRenderQuestion) => {
- const questionInputType = _get(question, "question.inputType", "text");
- const questionInputTypeValue = _get(
- question,
- "question.inputTypeValue",
- "text"
- );
- const questionAnswerText = _get(question, "chainRes.text", "");
- const questionAnswerError = _get(question, "chainRes.error", false);
-
- switch (questionInputType) {
- case "fieldset":
- const questionAnswers = question.question.answers || [];
- return (
-
-
- {questionAnswerError && (
-
Please select an answer
- )}
-
-
- {questionAnswers.map((answer) => {
- const isChecked = _get(question, "chainRes.text", "").includes(
- answer.inputId
- );
- return (
- handleChangeAnswer(answer)}
- id={answer.inputId}
- key={answer.inputId}
- title={answer.answerText}
- />
- );
- })}
-
-
- );
-
- case "select":
- const questionInputOptions: InputOption[] =
- question?.question?.inputOptions || [];
-
- console.log("questionInputOptions", questionInputOptions);
-
- return (
-
-
- {questionAnswerError && (
-
Please select an answer
- )}
-
-
{
- const value = e;
- const answer = {
- inputId: question.question.inputId,
- inputType: question.question.inputType,
- answerText: value,
- };
- handleChangeAnswer(answer);
- }}
- >
- {questionInputOptions.map((option) => (
-
- {option.label || (option as any).text}
-
- ))}
-
-
- );
-
- case "text":
- default:
- const isNumber = questionInputTypeValue === "number";
- return (
- <>
-
- {questionAnswerError && (
-
- Please select enter the correct answer or update resume to cover
- this question
-
- )}
-
- {isNumber ? (
- {
- const answer = {
- inputId: question.question.inputId,
- inputType: question.question.inputType,
- answerText: e.target.value,
- };
- handleChangeAnswer(answer);
- }}
- />
- ) : (
-