feat(WEB): CEO 대시보드 오늘의 이슈 탭 및 이전 이슈 날짜 조회 기능 추가
- 오늘의 이슈 섹션에 "오늘" / "이전 이슈" 탭 추가 - 이전 이슈 탭에서 날짜 네비게이션(< >, date input) 지원 - usePastIssue 훅 추가 (date 파라미터로 과거 이슈 API 호출) - 탭/날짜 전환 시 필터 및 상태 자동 리셋 - 로딩 중 그리드 높이 유지로 UI 들썩임 방지 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -339,6 +339,44 @@ export function useTodayIssue(limit: number = 30) {
|
||||
return { data, loading, error, refetch: fetchData };
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// 7-1. PastIssue Hook (이전 이슈 - 날짜별 조회)
|
||||
// ============================================
|
||||
|
||||
export function usePastIssue(date: string | null, limit: number = 30) {
|
||||
const [data, setData] = useState<TodayIssueData | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const fetchData = useCallback(async () => {
|
||||
if (!date) return;
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
const apiData = await fetchApi<TodayIssueApiResponse>(
|
||||
`today-issues/summary?limit=${limit}&date=${date}`
|
||||
);
|
||||
const transformed = transformTodayIssueResponse(apiData);
|
||||
setData(transformed);
|
||||
|
||||
} catch (err) {
|
||||
const errorMessage = err instanceof Error ? err.message : '데이터 로딩 실패';
|
||||
setError(errorMessage);
|
||||
console.error('PastIssue API Error:', err);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [date, limit]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
}, [fetchData]);
|
||||
|
||||
return { data, loading, error, refetch: fetchData };
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// 8. Calendar Hook
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user