import { useState } from 'react' import { Table, Tag, Space, Input, Select, Typography } from 'antd' import { SearchOutlined } from '@ant-design/icons' import { useQuery } from '@tanstack/react-query' import { api } from '@/services/http-client' import type { ReviewCardItem, PaginatedResult } from '@/types/api' const { Title } = Typography const statusColors: Record = { active: 'blue', suspended: 'orange', completed: 'green', } export default function ReviewAdmin() { const [search, setSearch] = useState('') const [statusFilter, setStatusFilter] = useState() const { data, isLoading } = useQuery({ queryKey: ['admin', 'reviews', search, statusFilter], queryFn: (): Promise> => { const params = new URLSearchParams() if (search) params.set('search', search) if (statusFilter) params.set('status', statusFilter) return api.get(`/admin-api/reviews?${params.toString()}`) }, refetchInterval: 30_000, }) const columns = [ { title: 'ID', dataIndex: 'id', width: 100, ellipsis: true }, { title: '用户', dataIndex: 'userId', width: 100, ellipsis: true }, { title: '正面', dataIndex: 'frontText', width: 200, ellipsis: true }, { title: '难度', dataIndex: 'difficulty', width: 80 }, { title: '状态', dataIndex: 'status', width: 80, render: (s: string) => {s}, }, { title: '调度', dataIndex: 'scheduleState', width: 80, render: (s: string) => s || '-', }, { title: '间隔(天)', dataIndex: 'intervalDays', width: 80 }, { title: '复习次数', dataIndex: 'repetitionCount', width: 80 }, { title: '失误次数', dataIndex: 'lapseCount', width: 80 }, { title: '下次复习', dataIndex: 'nextReviewAt', width: 120, render: (d: string) => d ? new Date(d).toLocaleDateString() : '-', }, ] return (
复习数据管理 } value={search} onChange={e => setSearch(e.target.value)} style={{ width: 240 }} allowClear />