feat: Enhance Project Overview and Review Session pages with improved UI and functionality

- Updated ProjectOverviewPage to enhance the guidelines section with better spacing, larger icons, and improved button styles.
- Refactored ReviewSessionPage to unify filter controls, improve selection actions, and enhance the findings list with a new layout.
- Added dimension tabs and severity filters to the SessionsPage for better navigation and filtering.
- Improved SessionDetailPage to utilize a mapping for status labels, enhancing internationalization support.
- Refactored TaskListTab to remove unused priority configuration code.
- Updated store types to better reflect session metadata structure.
- Added a temporary JSON file for future use.
This commit is contained in:
catlog22
2026-02-03 20:58:03 +08:00
parent 37ba849e75
commit a8385e2ea5
18 changed files with 1621 additions and 675 deletions

View File

@@ -248,10 +248,54 @@ function transformBackendSession(
}
// Preserve type field from backend, or infer from session_id pattern
// Multi-level type detection: backend.type > infer from name
const sessionType = (backendSession.type as SessionMetadata['type']) ||
// Multi-level type detection: backend.type > hasReview (for review sessions) > infer from name
let sessionType = (backendSession.type as SessionMetadata['type']) ||
inferTypeFromName(backendSession.session_id);
// Transform backend review data to frontend format
// Backend has: hasReview, reviewSummary, reviewDimensions (separate fields)
// Frontend expects: review object with dimensions, findings count, etc.
const backendData = backendSession as unknown as {
hasReview?: boolean;
reviewSummary?: {
phase?: string;
severityDistribution?: Record<string, number>;
criticalFiles?: string[];
status?: string;
};
reviewDimensions?: Array<{
name: string;
findings?: Array<{ severity?: string }>;
summary?: unknown;
status?: string;
}>;
};
let review: SessionMetadata['review'] | undefined;
if (backendData.hasReview) {
// If session has review data but type is not 'review', auto-fix the type
if (sessionType !== 'review') {
sessionType = 'review';
}
// Build review object from backend data
const dimensions = backendData.reviewDimensions || [];
const totalFindings = dimensions.reduce(
(sum, dim) => sum + (dim.findings?.length || 0), 0
);
review = {
dimensions: dimensions.map(dim => ({
name: dim.name,
findings: dim.findings || []
})),
dimensions_count: dimensions.length,
findings: totalFindings,
iterations: undefined,
fixes: undefined
};
}
return {
session_id: backendSession.session_id,
type: sessionType,
@@ -265,8 +309,8 @@ function transformBackendSession(
// Preserve additional fields if they exist
has_plan: (backendSession as unknown as { has_plan?: boolean }).has_plan,
plan_updated_at: (backendSession as unknown as { plan_updated_at?: string }).plan_updated_at,
has_review: (backendSession as unknown as { has_review?: boolean }).has_review,
review: (backendSession as unknown as { review?: SessionMetadata['review'] }).review,
has_review: backendData.hasReview,
review,
summaries: (backendSession as unknown as { summaries?: SessionMetadata['summaries'] }).summaries,
tasks: (backendSession as unknown as { tasks?: TaskData[] }).tasks,
};
@@ -1904,6 +1948,14 @@ export interface ReviewSession {
export interface ReviewSessionsResponse {
reviewSessions?: ReviewSession[];
reviewData?: {
sessions?: Array<{
session_id: string;
dimensions: Array<{ name: string; findings?: Array<ReviewFinding> }>;
findings?: Array<ReviewFinding & { dimension: string }>;
progress?: unknown;
}>;
};
}
/**
@@ -1911,7 +1963,32 @@ export interface ReviewSessionsResponse {
*/
export async function fetchReviewSessions(): Promise<ReviewSession[]> {
const data = await fetchApi<ReviewSessionsResponse>('/api/data');
return data.reviewSessions || [];
// If reviewSessions field exists (legacy format), use it
if (data.reviewSessions && data.reviewSessions.length > 0) {
return data.reviewSessions;
}
// Otherwise, transform reviewData.sessions into ReviewSession format
if (data.reviewData?.sessions) {
return data.reviewData.sessions.map(session => ({
session_id: session.session_id,
title: session.session_id,
description: '',
type: 'review' as const,
phase: 'in-progress',
reviewDimensions: session.dimensions.map(dim => ({
name: dim.name,
findings: dim.findings || []
})),
_isActive: true,
created_at: undefined,
updated_at: undefined,
status: 'active'
}));
}
return [];
}
/**