handleIssueClick(issue.id)}
+ >
{issue.title}
@@ -113,7 +156,7 @@ function WeeklySchedule({ selectedProjectId }) {
) : (
- 오늘 예정된 이슈가 없습니다
+ {selectedDay === currentDay ? '오늘 예정된 이슈가 없습니다' : '해당 날짜에 예정된 이슈가 없습니다'}
)}
@@ -129,4 +172,4 @@ function WeeklySchedule({ selectedProjectId }) {
);
}
-export default WeeklySchedule
+export default WeeklySchedule;
\ No newline at end of file
diff --git a/src/components/meeting/MeetingCreate.jsx b/src/components/meeting/MeetingCreate.jsx
index c646a3d..81795d6 100644
--- a/src/components/meeting/MeetingCreate.jsx
+++ b/src/components/meeting/MeetingCreate.jsx
@@ -14,7 +14,12 @@ function MeetingCreate({ onBack, onSave, meeting = null, isEditing = false, proj
participants: meeting?.participants || [],
content: meeting?.description || meeting?.memo || meeting?.content || "",
type: meeting?.type || "MEETING",
- progressDate: meeting?.progressDate || new Date().toISOString().slice(0, -1) + '+09:00',
+ progressDate: meeting?.progressDate || (() => {
+ // 현재 시간에 18시간 추가
+ const now = new Date();
+ now.setHours(now.getHours() + 18);
+ return now.toISOString().slice(0, -1) + '+09:00'; // 한국 시간대
+ })(),
});
console.log('MeetingCreate에서 받은 projectId:', projectId);
@@ -84,6 +89,7 @@ function MeetingCreate({ onBack, onSave, meeting = null, isEditing = false, proj
fetchTeamMembers();
}, [fetchTeamMembers]);
+
// 입력값 변경 핸들러
const handleInputChange = (field, value) => {
setMeetingData((prev) => ({
diff --git a/src/pages/Dashboard.jsx b/src/pages/Dashboard.jsx
index 5205b7a..b103ad5 100644
--- a/src/pages/Dashboard.jsx
+++ b/src/pages/Dashboard.jsx
@@ -1,3 +1,4 @@
+import React, { useEffect } from "react";
import KPICard from "../components/dashboard/KPICard";
import ProjectProgressChart from "../components/dashboard/ProjectProgressChart";
import WeeklySchedule from "../components/dashboard/WeeklySchedule";
@@ -8,15 +9,49 @@ import ProjectList from "../components/dashboard/ProjectList";
import useProjectStore from "../store/projectStore";
import { Source, Warning } from "@mui/icons-material";
import { useNavigate } from "react-router-dom";
+import { useQuery } from "@tanstack/react-query";
+import { fetchDashboardProjects, fetchProjectDashboard } from "../api/dashboardAPI";
function Dashboard() {
const navigate = useNavigate();
const { selectedProjectId } = useProjectStore();
+ // fetchDashboardProjects API에서 데이터 가져오기
+ const { data: dashboardData } = useQuery({
+ queryKey: ['dashboardProjects'],
+ queryFn: fetchDashboardProjects,
+ });
+
+ // fetchProjectDashboard API에서 프로젝트별 데이터 가져오기
+ const { data: projectDashboardData } = useQuery({
+ queryKey: ['projectDashboard', selectedProjectId],
+ queryFn: () => fetchProjectDashboard(selectedProjectId),
+ enabled: !!selectedProjectId,
+ });
+
+ // 서버 데이터에서 KPI 값 추출
+ const projectCount = dashboardData?.data?.projectCount || 0;
+ const issueCount = dashboardData?.data?.issueCount || 0;
+
+ // 사용자 역할 확인
+ const userRole = projectDashboardData?.data?.role || 'User';
+ const isPM = userRole === 'PM';
+ const isUser = userRole === 'User';
+
+ // 디버깅용 로그
+ useEffect(() => {
+ if (projectDashboardData) {
+ console.log('프로젝트 대시보드 데이터:', projectDashboardData);
+ console.log('사용자 역할:', userRole);
+ console.log('PM 여부:', isPM);
+ console.log('User 여부:', isUser);
+ }
+ }, [projectDashboardData, userRole, isPM, isUser]);
+
const kpiData = [
{
title: "진행 중인 프로젝트",
- value: "12",
+ value: projectCount.toString(),
icon:
,
trend: "up",
path: "/projects",
@@ -24,7 +59,7 @@ function Dashboard() {
},
{
title: "이번 주 마감 작업",
- value: "8",
+ value: issueCount.toString(),
icon:
,
trend: "down",
trendValue: "-3 from last week",
@@ -36,11 +71,14 @@ function Dashboard() {
- {/* KPI 카드들 */}
-
-
+
+ {/* 에러 발생 창 - PM일 경우에만 표시 */}
+ {isPM && (
+
+ )}
+
@@ -60,7 +98,13 @@ function Dashboard() {
/>
))}
-
+
+ {/* 인원별 이슈 진행률 - 역할에 따라 제목 변경 */}
+
+
@@ -75,4 +119,4 @@ function Dashboard() {
);
}
-export default Dashboard;
+export default Dashboard;
\ No newline at end of file