Skip to content

Commit

Permalink
fieldset, select, css
Browse files Browse the repository at this point in the history
  • Loading branch information
ceddybi committed Feb 13, 2024
1 parent 9f4e202 commit dda50bf
Show file tree
Hide file tree
Showing 5 changed files with 379 additions and 417 deletions.
45 changes: 2 additions & 43 deletions src/app/dashboard/applications.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="flex mt-3 flex-col">
<div style={{ marginBottom: "20px" }}>
<Title>{question.question.question}</Title>
</div>

<RenderQuestion
question={question}
handleChangeAnswer={handleChangeAnswer}
/>
</div>
);
};
import { RenderEditQuestion } from "../questions/question";

interface ApplicationsViewProps {
skipped?: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/app/dashboard/questions.error.tsx
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
Loading

0 comments on commit dda50bf

Please sign in to comment.