Skip to content

Commit

Permalink
Lockout class dropdown if no seed
Browse files Browse the repository at this point in the history
  • Loading branch information
ChromaticPanic committed Jun 21, 2024
1 parent d01dca5 commit 4b6d99a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/components/body/feedback_form/FeedbackForm.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export const NegativeFeedbackForm = (
const { inference, position, classList, onCancel, onSubmit } = props;
const [selectedClass, setSelectedClass] = useState<ClassData>(defaultClass);
const [comment, setComment] = useState<string>(reasons[2]);
const [slassDropdownEnabled, setClassDropdownEnabled] =
useState<boolean>(true);

const filter = createFilterOptions<ClassData>();

Expand Down Expand Up @@ -198,6 +200,19 @@ export const NegativeFeedbackForm = (
}
}, [classList, defaultClass, inference]);

useEffect(() => {
if (comment === "No Seed") {
setSelectedClass({
id: -1,
classId: "",
label: "",
});
setClassDropdownEnabled(false);
} else {
setClassDropdownEnabled(true);
}
}, [comment]);

return (
<Draggable
defaultPosition={{
Expand Down Expand Up @@ -241,6 +256,7 @@ export const NegativeFeedbackForm = (
marginTop: "20px",
width: "100%",
}}
disabled={!slassDropdownEnabled}
/>
<Select
labelId="comment-select-label"
Expand Down

0 comments on commit 4b6d99a

Please sign in to comment.