Skip to content

Commit 77359af

Browse files
Merge pull request #180 from PeerPrep/elroy-final-bugfixes
fix: fix logical bugs
2 parents 2dd205f + f05850a commit 77359af

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

frontend/src/app/components/modal/QuestionModal.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ const triggerQuestionIdUpdateRequestAtom = atom(
3131
const QuestionModal = () => {
3232
const questionId = useAtomValue(questionIdAtom);
3333
const [isOpen, setIsOpen] = useAtom(isQuestionModalOpenAtom);
34+
const [selectedQn, setSelectedQn] =
35+
useState<SingleValue<SelectedOptionType>>();
36+
37+
const handleSelectChange = (
38+
selectedOption: SingleValue<SelectedOptionType>,
39+
) => {
40+
setSelectedQn(selectedOption);
41+
};
3442

3543
const [questions, setQuestions] = useState<QuestionType[]>([]);
3644
const setCollabQuestion = useSetAtom(triggerQuestionIdUpdateRequestAtom);
@@ -47,13 +55,11 @@ const QuestionModal = () => {
4755
}),
4856
);
4957
});
58+
if (questionId === "") {
59+
setIsOpen(true);
60+
}
5061
}, []);
5162

52-
// setQuestions(
53-
// questions.filter(
54-
// }),
55-
// );
56-
5763
const options: SelectedOptionType[] = questions.map((question, i) => {
5864
return {
5965
label: question.title as string,
@@ -75,15 +81,6 @@ const QuestionModal = () => {
7581
break;
7682
}
7783

78-
const [selectedQn, setSelectedQn] =
79-
useState<SingleValue<SelectedOptionType>>();
80-
81-
const handleSelectChange = (
82-
selectedOption: SingleValue<SelectedOptionType>,
83-
) => {
84-
setSelectedQn(selectedOption);
85-
};
86-
8784
const onClickStart = () => {
8885
setIsOpen(false);
8986
if (selectedQn) {
@@ -103,7 +100,7 @@ const QuestionModal = () => {
103100
<input
104101
type="checkbox"
105102
onChange={() => undefined}
106-
checked={isOpen || questionId === ""}
103+
checked={isOpen}
107104
className="modal-toggle"
108105
/>
109106
<dialog id="question-modal" className="modal">

frontend/src/app/components/status-bar/StatusBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const StatusBar = ({ exitMethod }: StatusBarProps) => {
6363
};
6464

6565
return (
66-
<footer className="fixed bottom-0 left-0 flex w-[100svw] items-center justify-between border-black bg-primary px-4 py-2 shadow-sm lg:static lg:w-full lg:px-12">
66+
<footer className="fixed bottom-0 left-0 flex w-[100svw] items-center justify-between border-black bg-primary px-4 py-2 shadow-sm lg:w-full lg:px-12">
6767
{contextHolder}
6868
<div className="flex gap-4">
6969
{userStates &&

0 commit comments

Comments
 (0)