From ae829d0e3d2cd4349a285d1b84532a35d1940928 Mon Sep 17 00:00:00 2001 From: AbdBarho Date: Fri, 3 Feb 2023 08:30:01 +0100 Subject: [PATCH] update tasks to use types --- website/src/components/Tasks/CreateTask.tsx | 3 ++- website/src/components/Tasks/EvaluateTask.tsx | 3 ++- website/src/components/Tasks/LabelTask/LabelTask.tsx | 3 ++- website/src/components/Tasks/Task/Task.tsx | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/website/src/components/Tasks/CreateTask.tsx b/website/src/components/Tasks/CreateTask.tsx index 8d406fd7..448ad287 100644 --- a/website/src/components/Tasks/CreateTask.tsx +++ b/website/src/components/Tasks/CreateTask.tsx @@ -8,6 +8,7 @@ import { TaskSurveyProps } from "src/components/Tasks/Task"; import { TaskHeader } from "src/components/Tasks/TaskHeader"; import { getTypeSafei18nKey } from "src/lib/i18n"; import { TaskType } from "src/types/Task"; +import { CreateTaskReply } from "src/types/TaskResponses"; import { CreateTaskType } from "src/types/Tasks"; export const CreateTask = ({ @@ -17,7 +18,7 @@ export const CreateTask = ({ isDisabled, onReplyChanged, onValidityChanged, -}: TaskSurveyProps) => { +}: TaskSurveyProps) => { const { t, i18n } = useTranslation(["tasks", "common"]); const cardColor = useColorModeValue("gray.50", "gray.800"); const titleColor = useColorModeValue("gray.800", "gray.300"); diff --git a/website/src/components/Tasks/EvaluateTask.tsx b/website/src/components/Tasks/EvaluateTask.tsx index e2f07749..2f24e6f1 100644 --- a/website/src/components/Tasks/EvaluateTask.tsx +++ b/website/src/components/Tasks/EvaluateTask.tsx @@ -6,6 +6,7 @@ import { SurveyCard } from "src/components/Survey/SurveyCard"; import { TaskSurveyProps } from "src/components/Tasks/Task"; import { TaskHeader } from "src/components/Tasks/TaskHeader"; import { TaskType } from "src/types/Task"; +import { EvaluateTaskReply } from "src/types/TaskResponses"; import { RankTaskType } from "src/types/Tasks"; export const EvaluateTask = ({ @@ -15,7 +16,7 @@ export const EvaluateTask = ({ isDisabled, onReplyChanged, onValidityChanged, -}: TaskSurveyProps) => { +}: TaskSurveyProps) => { const cardColor = useColorModeValue("gray.50", "gray.800"); const [ranking, setRanking] = useState(null); diff --git a/website/src/components/Tasks/LabelTask/LabelTask.tsx b/website/src/components/Tasks/LabelTask/LabelTask.tsx index 33369757..9c211d62 100644 --- a/website/src/components/Tasks/LabelTask/LabelTask.tsx +++ b/website/src/components/Tasks/LabelTask/LabelTask.tsx @@ -6,6 +6,7 @@ import { MessageTable } from "src/components/Messages/MessageTable"; import { TwoColumnsWithCards } from "src/components/Survey/TwoColumnsWithCards"; import { TaskSurveyProps } from "src/components/Tasks/Task"; import { TaskHeader } from "src/components/Tasks/TaskHeader"; +import { LabelTaskReply } from "src/types/TaskResponses"; import { LabelTaskType } from "src/types/Tasks"; const isRequired = (labelName: string, requiredLabels?: string[]) => { @@ -18,7 +19,7 @@ export const LabelTask = ({ isEditable, onReplyChanged, onValidityChanged, -}: TaskSurveyProps; message_id: string }>) => { +}: TaskSurveyProps) => { const { t } = useTranslation("labelling"); const [values, setValues] = useState(new Array(task.labels.length).fill(null)); const [userInputMade, setUserInputMade] = useBoolean(false); diff --git a/website/src/components/Tasks/Task/Task.tsx b/website/src/components/Tasks/Task/Task.tsx index c10ab597..54160636 100644 --- a/website/src/components/Tasks/Task/Task.tsx +++ b/website/src/components/Tasks/Task/Task.tsx @@ -53,12 +53,12 @@ interface UpdateValidity { replyValidity: TaskReplyValidity; } -export interface TaskSurveyProps { +export interface TaskSurveyProps { task: TaskType; taskType: TaskInfo; isEditable: boolean; isDisabled?: boolean; - onReplyChanged: (content: T) => void; + onReplyChanged: (content: ReplyContent) => void; onValidityChanged: (validity: TaskReplyValidity) => void; }