diff --git a/frontend/src/components/kanbanBoard/kanbanPage.jsx b/frontend/src/components/kanbanBoard/kanbanPage.jsx index 92a8536..ceb57a0 100644 --- a/frontend/src/components/kanbanBoard/kanbanPage.jsx +++ b/frontend/src/components/kanbanBoard/kanbanPage.jsx @@ -1,5 +1,6 @@ import { KanbanBoard } from "./kanbanBoard"; import { useState } from "react"; +import { TableBoard } from "./tableBoard"; export const KanbanPage = () => { const [activeTab, setActiveTab] = useState("kanban"); @@ -16,19 +17,21 @@ export const KanbanPage = () => { handleTabClick("kanban")}> + onClick={() => handleTabClick("kanban")} + > Kanban - {/* handleTabClick("table")}> + onClick={() => handleTabClick("table")} + > Table - */} + - + {activeTab === "kanban" ? : } ); }; diff --git a/frontend/src/components/kanbanBoard/tableBoard.jsx b/frontend/src/components/kanbanBoard/tableBoard.jsx new file mode 100644 index 0000000..9a903af --- /dev/null +++ b/frontend/src/components/kanbanBoard/tableBoard.jsx @@ -0,0 +1,110 @@ +import { useState, useEffect } from "react"; +import { axiosInstance } from "src/api/AxiosConfig"; + +export function TableBoard() { + const [tasks, setTasks] = useState([]); + + // ---------------- Fetch Data ---------------- + useEffect(() => { + const fetchData = async () => { + try { + const tasksResponse = await axiosInstance.get("/todo"); + + // Transform + const transformedTasks = tasksResponse.data.map((task) => ({ + id: task.id, + columnId: task.list_board, + content: task.title, + difficulty: task.difficulty, + notes: task.notes, + importance: task.importance, + challenge: task.challenge, + fromSystem: task.fromSystem, + creation_date: task.creation_date, + last_update: task.last_update, + is_active: task.is_active, + is_full_day_event: task.is_full_day_event, + start_event: task.start_event, + end_event: task.end_event, + google_calendar_id: task.google_calendar_id, + completed: task.completed, + completion_date: task.completion_date, + priority: task.priority, + user: task.user, + list_board: task.list_board, + tags: task.tags, + subtaskCount: task.sub_task_count, + })); + setTasks(transformedTasks); + } catch (error) { + console.error("Error fetching data from API:", error); + } + }; + fetchData(); + }, []); + + // ---------------- END Fetch Data ---------------- + + return ( +
+ + {/* head */} + + + + + + + + + + + {/* BODY */} + {tasks.map((task, index) => ( + + + + + + + + ))} + {/* END BODY */} + + {/* foot */} + + + + + + + + + +
+ + TitleDescriptionPriorityDue Date
+ + +
+
+
{task.content}
+
{task.content}
+
+
+
+ {task.notes} +
+ Description +
{task.priority} + +
TitleDescriptionPriorityDue Date
+
+ ); +}