Ver código fonte

✨ feat(admin): add file management module

- add file management menu item with FileTextOutlined icon
- add FilesPage component and export it properly
- add file management route configuration at /admin/files
yourname 4 meses atrás
pai
commit
946d85e635

+ 8 - 0
src/client/admin/menu.tsx

@@ -7,6 +7,7 @@ import {
   DashboardOutlined,
   TeamOutlined,
   InfoCircleOutlined,
+  FileTextOutlined,
 } from '@ant-design/icons';
 
 export interface MenuItem {
@@ -85,6 +86,13 @@ export const useMenu = () => {
       path: '/admin/users',
       permission: 'user:manage'
     },
+    {
+      key: 'files',
+      label: '文件管理',
+      icon: <FileTextOutlined />,
+      path: '/admin/files',
+      permission: 'file:manage'
+    },
   ];
 
   // 用户菜单项

+ 2 - 4
src/client/admin/pages/Files.tsx

@@ -14,7 +14,7 @@ type FileListResponse = InferResponseType<typeof fileClient.$get, 200>;
 type ClientItem = InferResponseType<typeof clientClient.$get, 200>['data'][0];
 type UpdateFileRequest = InferRequestType<typeof fileClient[':id']['$put']>['json'];
 
-const Files: React.FC = () => {
+export const FilesPage: React.FC = () => {
   const { message } = App.useApp();
   const [form] = Form.useForm();
   const [modalVisible, setModalVisible] = useState(false);
@@ -343,6 +343,4 @@ const Files: React.FC = () => {
       </Modal>
     </div>
   );
-};
-
-export default Files;
+};

+ 6 - 0
src/client/admin/routes.tsx

@@ -7,6 +7,7 @@ import { NotFoundPage } from './components/NotFoundPage';
 import { DashboardPage } from './pages/Dashboard';
 import { UsersPage } from './pages/Users';
 import { LoginPage } from './pages/Login';
+import { FilesPage } from './pages/Files';
 
 export const router = createBrowserRouter([
   {
@@ -39,6 +40,11 @@ export const router = createBrowserRouter([
         element: <UsersPage />,
         errorElement: <ErrorPage />
       },
+      {
+        path: 'files',
+        element: <FilesPage />,
+        errorElement: <ErrorPage />
+      },
       {
         path: '*',
         element: <NotFoundPage />,