fix: migrate UI to V2 API and fix admin dashboard

Backend fixes:
- Fix markdown generation using correct 'markdown_content' key in tasks.py
- Update admin service to return flat data structure matching frontend types
- Add task_count and failed_tasks fields to user statistics
- Fix top users endpoint to return complete user data

Frontend fixes:
- Migrate ResultsPage from V1 batch API to V2 task API with polling
- Create TaskDetailPage component with markdown preview and download buttons
- Refactor ExportPage to support multi-task selection using V2 download endpoints
- Fix login infinite refresh loop with concurrency control flags
- Create missing Checkbox UI component

New features:
- Add /tasks/:taskId route for task detail view
- Implement multi-task batch export functionality
- Add real-time task status polling (2s interval)

OpenSpec:
- Archive completed proposal 2025-11-17-fix-v2-api-ui-issues
- Create result-export and task-management specifications

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-11-17 08:55:50 +08:00
parent 62609de57c
commit 012da1abc4
15 changed files with 1122 additions and 496 deletions

View File

@@ -0,0 +1,46 @@
import * as React from 'react'
import { Check } from 'lucide-react'
import { cn } from '@/lib/utils'
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
checked?: boolean
onCheckedChange?: (checked: boolean) => void
}
const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
({ className, checked, onCheckedChange, onChange, ...props }, ref) => {
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
onChange?.(e)
onCheckedChange?.(e.target.checked)
}
return (
<div className="relative inline-flex items-center">
<input
type="checkbox"
className="sr-only peer"
checked={checked}
onChange={handleChange}
ref={ref}
{...props}
/>
<div
className={cn(
'h-5 w-5 shrink-0 rounded border border-primary shadow transition-smooth',
'peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2',
'peer-disabled:cursor-not-allowed peer-disabled:opacity-50',
'peer-checked:bg-primary peer-checked:text-primary-foreground',
'hover:border-primary/80 cursor-pointer',
'flex items-center justify-center',
className
)}
>
{checked && <Check className="h-4 w-4 text-white" strokeWidth={3} />}
</div>
</div>
)
}
)
Checkbox.displayName = 'Checkbox'
export { Checkbox }