refactor(ui): clean up unused imports and variables in UI components
All checks were successful
Admin CI / build-and-push-web (push) Successful in 3m48s

This commit is contained in:
lafay
2026-04-04 00:25:18 +08:00
parent ff77b46f79
commit dacad1587a
4 changed files with 7 additions and 7 deletions

View File

@@ -103,7 +103,7 @@ const menuItems: MenuItem[] = [
] ]
export default function Sidebar({ collapsed, onCollapse }: SidebarProps) { export default function Sidebar({ collapsed, onCollapse }: SidebarProps) {
const { hasAnyRole, roles } = useAuthStore() const { hasAnyRole } = useAuthStore()
const [expandedItems, setExpandedItems] = useState<string[]>(['学习资料']) const [expandedItems, setExpandedItems] = useState<string[]>(['学习资料'])
// 切换展开状态 // 切换展开状态

View File

@@ -30,7 +30,7 @@ import {
import { PaginationNavigator } from '@/components/ui/pagination' import { PaginationNavigator } from '@/components/ui/pagination'
import { Label } from '@/components/ui/label' import { Label } from '@/components/ui/label'
import { Textarea } from '@/components/ui/textarea' import { Textarea } from '@/components/ui/textarea'
import { Loader2, Plus, Pencil, Trash2, Search, FileText, Download, Eye } from 'lucide-react' import { Loader2, Plus, Pencil, Trash2, Search, Download, Eye } from 'lucide-react'
import { format } from 'date-fns' import { format } from 'date-fns'
// 文件类型配置 // 文件类型配置
@@ -66,7 +66,7 @@ export default function Materials() {
// 创建/编辑对话框 // 创建/编辑对话框
const [dialogOpen, setDialogOpen] = useState(false) const [dialogOpen, setDialogOpen] = useState(false)
const [editingMaterial, setEditingMaterial] = useState<MaterialFile | null>(null) const [editingMaterial, setEditingMaterial] = useState<MaterialFile | null>(null)
const [formData, setFormData] = useState<MaterialCreateRequest>({ const [formData, setFormData] = useState<MaterialCreateRequest & { status?: 'active' | 'inactive' }>({
subject_id: '', subject_id: '',
title: '', title: '',
description: '', description: '',
@@ -117,8 +117,7 @@ export default function Materials() {
const loadSubjects = useCallback(async () => { const loadSubjects = useCallback(async () => {
try { try {
const response = await subjectsApi.getSubjects() const response = await subjectsApi.getSubjects()
const data = response.data.data const data = response.data.data as MaterialSubject[] | { list: MaterialSubject[] } | undefined
// 后端返回 { list: [...] } 结构
const list = Array.isArray(data) ? data : (data?.list || []) const list = Array.isArray(data) ? data : (data?.list || [])
setSubjects(list) setSubjects(list)
} catch (error) { } catch (error) {
@@ -416,7 +415,7 @@ export default function Materials() {
{totalPages > 1 && ( {totalPages > 1 && (
<div className="mt-4"> <div className="mt-4">
<PaginationNavigator <PaginationNavigator
page={page} currentPage={page}
totalPages={totalPages} totalPages={totalPages}
onPageChange={setPage} onPageChange={setPage}
/> />

View File

@@ -12,7 +12,7 @@ import {
TableHeader, TableHeader,
TableRow, TableRow,
} from '@/components/ui/table' } from '@/components/ui/table'
import { RefreshCw, Loader2, Users, Shield, Check } from 'lucide-react' import { RefreshCw, Loader2, Users, Check } from 'lucide-react'
// 角色颜色映射 // 角色颜色映射
const roleColors: Record<string, { bg: string; text: string; border: string }> = { const roleColors: Record<string, { bg: string; text: string; border: string }> = {

1
tsconfig.tsbuildinfo Normal file
View File

@@ -0,0 +1 @@
{"fileNames":[],"fileInfos":[],"root":[],"version":"5.9.3"}