mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
feat(analysis): enhance AnalysisPage with filters, grid layout and fullscreen mode
- Add status filter tabs (all/in_progress/completed) - Add date filter tabs (all/today/week/month) - Add date quick filter bubbles with session counts - Change layout from list to 4-column grid (16 items per page) - Add fullscreen/immersive mode toggle - Make cards compact with smaller font and more content - Add clickable status badges for quick filtering - Reduce padding for consistency with other pages - Show session ID, status, date and conclusions indicator on cards
This commit is contained in:
@@ -3,14 +3,14 @@
|
|||||||
// ========================================
|
// ========================================
|
||||||
// View analysis sessions from /workflow:analyze-with-file command
|
// View analysis sessions from /workflow:analyze-with-file command
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useState, useMemo } from 'react';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import {
|
import {
|
||||||
FileSearch,
|
FileSearch,
|
||||||
Search,
|
Search,
|
||||||
Calendar,
|
|
||||||
CheckCircle,
|
CheckCircle,
|
||||||
Clock,
|
Clock,
|
||||||
|
ChevronLeft,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
Loader2,
|
Loader2,
|
||||||
AlertCircle,
|
AlertCircle,
|
||||||
@@ -18,57 +18,87 @@ import {
|
|||||||
FileText,
|
FileText,
|
||||||
Code,
|
Code,
|
||||||
MessageSquare,
|
MessageSquare,
|
||||||
|
Maximize2,
|
||||||
|
Minimize2,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { useWorkflowStore } from '@/stores/workflowStore';
|
import { useWorkflowStore } from '@/stores/workflowStore';
|
||||||
|
import { useAppStore } from '@/stores/appStore';
|
||||||
import { Card } from '@/components/ui/Card';
|
import { Card } from '@/components/ui/Card';
|
||||||
import { Input } from '@/components/ui/Input';
|
import { Input } from '@/components/ui/Input';
|
||||||
import { Badge } from '@/components/ui/Badge';
|
import { Badge } from '@/components/ui/Badge';
|
||||||
import { Button } from '@/components/ui/Button';
|
import { Button } from '@/components/ui/Button';
|
||||||
import { TabsNavigation } from '@/components/ui/TabsNavigation';
|
import { TabsNavigation } from '@/components/ui/TabsNavigation';
|
||||||
|
import {
|
||||||
|
Drawer,
|
||||||
|
DrawerContent,
|
||||||
|
DrawerHeader,
|
||||||
|
DrawerTitle,
|
||||||
|
DrawerClose,
|
||||||
|
} from '@/components/ui/Drawer';
|
||||||
import { fetchAnalysisSessions, fetchAnalysisDetail } from '@/lib/api';
|
import { fetchAnalysisSessions, fetchAnalysisDetail } from '@/lib/api';
|
||||||
import { MessageRenderer } from '@/components/shared/CliStreamMonitor/MessageRenderer';
|
import { MessageRenderer } from '@/components/shared/CliStreamMonitor/MessageRenderer';
|
||||||
import { JsonCardView } from '@/components/shared/JsonCardView';
|
import { JsonCardView } from '@/components/shared/JsonCardView';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import type { AnalysisSessionSummary } from '@/types/analysis';
|
import type { AnalysisSessionSummary } from '@/types/analysis';
|
||||||
|
|
||||||
// ========== Session Card Component ==========
|
const PAGE_SIZE = 16; // 4 rows × 4 columns
|
||||||
|
|
||||||
|
// ========== Session Card Component (Compact) ==========
|
||||||
|
|
||||||
interface SessionCardProps {
|
interface SessionCardProps {
|
||||||
session: AnalysisSessionSummary;
|
session: AnalysisSessionSummary;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
isSelected: boolean;
|
onStatusClick: (status: string) => void;
|
||||||
|
isStatusFiltered: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SessionCard({ session, onClick, isSelected }: SessionCardProps) {
|
function SessionCard({ session, onClick, onStatusClick, isStatusFiltered }: SessionCardProps) {
|
||||||
|
const handleStatusClick = (e: React.MouseEvent) => {
|
||||||
|
e.stopPropagation(); // Prevent card click
|
||||||
|
onStatusClick(session.status);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
className={cn(
|
className="p-3 cursor-pointer transition-all hover:shadow-md hover:border-primary/50 h-full flex flex-col"
|
||||||
'p-4 cursor-pointer transition-all hover:shadow-md',
|
|
||||||
isSelected && 'ring-2 ring-primary'
|
|
||||||
)}
|
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<div className="flex items-start justify-between mb-3">
|
{/* Topic - smaller font */}
|
||||||
<div className="flex items-center gap-2 flex-1 min-w-0">
|
<h3 className="text-sm font-medium text-foreground line-clamp-2 mb-2 leading-snug">
|
||||||
<FileSearch className="w-5 h-5 text-primary flex-shrink-0" />
|
{session.topic}
|
||||||
<h3 className="font-medium text-foreground truncate">{session.topic}</h3>
|
</h3>
|
||||||
</div>
|
|
||||||
<ChevronRight className="w-4 h-4 text-muted-foreground flex-shrink-0" />
|
{/* Session ID - truncate */}
|
||||||
</div>
|
<p className="text-xs text-muted-foreground truncate mb-2">
|
||||||
<p className="text-sm text-muted-foreground truncate mb-3">{session.id}</p>
|
{session.id}
|
||||||
<div className="flex items-center gap-3">
|
</p>
|
||||||
<Badge variant={session.status === 'completed' ? 'success' : 'warning'}>
|
|
||||||
|
{/* Status and Date */}
|
||||||
|
<div className="flex items-center justify-between text-xs mt-auto pt-2 border-t">
|
||||||
|
<Badge
|
||||||
|
variant={session.status === 'completed' ? 'success' : 'warning'}
|
||||||
|
className={cn(
|
||||||
|
"text-[10px] px-1.5 py-0 cursor-pointer transition-all",
|
||||||
|
isStatusFiltered && "ring-2 ring-primary ring-offset-1"
|
||||||
|
)}
|
||||||
|
onClick={handleStatusClick}
|
||||||
|
>
|
||||||
{session.status === 'completed' ? (
|
{session.status === 'completed' ? (
|
||||||
<><CheckCircle className="w-3 h-3 mr-1" />完成</>
|
<><CheckCircle className="w-2.5 h-2.5 mr-0.5" />完成</>
|
||||||
) : (
|
) : (
|
||||||
<><Clock className="w-3 h-3 mr-1" />进行中</>
|
<><Clock className="w-2.5 h-2.5 mr-0.5" />进行中</>
|
||||||
)}
|
)}
|
||||||
</Badge>
|
</Badge>
|
||||||
<span className="text-xs text-muted-foreground flex items-center gap-1">
|
<span className="text-muted-foreground">{session.createdAt}</span>
|
||||||
<Calendar className="w-3 h-3" />
|
|
||||||
{session.createdAt}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Conclusions indicator */}
|
||||||
|
{session.hasConclusions && (
|
||||||
|
<div className="flex items-center gap-1 text-[10px] text-muted-foreground mt-1">
|
||||||
|
<FileText className="w-2.5 h-2.5" />
|
||||||
|
<span>有结论</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -78,10 +108,9 @@ function SessionCard({ session, onClick, isSelected }: SessionCardProps) {
|
|||||||
interface DetailPanelProps {
|
interface DetailPanelProps {
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
projectPath: string;
|
projectPath: string;
|
||||||
onClose: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DetailPanel({ sessionId, projectPath, onClose }: DetailPanelProps) {
|
function DetailPanel({ sessionId, projectPath }: DetailPanelProps) {
|
||||||
const [activeTab, setActiveTab] = useState('discussion');
|
const [activeTab, setActiveTab] = useState('discussion');
|
||||||
|
|
||||||
const { data: detail, isLoading, error } = useQuery({
|
const { data: detail, isLoading, error } = useQuery({
|
||||||
@@ -129,9 +158,9 @@ function DetailPanel({ sessionId, projectPath, onClose }: DetailPanelProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full flex flex-col">
|
<div className="h-full flex flex-col">
|
||||||
{/* Header */}
|
{/* Session Info (in drawer, header is already shown) */}
|
||||||
<div className="flex items-center justify-between p-4 border-b shrink-0">
|
<div className="px-4 pb-3 border-b shrink-0">
|
||||||
<div className="min-w-0 flex-1 mr-2">
|
<div className="min-w-0">
|
||||||
<h2 className="font-semibold truncate">{detail.topic}</h2>
|
<h2 className="font-semibold truncate">{detail.topic}</h2>
|
||||||
<div className="flex items-center gap-2 mt-1">
|
<div className="flex items-center gap-2 mt-1">
|
||||||
<Badge variant={detail.status === 'completed' ? 'default' : 'secondary'} className="text-xs">
|
<Badge variant={detail.status === 'completed' ? 'default' : 'secondary'} className="text-xs">
|
||||||
@@ -140,9 +169,6 @@ function DetailPanel({ sessionId, projectPath, onClose }: DetailPanelProps) {
|
|||||||
<span className="text-xs text-muted-foreground">{detail.createdAt}</span>
|
<span className="text-xs text-muted-foreground">{detail.createdAt}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button variant="ghost" size="sm" onClick={onClose} className="shrink-0">
|
|
||||||
<X className="w-4 h-4" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tabs Content */}
|
{/* Tabs Content */}
|
||||||
@@ -187,50 +213,238 @@ function DetailPanel({ sessionId, projectPath, onClose }: DetailPanelProps) {
|
|||||||
|
|
||||||
// ========== Main Component ==========
|
// ========== Main Component ==========
|
||||||
|
|
||||||
|
type DateFilter = 'all' | 'today' | 'week' | 'month';
|
||||||
|
type StatusFilter = 'all' | 'in_progress' | 'completed';
|
||||||
|
|
||||||
|
const DATE_FILTERS: { value: DateFilter; label: string }[] = [
|
||||||
|
{ value: 'all', label: '全部' },
|
||||||
|
{ value: 'today', label: '今天' },
|
||||||
|
{ value: 'week', label: '本周' },
|
||||||
|
{ value: 'month', label: '本月' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const STATUS_FILTERS: { value: StatusFilter; label: string; icon: React.ReactNode }[] = [
|
||||||
|
{ value: 'all', label: '全部', icon: <FileSearch className="w-4 h-4" /> },
|
||||||
|
{ value: 'in_progress', label: '进行中', icon: <Clock className="w-4 h-4" /> },
|
||||||
|
{ value: 'completed', label: '已完成', icon: <CheckCircle className="w-4 h-4" /> },
|
||||||
|
];
|
||||||
|
|
||||||
export function AnalysisPage() {
|
export function AnalysisPage() {
|
||||||
const projectPath = useWorkflowStore((state) => state.projectPath);
|
const projectPath = useWorkflowStore((state) => state.projectPath);
|
||||||
|
const isImmersiveMode = useAppStore((s) => s.isImmersiveMode);
|
||||||
|
const toggleImmersiveMode = useAppStore((s) => s.toggleImmersiveMode);
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
const [selectedSession, setSelectedSession] = useState<string | null>(null);
|
const [selectedSession, setSelectedSession] = useState<string | null>(null);
|
||||||
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
|
const [dateFilter, setDateFilter] = useState<DateFilter>('all');
|
||||||
|
const [statusFilter, setStatusFilter] = useState<StatusFilter>('all');
|
||||||
|
const [selectedDate, setSelectedDate] = useState<string | null>(null);
|
||||||
|
|
||||||
const { data: sessions = [], isLoading, error } = useQuery({
|
const { data: sessions = [], isLoading, error } = useQuery({
|
||||||
queryKey: ['analysis-sessions', projectPath],
|
queryKey: ['analysis-sessions', projectPath],
|
||||||
queryFn: () => fetchAnalysisSessions(projectPath),
|
queryFn: () => fetchAnalysisSessions(projectPath),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filter sessions by search query
|
// Get unique dates with counts for quick filter bubbles
|
||||||
const filteredSessions = sessions.filter((session) =>
|
const uniqueDates = useMemo(() => {
|
||||||
session.topic.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
const dateCounts = new Map<string, number>();
|
||||||
session.id.toLowerCase().includes(searchQuery.toLowerCase())
|
sessions.forEach((session) => {
|
||||||
);
|
const count = dateCounts.get(session.createdAt) || 0;
|
||||||
|
dateCounts.set(session.createdAt, count + 1);
|
||||||
|
});
|
||||||
|
// Sort by date descending, show top 10
|
||||||
|
return Array.from(dateCounts.entries())
|
||||||
|
.sort((a, b) => b[0].localeCompare(a[0]))
|
||||||
|
.slice(0, 10)
|
||||||
|
.map(([date, count]) => ({
|
||||||
|
date,
|
||||||
|
label: date.slice(5), // MM-DD format
|
||||||
|
count,
|
||||||
|
}));
|
||||||
|
}, [sessions]);
|
||||||
|
|
||||||
|
// Filter by date, status and search query
|
||||||
|
const filteredSessions = useMemo(() => {
|
||||||
|
const now = new Date();
|
||||||
|
const today = now.toISOString().split('T')[0];
|
||||||
|
const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
|
||||||
|
const monthAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
|
||||||
|
|
||||||
|
let filtered = sessions.filter((session) => {
|
||||||
|
// Search filter
|
||||||
|
const matchesSearch = session.topic.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
session.id.toLowerCase().includes(searchQuery.toLowerCase());
|
||||||
|
|
||||||
|
// Status filter
|
||||||
|
const matchesStatus = statusFilter === 'all' || session.status === statusFilter;
|
||||||
|
|
||||||
|
// Date filter
|
||||||
|
let matchesDate = true;
|
||||||
|
if (selectedDate) {
|
||||||
|
matchesDate = session.createdAt === selectedDate;
|
||||||
|
} else if (dateFilter === 'today') {
|
||||||
|
matchesDate = session.createdAt === today;
|
||||||
|
} else if (dateFilter === 'week') {
|
||||||
|
matchesDate = session.createdAt >= weekAgo;
|
||||||
|
} else if (dateFilter === 'month') {
|
||||||
|
matchesDate = session.createdAt >= monthAgo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return matchesSearch && matchesStatus && matchesDate;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sort by createdAt descending (newest first)
|
||||||
|
return filtered.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
||||||
|
}, [sessions, searchQuery, dateFilter, statusFilter, selectedDate]);
|
||||||
|
|
||||||
|
// Handle date select
|
||||||
|
const handleDateSelect = (date: string) => {
|
||||||
|
if (selectedDate === date) {
|
||||||
|
setSelectedDate(null);
|
||||||
|
} else {
|
||||||
|
setSelectedDate(date);
|
||||||
|
setDateFilter('all');
|
||||||
|
}
|
||||||
|
setCurrentPage(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle status filter from card click
|
||||||
|
const handleStatusClick = (status: string) => {
|
||||||
|
if (statusFilter === status) {
|
||||||
|
setStatusFilter('all');
|
||||||
|
} else {
|
||||||
|
setStatusFilter(status as StatusFilter);
|
||||||
|
}
|
||||||
|
setCurrentPage(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Pagination
|
||||||
|
const totalPages = Math.ceil(filteredSessions.length / PAGE_SIZE);
|
||||||
|
const paginatedSessions = useMemo(() => {
|
||||||
|
const start = (currentPage - 1) * PAGE_SIZE;
|
||||||
|
return filteredSessions.slice(start, start + PAGE_SIZE);
|
||||||
|
}, [filteredSessions, currentPage]);
|
||||||
|
|
||||||
|
// Reset to page 1 when filters change
|
||||||
|
const handleSearchChange = (value: string) => {
|
||||||
|
setSearchQuery(value);
|
||||||
|
setCurrentPage(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDateFilterChange = (filter: DateFilter) => {
|
||||||
|
setDateFilter(filter);
|
||||||
|
setCurrentPage(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleStatusFilterChange = (filter: StatusFilter) => {
|
||||||
|
setStatusFilter(filter);
|
||||||
|
setSelectedDate(null);
|
||||||
|
setCurrentPage(1);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full flex overflow-hidden">
|
<div className={cn(
|
||||||
{/* Left Panel - List */}
|
"h-full flex overflow-hidden",
|
||||||
<div className={`p-6 space-y-6 overflow-auto ${selectedSession ? 'w-[400px] shrink-0' : 'flex-1'}`}>
|
isImmersiveMode && "fixed inset-0 z-50 bg-background"
|
||||||
|
)}>
|
||||||
|
{/* Main Content - List */}
|
||||||
|
<div className="flex-1 flex flex-col p-4 space-y-3 overflow-auto">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
|
<div className="flex items-center justify-between shrink-0">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<FileSearch className="w-6 h-6 text-primary" />
|
<FileSearch className="w-5 h-5 text-primary" />
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-semibold text-foreground">
|
<h1 className="text-xl font-semibold text-foreground">
|
||||||
Analysis Viewer
|
Analysis Viewer
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-sm text-muted-foreground mt-1">
|
<p className="text-xs text-muted-foreground mt-0.5">
|
||||||
查看 /workflow:analyze-with-file 命令的分析结果
|
查看 /workflow:analyze-with-file 命令的分析结果
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span className="text-xs text-muted-foreground">
|
||||||
|
共 {filteredSessions.length} 个会话
|
||||||
|
</span>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
className="h-7 w-7 p-0"
|
||||||
|
onClick={toggleImmersiveMode}
|
||||||
|
title={isImmersiveMode ? '退出全屏' : '全屏模式'}
|
||||||
|
>
|
||||||
|
{isImmersiveMode ? (
|
||||||
|
<Minimize2 className="w-4 h-4" />
|
||||||
|
) : (
|
||||||
|
<Maximize2 className="w-4 h-4" />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Filters */}
|
||||||
|
<div className="flex items-center gap-4 shrink-0">
|
||||||
{/* Search */}
|
{/* Search */}
|
||||||
<div className="relative max-w-md">
|
<div className="relative flex-1 max-w-md">
|
||||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
|
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
|
||||||
<Input
|
<Input
|
||||||
placeholder="搜索分析会话..."
|
placeholder="搜索分析会话..."
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => handleSearchChange(e.target.value)}
|
||||||
className="pl-9"
|
className="pl-9"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Status Filter Tabs */}
|
||||||
|
<div className="flex items-center gap-1 bg-muted/50 rounded-lg p-1">
|
||||||
|
{STATUS_FILTERS.map((filter) => (
|
||||||
|
<Button
|
||||||
|
key={filter.value}
|
||||||
|
variant={statusFilter === filter.value ? 'default' : 'ghost'}
|
||||||
|
size="sm"
|
||||||
|
className="h-7 px-3 text-xs gap-1"
|
||||||
|
onClick={() => handleStatusFilterChange(filter.value)}
|
||||||
|
>
|
||||||
|
{filter.icon}
|
||||||
|
{filter.label}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Date Filter Tabs */}
|
||||||
|
<div className="flex items-center gap-1 bg-muted/50 rounded-lg p-1">
|
||||||
|
{DATE_FILTERS.map((filter) => (
|
||||||
|
<Button
|
||||||
|
key={filter.value}
|
||||||
|
variant={dateFilter === filter.value ? 'default' : 'ghost'}
|
||||||
|
size="sm"
|
||||||
|
className="h-7 px-3 text-xs"
|
||||||
|
onClick={() => handleDateFilterChange(filter.value)}
|
||||||
|
>
|
||||||
|
{filter.label}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Date Quick Filter Bubbles */}
|
||||||
|
<div className="flex items-center gap-2 flex-wrap shrink-0">
|
||||||
|
{uniqueDates.map((date) => (
|
||||||
|
<Button
|
||||||
|
key={date.date}
|
||||||
|
variant={selectedDate === date.date ? 'default' : 'outline'}
|
||||||
|
size="sm"
|
||||||
|
className="h-7 px-2 text-xs gap-1"
|
||||||
|
onClick={() => handleDateSelect(date.date)}
|
||||||
|
>
|
||||||
|
<span>{date.label}</span>
|
||||||
|
<Badge variant="secondary" className="ml-1 px-1.5 py-0 text-[10px]">
|
||||||
|
{date.count}
|
||||||
|
</Badge>
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Content */}
|
{/* Content */}
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="flex items-center justify-center py-12">
|
<div className="flex items-center justify-center py-12">
|
||||||
@@ -254,29 +468,67 @@ export function AnalysisPage() {
|
|||||||
</p>
|
</p>
|
||||||
</Card>
|
</Card>
|
||||||
) : (
|
) : (
|
||||||
<div className="grid gap-4">
|
<>
|
||||||
{filteredSessions.map((session) => (
|
{/* Grid - flex-1 to fill remaining space */}
|
||||||
|
<div className="flex-1 grid grid-cols-4 gap-3 content-start">
|
||||||
|
{paginatedSessions.map((session) => (
|
||||||
<SessionCard
|
<SessionCard
|
||||||
key={session.id}
|
key={session.id}
|
||||||
session={session}
|
session={session}
|
||||||
isSelected={selectedSession === session.id}
|
|
||||||
onClick={() => setSelectedSession(session.id)}
|
onClick={() => setSelectedSession(session.id)}
|
||||||
|
onStatusClick={handleStatusClick}
|
||||||
|
isStatusFiltered={statusFilter !== 'all'}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Pagination */}
|
||||||
|
{totalPages > 1 && (
|
||||||
|
<div className="flex items-center justify-center gap-2 pt-4">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
disabled={currentPage === 1}
|
||||||
|
onClick={() => setCurrentPage(p => p - 1)}
|
||||||
|
>
|
||||||
|
<ChevronLeft className="w-4 h-4" />
|
||||||
|
</Button>
|
||||||
|
<span className="text-sm text-muted-foreground px-3">
|
||||||
|
{currentPage} / {totalPages}
|
||||||
|
</span>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
disabled={currentPage === totalPages}
|
||||||
|
onClick={() => setCurrentPage(p => p + 1)}
|
||||||
|
>
|
||||||
|
<ChevronRight className="w-4 h-4" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Right Panel - Detail */}
|
{/* Detail Drawer */}
|
||||||
|
<Drawer open={!!selectedSession} onOpenChange={(open) => !open && setSelectedSession(null)}>
|
||||||
|
<DrawerContent side="right" className="w-1/2 h-full max-w-none">
|
||||||
|
<DrawerHeader className="shrink-0">
|
||||||
|
<DrawerTitle>分析详情</DrawerTitle>
|
||||||
|
<DrawerClose asChild>
|
||||||
|
<Button variant="ghost" size="sm" className="absolute right-4 top-4">
|
||||||
|
<X className="w-4 h-4" />
|
||||||
|
</Button>
|
||||||
|
</DrawerClose>
|
||||||
|
</DrawerHeader>
|
||||||
{selectedSession && (
|
{selectedSession && (
|
||||||
<div className="flex-1 border-l bg-background min-w-0">
|
|
||||||
<DetailPanel
|
<DetailPanel
|
||||||
sessionId={selectedSession}
|
sessionId={selectedSession}
|
||||||
projectPath={projectPath}
|
projectPath={projectPath}
|
||||||
onClose={() => setSelectedSession(null)}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
|
</DrawerContent>
|
||||||
|
</Drawer>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user