Sfoglia il codice sorgente

♻️ refactor(dependencies): reorder and clean up package.json dependencies

- move all production dependencies to the top section
- maintain consistent alphabetical order for better readability
- remove duplicate entries and ensure version consistency

🔧 chore(deps): add missing debug type definitions

- add @types/debug@^4.1.12 to devDependencies for type safety

♻️ refactor(mobile): update auth provider import paths

- replace home/hooks/AuthProvider imports with mobile/hooks/AuthProvider in login/register pages
- remove unused debug import from MemberPage
- clean up unused hooks and client imports in MemberPage

✨ feat(mobile): add main layout and default route

- introduce MainLayout component for consistent mobile page structure
- add default route for mobile root path showing StockHomePage
yourname 7 mesi fa
parent
commit
0c0c790d82

+ 8 - 7
package.json

@@ -19,37 +19,38 @@
     "@hono/swagger-ui": "^0.5.2",
     "@hono/zod-openapi": "^1.0.2",
     "@tanstack/react-query": "^5.83.0",
+    "aliyun-rtc-sdk": "^7.1.1",
     "antd": "^5.26.6",
     "axios": "^1.11.0",
     "bcrypt": "^6.0.0",
     "compression": "^1.8.0",
     "dayjs": "^1.11.13",
     "debug": "^4.4.1",
+    "decimal.js": "^10.6.0",
+    "dotenv": "^16.5.0",
+    "echarts": "^5.6.0",
     "express": "^5.1.0",
     "hono": "^4.8.5",
+    "ioredis": "^5.6.1",
     "jsonwebtoken": "^9.0.2",
+    "minio": "^8.0.5",
     "mysql2": "^3.14.2",
     "react": "^19.1.0",
     "react-dom": "^19.1.0",
     "react-hook-form": "^7.61.1",
     "react-router": "^7.7.0",
     "react-router-dom": "^7.7.0",
+    "react-toastify": "^11.0.5",
     "reflect-metadata": "^0.2.2",
     "sirv": "^3.0.1",
     "socket.io": "^4.8.1",
     "socket.io-client": "^4.8.1",
     "typeorm": "^0.3.25",
-    "react-toastify": "^11.0.5",
-    "minio": "^8.0.5",
-    "ioredis": "^5.6.1",
-    "echarts": "^5.6.0",
-    "dotenv": "^16.5.0",
-    "decimal.js": "^10.6.0",
-    "aliyun-rtc-sdk": "^7.1.1",
     "vod-js-sdk-v6": "1.7.1-beta.1"
   },
   "devDependencies": {
     "@tailwindcss/vite": "^4.1.11",
+    "@types/debug": "^4.1.12",
     "@types/express": "^5.0.3",
     "@types/node": "^24.0.10",
     "@types/react": "^19.1.8",

+ 15 - 0
pnpm-lock.yaml

@@ -117,6 +117,9 @@ importers:
       '@tailwindcss/vite':
         specifier: ^4.1.11
         version: 4.1.11(vite@7.0.5(@types/node@24.1.0)(jiti@2.5.1)(lightningcss@1.30.1)(tsx@4.20.3)(yaml@2.8.0))
+      '@types/debug':
+        specifier: ^4.1.12
+        version: 4.1.12
       '@types/express':
         specifier: ^5.0.3
         version: 5.0.3
@@ -880,6 +883,9 @@ packages:
   '@types/cors@2.8.19':
     resolution: {integrity: sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==}
 
+  '@types/debug@4.1.12':
+    resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
+
   '@types/dom-mediacapture-transform@0.1.11':
     resolution: {integrity: sha512-Y2p+nGf1bF2XMttBnsVPHUWzRRZzqUoJAKmiP10b5umnO6DDrWI0BrGDJy1pOHoOULVmGSfFNkQrAlC5dcj6nQ==}
 
@@ -904,6 +910,9 @@ packages:
   '@types/mime@1.3.5':
     resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==}
 
+  '@types/ms@2.1.0':
+    resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
+
   '@types/node-fetch@2.6.12':
     resolution: {integrity: sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==}
 
@@ -3226,6 +3235,10 @@ snapshots:
     dependencies:
       '@types/node': 24.1.0
 
+  '@types/debug@4.1.12':
+    dependencies:
+      '@types/ms': 2.1.0
+
   '@types/dom-mediacapture-transform@0.1.11':
     dependencies:
       '@types/dom-webcodecs': 0.1.15
@@ -3253,6 +3266,8 @@ snapshots:
 
   '@types/mime@1.3.5': {}
 
+  '@types/ms@2.1.0': {}
+
   '@types/node-fetch@2.6.12':
     dependencies:
       '@types/node': 24.1.0

+ 1 - 1
src/client/mobile/pages/LoginPage.tsx

@@ -2,7 +2,7 @@ import React, { useState } from 'react';
 import { useForm } from 'react-hook-form';
 import { EyeIcon, EyeSlashIcon, UserIcon, LockClosedIcon } from '@heroicons/react/24/outline';
 import { useNavigate } from 'react-router-dom';
-import { useAuth } from '@/client/home/hooks/AuthProvider';
+import { useAuth } from '@/client/mobile/hooks/AuthProvider';
 
 const LoginPage: React.FC = () => {
   const { register, handleSubmit, formState: { errors } } = useForm();

+ 2 - 6
src/client/mobile/pages/MemberPage.tsx

@@ -1,11 +1,7 @@
-import debug from 'debug';
 import React from 'react';
 import { UserIcon, PencilIcon } from '@heroicons/react/24/outline';
-import { useParams, useNavigate } from 'react-router-dom';
-import { useQuery } from '@tanstack/react-query';
-import type { InferResponseType } from 'hono/client';
-import { userClient } from '@/client/api';
-import { useAuth, User } from '@/client/home/hooks/AuthProvider';
+import { useNavigate } from 'react-router-dom';
+import { useAuth } from '@/client/mobile/hooks/AuthProvider';
 
 const MemberPage: React.FC = () => {
   const navigate = useNavigate();

+ 1 - 1
src/client/mobile/pages/RegisterPage.tsx

@@ -2,7 +2,7 @@ import React, { useState } from 'react';
 import { useForm } from 'react-hook-form';
 import { EyeIcon, EyeSlashIcon, UserIcon, LockClosedIcon } from '@heroicons/react/24/outline';
 import { useNavigate } from 'react-router-dom';
-import { useAuth } from '@/client/home/hooks/AuthProvider';
+import { useAuth } from '@/client/mobile/hooks/AuthProvider';
 import { authClient } from '@/client/api';
 
 const RegisterPage: React.FC = () => {

+ 6 - 1
src/client/mobile/routes.tsx

@@ -18,6 +18,7 @@ import ExamAdmin from './components/Exam/ExamAdmin';
 import ExamCard from './components/Exam/ExamCard';
 import RegisterPage from './pages/RegisterPage';
 import MemberPage from './pages/MemberPage';
+import { MainLayout } from './layouts/MainLayout';
 
 export const router = createBrowserRouter([
   {
@@ -36,10 +37,14 @@ export const router = createBrowserRouter([
     path: '/mobile',
     element: (
       <ProtectedRoute>
-        <StockHomePage />
+        <MainLayout />
       </ProtectedRoute>
     ),
     children: [
+      {
+        path: '',
+        element: <StockHomePage />
+      },
       {
         path: 'member',
         element: <MemberPage />