mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
Add E2E tests for internationalization across multiple pages
- Implemented navigation.spec.ts to test language switching and translation of navigation elements. - Created sessions-page.spec.ts to verify translations on the sessions page, including headers, status badges, and date formatting. - Developed settings-page.spec.ts to ensure settings page content is translated and persists across sessions. - Added skills-page.spec.ts to validate translations for skill categories, action buttons, and empty states.
This commit is contained in:
51
ccw/frontend/src/hooks/useProjectOverview.ts
Normal file
51
ccw/frontend/src/hooks/useProjectOverview.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
// ========================================
|
||||
// useProjectOverview Hook
|
||||
// ========================================
|
||||
// TanStack Query hook for project overview data
|
||||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { fetchProjectOverview } from '../lib/api';
|
||||
|
||||
// Query key factory
|
||||
export const projectOverviewKeys = {
|
||||
all: ['projectOverview'] as const,
|
||||
detail: (path?: string) => [...projectOverviewKeys.all, 'detail', path] as const,
|
||||
};
|
||||
|
||||
// Default stale time: 5 minutes
|
||||
const STALE_TIME = 5 * 60 * 1000;
|
||||
|
||||
export interface UseProjectOverviewOptions {
|
||||
/** Override default stale time (ms) */
|
||||
staleTime?: number;
|
||||
/** Enable/disable the query */
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for fetching project overview data
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* const { projectOverview, isLoading } = useProjectOverview();
|
||||
* ```
|
||||
*/
|
||||
export function useProjectOverview(options: UseProjectOverviewOptions = {}) {
|
||||
const { staleTime = STALE_TIME, enabled = true } = options;
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: projectOverviewKeys.detail(),
|
||||
queryFn: fetchProjectOverview,
|
||||
staleTime,
|
||||
enabled,
|
||||
retry: 2,
|
||||
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 10000),
|
||||
});
|
||||
|
||||
return {
|
||||
projectOverview: query.data,
|
||||
isLoading: query.isLoading,
|
||||
error: query.error,
|
||||
refetch: query.refetch,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user