Fixed types

This commit is contained in:
Kasper Juul Hermansen 2021-11-21 21:05:06 +01:00
parent 43eef83aa8
commit 8ce54d0766
Signed by: kjuulh
GPG Key ID: DCD9397082D97069
5 changed files with 9 additions and 8 deletions

View File

@ -2,17 +2,18 @@ import { FC, useState } from "react";
import { OutlinedButton } from "@src/components/common/buttons/outlinedButton"; import { OutlinedButton } from "@src/components/common/buttons/outlinedButton";
import { PrimaryButton } from "@src/components/common/buttons/primaryButton"; import { PrimaryButton } from "@src/components/common/buttons/primaryButton";
import { TodoShortForm } from "@src/components/todos/collapsed/todoShortForm"; import { TodoShortForm } from "@src/components/todos/collapsed/todoShortForm";
import { Priorities } from "@src/core/entities/todo";
export const AddTodoForm: FC<{ export const AddTodoForm: FC<{
onAdd: ( onAdd: (
todoName: string, todoName: string,
project: string, project: string,
description: string, description: string,
priority: string priority?: Priorities
) => void; ) => void;
onClose: () => void; onClose: () => void;
project: string; project: string;
priority: string; priority?: Priorities;
}> = ({ onAdd, onClose, ...props }) => { }> = ({ onAdd, onClose, ...props }) => {
const [todoName, setTodoName] = useState(""); const [todoName, setTodoName] = useState("");
const [todoDescription, setTodoDescription] = useState(""); const [todoDescription, setTodoDescription] = useState("");

View File

@ -22,7 +22,6 @@ export function AddTodo(props: { project: string }) {
return ( return (
<AddTodoForm <AddTodoForm
project={props.project} project={props.project}
priority={""}
onAdd={(todoName, project, description, priority) => { onAdd={(todoName, project, description, priority) => {
createTodo(todoName, description, project, priority); createTodo(todoName, description, project, priority);
}} }}

View File

@ -1,12 +1,13 @@
import TextareaAutosize from "react-textarea-autosize"; import TextareaAutosize from "react-textarea-autosize";
import { AddProjectButton } from "@src/components/todos/add/addProjectButton"; import { AddProjectButton } from "@src/components/todos/add/addProjectButton";
import { AddPriorityButton } from "@src/components/todos/add/addPriorityButton"; import { AddPriorityButton } from "@src/components/todos/add/addPriorityButton";
import { Priorities } from "@src/core/entities/todo";
export const TodoShortForm = (props: { export const TodoShortForm = (props: {
project: string; project: string;
onProjectChanged: (project: string) => void; onProjectChanged: (project: string) => void;
priority: string; priority: Priorities;
onPriorityChanged: (project: string) => void; onPriorityChanged: (project: Priorities) => void;
name: string; name: string;
onNameChange: (e) => void; onNameChange: (e) => void;
description: string; description: string;

View File

@ -6,7 +6,7 @@ export const StatusState: { done: Done; notDone: NotDone } = {
notDone: false, notDone: false,
}; };
enum Priorities { export enum Priorities {
p1 = "p1", p1 = "p1",
p2 = "p2", p2 = "p2",
p3 = "p3", p3 = "p3",

View File

@ -2,7 +2,7 @@ import { useEffect } from "react";
import { useAppSelector } from "@src/infrastructure/store"; import { useAppSelector } from "@src/infrastructure/store";
import { todosSelectors } from "@src/infrastructure/state/todo"; import { todosSelectors } from "@src/infrastructure/state/todo";
import { todosApi } from "@src/infrastructure/apis/todosApi"; 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"; import { nanoid } from "@reduxjs/toolkit";
export const useSelectInboxTodos = () => { export const useSelectInboxTodos = () => {
@ -22,7 +22,7 @@ export const useCreateTodo = () => {
todoName: string, todoName: string,
description: string, description: string,
project?: string, project?: string,
priority?: string priority?: Priorities
) => { ) => {
createTodo({ createTodo({
id: nanoid(), id: nanoid(),