diff --git a/src/client/.idea/prettier.xml b/src/client/.idea/prettier.xml index b0ab31a..727b8b5 100644 --- a/src/client/.idea/prettier.xml +++ b/src/client/.idea/prettier.xml @@ -2,5 +2,6 @@ \ No newline at end of file diff --git a/src/client/src/components/common/headings/pageHeading.tsx b/src/client/src/components/common/headings/pageHeading.tsx index 8328545..2477388 100644 --- a/src/client/src/components/common/headings/pageHeading.tsx +++ b/src/client/src/components/common/headings/pageHeading.tsx @@ -2,8 +2,14 @@ import { FC } from "react"; interface PageHeadingProps { title: string; + onClick?: () => void; } -export const PageHeading: FC = ({ title }) => ( -

{title}

+export const PageHeading: FC = ({ title, onClick }) => ( +

+ {title} +

); diff --git a/src/client/src/components/common/headings/projectsHeading.tsx b/src/client/src/components/common/headings/projectsHeading.tsx index 2b52c87..dfc65e6 100644 --- a/src/client/src/components/common/headings/projectsHeading.tsx +++ b/src/client/src/components/common/headings/projectsHeading.tsx @@ -1,3 +1,8 @@ -export const ProjectsHeading = (props: { title: string }) => ( -
{props.title}
+export const ProjectsHeading = (props: { + title: string; + onClick: () => void; +}) => ( +
+ {props.title} +
); diff --git a/src/client/src/components/todos/todoList.tsx b/src/client/src/components/todos/todoList.tsx index 525ef9e..972013c 100644 --- a/src/client/src/components/todos/todoList.tsx +++ b/src/client/src/components/todos/todoList.tsx @@ -2,13 +2,14 @@ import { Todo } from "@src/core/entities/todo"; import { TodoItem } from "@src/components/todos/todoItem"; import { AddTodo } from "@src/components/todos/addTodo"; import { useUpdateTodo } from "@src/presentation/hooks/socketHooks"; -import { useMemo } from "react"; +import { useMemo, useState } from "react"; export const TodoList = (props: { todos: Todo[]; hideDone: boolean; hideProject: boolean; project: string; + folded: boolean; }) => { const { updateTodo } = useUpdateTodo(); @@ -25,20 +26,23 @@ export const TodoList = (props: { return ( <> - - + {props.folded &&
...
} +
+
    + {todos.map((t, i) => ( +
  • + { + updateTodo(todo); + }} + displayProject={!props.hideProject} + /> +
  • + ))} +
+ +
); }; diff --git a/src/client/src/pages/index.tsx b/src/client/src/pages/index.tsx index 01199c7..5871da5 100644 --- a/src/client/src/pages/index.tsx +++ b/src/client/src/pages/index.tsx @@ -4,7 +4,46 @@ import { ProjectsHeading } from "@src/components/common/headings/projectsHeading import { groupByProjects } from "@src/core/actions/utility/groupByProjects"; import { todosApi } from "@src/infrastructure/apis/todosApi"; import { AddTodo } from "@src/components/todos/addTodo"; -import { useMemo } from "react"; +import { useMemo, useState } from "react"; + +function Inbox(props: { groupedTodos: any }) { + const [folded, setFolded] = useState(false); + + return ( +
+ setFolded((folded) => !folded)} + /> + +
+ ); +} + +function ProjectItem(props: { title: string; groupedTodos: any }) { + const [folded, setFolded] = useState(false); + return ( +
+ setFolded((folded) => !folded)} + /> + +
+ ); +} const HomePage = () => { const { data, isLoading } = todosApi.useGetActiveTodosQuery(); @@ -32,28 +71,14 @@ const HomePage = () => { return (
- {groupedTodos["inbox"] && ( -
- - -
- )} + {groupedTodos["inbox"] && } {sections && sections.map((section) => ( -
- - -
+ ))} {onlyActiveTodos && onlyActiveTodos.length === 0 && (