organize project page components
This commit is contained in:
@@ -10,8 +10,8 @@ import {
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { SubmitHandler, useForm } from "react-hook-form";
|
import { SubmitHandler, useForm } from "react-hook-form";
|
||||||
import { KeyedMutator } from "swr";
|
import { KeyedMutator } from "swr";
|
||||||
import { useAuth } from "../../../hooks/useAuth";
|
import { useAuth } from "../../../../hooks/useAuth";
|
||||||
import { APIProjectList } from "../Projects";
|
import { APIProjectList } from "../../Projects";
|
||||||
|
|
||||||
type NewProjectForm = {
|
type NewProjectForm = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./NewProjectAction";
|
||||||
@@ -2,8 +2,8 @@ import AddTaskIcon from "@mui/icons-material/AddTask";
|
|||||||
import { Box, Button, TextField, Toolbar } from "@mui/material";
|
import { Box, Button, TextField, Toolbar } from "@mui/material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { SubmitHandler, useForm } from "react-hook-form";
|
import { SubmitHandler, useForm } from "react-hook-form";
|
||||||
import { useAuth } from "../../../hooks/useAuth";
|
import { useAuth } from "../../../../hooks/useAuth";
|
||||||
import { useProject } from "../../../hooks/useProject";
|
import { useProject } from "../../../../hooks/useProject";
|
||||||
|
|
||||||
type NewTaskForm = {
|
type NewTaskForm = {
|
||||||
description: string;
|
description: string;
|
||||||
@@ -12,8 +12,8 @@ type NewTaskForm = {
|
|||||||
export const AddTask = () => {
|
export const AddTask = () => {
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const { apiClient } = useAuth();
|
const { apiClient } = useAuth();
|
||||||
const { register, handleSubmit, reset } = useForm<NewTaskForm>();
|
|
||||||
const { tasksMutate, project } = useProject();
|
const { tasksMutate, project } = useProject();
|
||||||
|
const { register, handleSubmit, reset } = useForm<NewTaskForm>();
|
||||||
|
|
||||||
const onSubmit: SubmitHandler<NewTaskForm> = (data) => {
|
const onSubmit: SubmitHandler<NewTaskForm> = (data) => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
DialogTitle
|
DialogTitle
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { SetStateAction, useState } from "react";
|
import { SetStateAction, useState } from "react";
|
||||||
import { useAuth } from "../../../hooks/useAuth";
|
import { useAuth } from "../../../../hooks/useAuth";
|
||||||
import { useProject } from "../../../hooks/useProject";
|
import { useProject } from "../../../../hooks/useProject";
|
||||||
|
|
||||||
export type DeleteProjectDialogProps = {
|
export type DeleteProjectDialogProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -1,15 +1,11 @@
|
|||||||
import { Add } from "@mui/icons-material";
|
|
||||||
import {
|
import {
|
||||||
Card,
|
Card, CardContent,
|
||||||
CardActions,
|
CardHeader
|
||||||
CardContent,
|
|
||||||
CardHeader,
|
|
||||||
IconButton,
|
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { useAuth } from "../../../hooks/useAuth";
|
import { useAuth } from "../../../../hooks/useAuth";
|
||||||
import { ProjectProvider } from "../../../providers/ProjectProvider";
|
import { ProjectProvider } from "../../../../providers/ProjectProvider";
|
||||||
import { createSWRFetcher } from "../../../utils/swrFetcher";
|
import { createSWRFetcher } from "../../../../utils/swrFetcher";
|
||||||
import { AddTask } from "./AddTask";
|
import { AddTask } from "./AddTask";
|
||||||
import { ProjectOptions } from "./ProjectOptions";
|
import { ProjectOptions } from "./ProjectOptions";
|
||||||
import { TaskListProps, TasksList } from "./TasksList";
|
import { TaskListProps, TasksList } from "./TasksList";
|
||||||
@@ -49,11 +45,6 @@ export const Project = (props: ProjectProps) => {
|
|||||||
<TasksList title="To Do" tasks={uncompletedTasks} />
|
<TasksList title="To Do" tasks={uncompletedTasks} />
|
||||||
<TasksList title="Done" tasks={completedTasks} />
|
<TasksList title="Done" tasks={completedTasks} />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardActions disableSpacing>
|
|
||||||
<IconButton aria-label="add task">
|
|
||||||
<Add />
|
|
||||||
</IconButton>
|
|
||||||
</CardActions>
|
|
||||||
</Card>
|
</Card>
|
||||||
</ProjectProvider>
|
</ProjectProvider>
|
||||||
);
|
);
|
||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { SetStateAction, useState } from "react";
|
import { SetStateAction, useState } from "react";
|
||||||
import { SubmitHandler, useForm } from "react-hook-form";
|
import { SubmitHandler, useForm } from "react-hook-form";
|
||||||
import { useAuth } from "../../../hooks/useAuth";
|
import { useAuth } from "../../../../hooks/useAuth";
|
||||||
import { useProject } from "../../../hooks/useProject";
|
import { useProject } from "../../../../hooks/useProject";
|
||||||
|
|
||||||
type RenameProjectForm = {
|
type RenameProjectForm = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { List, ListSubheader } from "@mui/material";
|
import { List, ListSubheader } from "@mui/material";
|
||||||
import { useAuth } from "../../../hooks/useAuth";
|
import { useAuth } from "../../../../hooks/useAuth";
|
||||||
import { useProject } from "../../../hooks/useProject";
|
import { useProject } from "../../../../hooks/useProject";
|
||||||
import { Task, TasksListItem } from "./TasksListItem";
|
import { Task, TasksListItem } from "./TasksListItem";
|
||||||
|
|
||||||
export type TaskListProps = {
|
export type TaskListProps = {
|
||||||
1
client/src/pages/Projects/components/Project/index.ts
Normal file
1
client/src/pages/Projects/components/Project/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './Project'
|
||||||
Reference in New Issue
Block a user