organize project page components

This commit is contained in:
João Geonizeli
2022-07-10 11:55:57 -03:00
parent 0c97a2a66f
commit 27103eed15
10 changed files with 18 additions and 25 deletions

View File

@@ -10,8 +10,8 @@ import {
import { useState } from "react";
import { SubmitHandler, useForm } from "react-hook-form";
import { KeyedMutator } from "swr";
import { useAuth } from "../../../hooks/useAuth";
import { APIProjectList } from "../Projects";
import { useAuth } from "../../../../hooks/useAuth";
import { APIProjectList } from "../../Projects";
type NewProjectForm = {
name: string;

View File

@@ -0,0 +1 @@
export * from "./NewProjectAction";

View File

@@ -2,8 +2,8 @@ import AddTaskIcon from "@mui/icons-material/AddTask";
import { Box, Button, TextField, Toolbar } from "@mui/material";
import { useState } from "react";
import { SubmitHandler, useForm } from "react-hook-form";
import { useAuth } from "../../../hooks/useAuth";
import { useProject } from "../../../hooks/useProject";
import { useAuth } from "../../../../hooks/useAuth";
import { useProject } from "../../../../hooks/useProject";
type NewTaskForm = {
description: string;
@@ -12,8 +12,8 @@ type NewTaskForm = {
export const AddTask = () => {
const [isLoading, setIsLoading] = useState(false);
const { apiClient } = useAuth();
const { register, handleSubmit, reset } = useForm<NewTaskForm>();
const { tasksMutate, project } = useProject();
const { register, handleSubmit, reset } = useForm<NewTaskForm>();
const onSubmit: SubmitHandler<NewTaskForm> = (data) => {
setIsLoading(true);

View File

@@ -7,8 +7,8 @@ import {
DialogTitle
} from "@mui/material";
import { SetStateAction, useState } from "react";
import { useAuth } from "../../../hooks/useAuth";
import { useProject } from "../../../hooks/useProject";
import { useAuth } from "../../../../hooks/useAuth";
import { useProject } from "../../../../hooks/useProject";
export type DeleteProjectDialogProps = {
open: boolean;

View File

@@ -1,15 +1,11 @@
import { Add } from "@mui/icons-material";
import {
Card,
CardActions,
CardContent,
CardHeader,
IconButton,
Card, CardContent,
CardHeader
} from "@mui/material";
import useSWR from "swr";
import { useAuth } from "../../../hooks/useAuth";
import { ProjectProvider } from "../../../providers/ProjectProvider";
import { createSWRFetcher } from "../../../utils/swrFetcher";
import { useAuth } from "../../../../hooks/useAuth";
import { ProjectProvider } from "../../../../providers/ProjectProvider";
import { createSWRFetcher } from "../../../../utils/swrFetcher";
import { AddTask } from "./AddTask";
import { ProjectOptions } from "./ProjectOptions";
import { TaskListProps, TasksList } from "./TasksList";
@@ -49,11 +45,6 @@ export const Project = (props: ProjectProps) => {
<TasksList title="To Do" tasks={uncompletedTasks} />
<TasksList title="Done" tasks={completedTasks} />
</CardContent>
<CardActions disableSpacing>
<IconButton aria-label="add task">
<Add />
</IconButton>
</CardActions>
</Card>
</ProjectProvider>
);

View File

@@ -8,8 +8,8 @@ import {
} from "@mui/material";
import { SetStateAction, useState } from "react";
import { SubmitHandler, useForm } from "react-hook-form";
import { useAuth } from "../../../hooks/useAuth";
import { useProject } from "../../../hooks/useProject";
import { useAuth } from "../../../../hooks/useAuth";
import { useProject } from "../../../../hooks/useProject";
type RenameProjectForm = {
name: string;

View File

@@ -1,6 +1,6 @@
import { List, ListSubheader } from "@mui/material";
import { useAuth } from "../../../hooks/useAuth";
import { useProject } from "../../../hooks/useProject";
import { useAuth } from "../../../../hooks/useAuth";
import { useProject } from "../../../../hooks/useProject";
import { Task, TasksListItem } from "./TasksListItem";
export type TaskListProps = {

View File

@@ -0,0 +1 @@
export * from './Project'