Skip to content

Commit

Permalink
Chore: #51 TaskWithStatus 타입 세분화 및 변경사항 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Seok93 committed Jul 16, 2024
1 parent 010cbeb commit fbc112f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/task/kanban/ProjectStatusContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import UpdateModalProjectStatus from '@components/modal/project-status/UpdateMod
import { generatePrefixId } from '@utils/converter';
import { DND_DRAGGABLE_PREFIX } from '@constants/dnd';
import { BsPencil } from 'react-icons/bs';
import { TaskWithStatus } from '@/types/TaskType';
import { TaskListWithStatus } from '@/types/TaskType';

type TaskStatusContainerProps = {
statusTask: TaskWithStatus;
statusTask: TaskListWithStatus;
};

export default function TaskStatusContainer({ statusTask }: TaskStatusContainerProps) {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/project/KanbanPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { DND_DROPPABLE_PREFIX, DND_TYPE } from '@constants/dnd';
import deepClone from '@utils/deepClone';
import { parsePrefixId } from '@utils/converter';
import { TASK_DUMMY } from '@mocks/mockData';
import type { Task, TaskWithStatus } from '@/types/TaskType';
import type { Task, TaskListWithStatus } from '@/types/TaskType';

function createChangedStatus(statusTasks: TaskWithStatus[], dropResult: DropResult) {
function createChangedStatus(statusTasks: TaskListWithStatus[], dropResult: DropResult) {
const { source, destination } = dropResult;

if (!destination) throw Error('Error: DnD destination is null');
Expand All @@ -22,7 +22,7 @@ function createChangedStatus(statusTasks: TaskWithStatus[], dropResult: DropResu
return newStatusTasks;
}

function createChangedTasks(statusTasks: TaskWithStatus[], dropResult: DropResult, isSameStatus: boolean) {
function createChangedTasks(statusTasks: TaskListWithStatus[], dropResult: DropResult, isSameStatus: boolean) {
const { source, destination, draggableId } = dropResult;

// ToDo: 메세지 포맷 정하고 수정하기
Expand Down Expand Up @@ -50,7 +50,7 @@ function createChangedTasks(statusTasks: TaskWithStatus[], dropResult: DropResul

// ToDo: DnD시 가시성을 위한 애니메이션 처리 추가할 것
export default function KanbanPage() {
const [statusTasks, setStatusTasks] = useState<TaskWithStatus[]>(TASK_DUMMY);
const [statusTasks, setStatusTasks] = useState<TaskListWithStatus[]>(TASK_DUMMY);

const handleDragEnd = (dropResult: DropResult) => {
const { source, destination, type } = dropResult;
Expand Down
3 changes: 2 additions & 1 deletion src/types/TaskType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export type Task = {
endDate: string;
};

export type TaskWithStatus = ProjectStatus & { tasks: Task[] };
export type TaskWithStatus = ProjectStatus & Task;
export type TaskListWithStatus = ProjectStatus & { tasks: Task[] };

0 comments on commit fbc112f

Please sign in to comment.