From 8ce54d07666ff690c4ec594456a0a0687caccd68 Mon Sep 17 00:00:00 2001 From: Kasper Juul Hermansen Date: Sun, 21 Nov 2021 21:05:06 +0100 Subject: [PATCH] Fixed types --- src/client/src/components/todos/add/addTodoForm.tsx | 5 +++-- src/client/src/components/todos/addTodo.tsx | 1 - src/client/src/components/todos/collapsed/todoShortForm.tsx | 5 +++-- src/client/src/core/entities/todo.tsx | 2 +- src/client/src/presentation/hooks/socketHooks.tsx | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/client/src/components/todos/add/addTodoForm.tsx b/src/client/src/components/todos/add/addTodoForm.tsx index a393957..4eb18e5 100644 --- a/src/client/src/components/todos/add/addTodoForm.tsx +++ b/src/client/src/components/todos/add/addTodoForm.tsx @@ -2,17 +2,18 @@ import { FC, useState } from "react"; import { OutlinedButton } from "@src/components/common/buttons/outlinedButton"; import { PrimaryButton } from "@src/components/common/buttons/primaryButton"; import { TodoShortForm } from "@src/components/todos/collapsed/todoShortForm"; +import { Priorities } from "@src/core/entities/todo"; export const AddTodoForm: FC<{ onAdd: ( todoName: string, project: string, description: string, - priority: string + priority?: Priorities ) => void; onClose: () => void; project: string; - priority: string; + priority?: Priorities; }> = ({ onAdd, onClose, ...props }) => { const [todoName, setTodoName] = useState(""); const [todoDescription, setTodoDescription] = useState(""); diff --git a/src/client/src/components/todos/addTodo.tsx b/src/client/src/components/todos/addTodo.tsx index 808551d..dc325e5 100644 --- a/src/client/src/components/todos/addTodo.tsx +++ b/src/client/src/components/todos/addTodo.tsx @@ -22,7 +22,6 @@ export function AddTodo(props: { project: string }) { return ( { createTodo(todoName, description, project, priority); }} diff --git a/src/client/src/components/todos/collapsed/todoShortForm.tsx b/src/client/src/components/todos/collapsed/todoShortForm.tsx index b53981c..303d88a 100644 --- a/src/client/src/components/todos/collapsed/todoShortForm.tsx +++ b/src/client/src/components/todos/collapsed/todoShortForm.tsx @@ -1,12 +1,13 @@ import TextareaAutosize from "react-textarea-autosize"; import { AddProjectButton } from "@src/components/todos/add/addProjectButton"; import { AddPriorityButton } from "@src/components/todos/add/addPriorityButton"; +import { Priorities } from "@src/core/entities/todo"; export const TodoShortForm = (props: { project: string; onProjectChanged: (project: string) => void; - priority: string; - onPriorityChanged: (project: string) => void; + priority: Priorities; + onPriorityChanged: (project: Priorities) => void; name: string; onNameChange: (e) => void; description: string; diff --git a/src/client/src/core/entities/todo.tsx b/src/client/src/core/entities/todo.tsx index 6e791de..b6995a4 100644 --- a/src/client/src/core/entities/todo.tsx +++ b/src/client/src/core/entities/todo.tsx @@ -6,7 +6,7 @@ export const StatusState: { done: Done; notDone: NotDone } = { notDone: false, }; -enum Priorities { +export enum Priorities { p1 = "p1", p2 = "p2", p3 = "p3", diff --git a/src/client/src/presentation/hooks/socketHooks.tsx b/src/client/src/presentation/hooks/socketHooks.tsx index 49f6d2d..8a1e797 100644 --- a/src/client/src/presentation/hooks/socketHooks.tsx +++ b/src/client/src/presentation/hooks/socketHooks.tsx @@ -2,7 +2,7 @@ import { useEffect } from "react"; import { useAppSelector } from "@src/infrastructure/store"; import { todosSelectors } from "@src/infrastructure/state/todo"; import { todosApi } from "@src/infrastructure/apis/todosApi"; -import { Todo } from "@src/core/entities/todo"; +import { Priorities, Todo } from "@src/core/entities/todo"; import { nanoid } from "@reduxjs/toolkit"; export const useSelectInboxTodos = () => { @@ -22,7 +22,7 @@ export const useCreateTodo = () => { todoName: string, description: string, project?: string, - priority?: string + priority?: Priorities ) => { createTodo({ id: nanoid(),