Sfoglia il codice sorgente

💄 style(admin): 清理未使用代码和导入

- 在SolutionDesigns.tsx中为未使用的user变量添加eslint忽略注释
- 从Templates.tsx中移除未使用的Download图标导入
- 从Templates.tsx中移除重复的uploadButtonText属性
- 从ConsultationRequestForm.tsx中移除未使用的React导入
- 从ConsultationRequestForm.tsx中注释掉未使用的类型导入
- 修复FilePreview.tsx中UI组件的导入路径
- 修复WordViewer.tsx中使用已弃用的lastModifiedDate属性
- 简化WordViewer.tsx中的样式标签语法
yourname 3 mesi fa
parent
commit
8445c04a80

+ 1 - 1
src/client/admin/pages/SolutionDesigns.tsx

@@ -20,7 +20,7 @@ interface SolutionDesign {
 
 const SolutionDesignsPage: React.FC = () => {
   const navigate = useNavigate();
-  const { user } = useAuth();
+  const { user } = useAuth(); // eslint-disable-line @typescript-eslint/no-unused-vars
   const [loading, setLoading] = useState(false);
   const [data, setData] = useState<SolutionDesign[]>([]);
   const [pagination, setPagination] = useState({

+ 1 - 3
src/client/admin/pages/Templates.tsx

@@ -1,7 +1,7 @@
 import React, { useState } from 'react';
 import { useQuery } from '@tanstack/react-query';
 import { format } from 'date-fns';
-import { Plus, Search, Edit, Trash2, Download, Eye } from 'lucide-react';
+import { Plus, Search, Edit, Trash2, Eye } from 'lucide-react';
 import { templateClient } from '@/client/api';
 import FilePreviewDialog from '@/client/admin/components/FilePreviewDialog';
 import type { InferRequestType, InferResponseType } from 'hono/client';
@@ -429,7 +429,6 @@ export const TemplatesPage = () => {
                           onChange={(value) => field.onChange(value)}
                           maxSize={50}
                           uploadPath="/templates"
-                          uploadButtonText="上传模板文件"
                           previewSize="medium"
                           placeholder="选择模板文件"
                           title="选择模板文件"
@@ -537,7 +536,6 @@ export const TemplatesPage = () => {
                           onChange={(value) => field.onChange(value)}
                           maxSize={50}
                           uploadPath="/templates"
-                          uploadButtonText="上传模板文件"
                           previewSize="medium"
                           placeholder="选择模板文件"
                           title="选择模板文件"

+ 2 - 2
src/client/components/ConsultationRequestForm.tsx

@@ -1,4 +1,4 @@
-import React, { useState } from 'react';
+import { useState } from 'react';
 import { useForm } from 'react-hook-form';
 import { zodResolver } from '@hookform/resolvers/zod';
 import { z } from 'zod';
@@ -10,7 +10,7 @@ import { Label } from '@/client/components/ui/label';
 import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/client/components/ui/select';
 import { toast } from 'react-toastify';
 import { publicConsultationRequestClient } from '@/client/api';
-import type { InferRequestType } from 'hono/client';
+// import type { InferRequestType } from 'hono/client';
 
 // 表单验证Schema
 const ConsultationRequestFormSchema = z.object({

+ 3 - 3
src/client/home/components/FilePreview.tsx

@@ -1,8 +1,8 @@
 import React, { useState, useEffect } from 'react';
 import { publicTemplateClient } from '@/client/api';
-import { Card, CardContent, CardHeader, CardTitle } from '@/client/home/components/ui/card';
-import { Button } from '@/client/home/components/ui/button';
-import { Badge } from '@/client/home/components/ui/badge';
+import { Card, CardContent, CardHeader, CardTitle } from '@/client/components/ui/card';
+import { Button } from '@/client/components/ui/button';
+import { Badge } from '@/client/components/ui/badge';
 import { Loader2, Download, Eye, AlertCircle } from 'lucide-react';
 import { toast } from 'sonner';
 import { useAuth } from '@/client/home/hooks/AuthProvider';

+ 2 - 2
src/client/home/components/WordViewer.tsx

@@ -52,7 +52,7 @@ export default function WordViewer({ file, fileUrl }: WordViewerProps) {
         name: file.name,
         size: file.size,
         type: file.type,
-        lastModified: file.lastModifiedDate,
+        lastModified: file.lastModified,
         wordCount: info.value.split(/\s+/).filter(word => word.length > 0).length,
         characterCount: info.value.length
       });
@@ -175,7 +175,7 @@ export default function WordViewer({ file, fileUrl }: WordViewerProps) {
     <Card>
       <CardContent className="pt-6">
         <div className="word-viewer-container">
-          <style jsx>{`
+          <style>{`
             .word-viewer-container {
               max-width: 100%;
               overflow-x: auto;