diff --git a/frontend/src/components/dashboard/DashboardCreate/Apply/index.tsx b/frontend/src/components/dashboard/DashboardCreate/Apply/index.tsx index b0f1e9d41..531f77050 100644 --- a/frontend/src/components/dashboard/DashboardCreate/Apply/index.tsx +++ b/frontend/src/components/dashboard/DashboardCreate/Apply/index.tsx @@ -11,6 +11,7 @@ interface ApplyProps { applyState: Question[]; addQuestion: () => void; setQuestionTitle: (index: number) => (title: string) => void; + setQuestionDescription: (index: number) => (description: string) => void; setQuestionType: (index: number) => (type: Question['type']) => void; setQuestionOptions: (index: number) => (Options: QuestionOptionValue[]) => void; setQuestionRequiredToggle: (index: number) => () => void; @@ -25,6 +26,7 @@ export default function Apply({ applyState, addQuestion, setQuestionTitle, + setQuestionDescription, setQuestionType, setQuestionOptions, setQuestionRequiredToggle, @@ -68,6 +70,7 @@ export default function Apply({ index={index} question={question} setQuestionTitle={setQuestionTitle} + setQuestionDescription={setQuestionDescription} setQuestionType={setQuestionType} setQuestionOptions={setQuestionOptions} setQuestionPrev={setQuestionPrev} diff --git a/frontend/src/hooks/useDashboardCreateForm/index.tsx b/frontend/src/hooks/useDashboardCreateForm/index.tsx index 7b4dca6a2..090604501 100644 --- a/frontend/src/hooks/useDashboardCreateForm/index.tsx +++ b/frontend/src/hooks/useDashboardCreateForm/index.tsx @@ -22,6 +22,7 @@ interface UseDashboardCreateFormReturn { addQuestion: () => void; setQuestionTitle: (index: number) => (title: string) => void; + setQuestionDescription: (index: number) => (description: string) => void; setQuestionType: (index: number) => (type: Question['type']) => void; setQuestionOptions: (index: number) => (Options: QuestionOptionValue[]) => void; setQuestionRequiredToggle: (index: number) => () => void; @@ -133,6 +134,14 @@ export default function useDashboardCreateForm(): UseDashboardCreateFormReturn { }); }; + const setQuestionDescription = (index: number) => (string: string) => { + setApplyState((prevState) => { + const questionsCopy = [...prevState]; + questionsCopy[index].description = string; + return questionsCopy; + }); + }; + const setQuestionType = (index: number) => (type: Question['type']) => { setApplyState((prevState) => { const questionsCopy = [...prevState]; @@ -207,6 +216,7 @@ export default function useDashboardCreateForm(): UseDashboardCreateFormReturn { addQuestion, setQuestionTitle, + setQuestionDescription, setQuestionType, setQuestionOptions, setQuestionRequiredToggle, diff --git a/frontend/src/pages/DashboardCreate/index.tsx b/frontend/src/pages/DashboardCreate/index.tsx index 318f612f3..02fdf7b23 100644 --- a/frontend/src/pages/DashboardCreate/index.tsx +++ b/frontend/src/pages/DashboardCreate/index.tsx @@ -18,6 +18,7 @@ export default function DashboardCreate() { addQuestion, setQuestionTitle, + setQuestionDescription, setQuestionType, setQuestionOptions, setQuestionRequiredToggle, @@ -57,6 +58,7 @@ export default function DashboardCreate() { addQuestion={addQuestion} setQuestionTitle={setQuestionTitle} setQuestionType={setQuestionType} + setQuestionDescription={setQuestionDescription} setQuestionOptions={setQuestionOptions} setQuestionRequiredToggle={setQuestionRequiredToggle} setQuestionPrev={setQuestionPrev}