diff --git a/package.json b/package.json index 3a5bcca..aa4727c 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "dev:lib": "turbo dev:lib", "dev:query": "turbo dev:lib --filter=@kevisual/query", "turbo:build": "turbo build --filter=submodules/**", - "build:lib": "turbo build --filter=@kevisual/query**" + "build:lib": "turbo build --filter=@kevisual/query**", + "vi": "pnpm dlx vite-bundle-visualizer -o ./dist/stats.html" }, "dependencies": { "@ant-design/icons": "^6.0.0", diff --git a/public/panda.png b/public/panda.png new file mode 100644 index 0000000..c1e67f6 Binary files /dev/null and b/public/panda.png differ diff --git a/src/App.tsx b/src/App.tsx index 99ea436..e63321f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,26 +1,36 @@ import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; -import { App as ContainerApp } from './pages/container'; -import { App as MapApp } from './pages/map'; -import { App as UserApp } from './pages/user'; +// import { App as ContainerApp } from './pages/container'; import { App as UserAppApp } from './pages/app'; -import { App as FileApp } from './pages/file'; -import { App as OrgApp } from './pages/org'; -import { App as ConfigApp } from './pages/config'; -import { App as PayApp } from './pages/pay'; -import { App as DomainApp } from './pages/domain'; import { App as HomeApp } from './pages/home'; + +// import { App as MapApp } from './pages/map'; +// import { App as UserApp } from './pages/user'; +// import { App as FileApp } from './pages/file'; +// import { App as OrgApp } from './pages/org'; +// import { App as ConfigApp } from './pages/config'; +// import { App as DomainApp } from './pages/domain'; + import { basename } from './modules/basename'; import { Redirect } from './modules/Redirect'; -import { CustomThemeProvider, useTheme, themeOptions, theme } from '@kevisual/components/theme/index.tsx'; +import { useTheme, theme } from '@kevisual/components/theme/index.tsx'; import { ToastContainer } from 'react-toastify'; +import { lazy, Suspense } from 'react'; import 'dayjs/locale/zh-cn'; import 'dayjs/locale/en'; import zhCN from 'antd/locale/zh_CN'; import enUS from 'antd/locale/en_US'; import ConfigProvider from 'antd/es/config-provider'; import { useTranslation } from 'react-i18next'; -import { useEffect, useState } from 'react'; -import { ThemeProvider, createTheme } from '@mui/material'; +import React, { useEffect, useState } from 'react'; +import { ThemeProvider } from '@mui/material'; +const ContainerApp = lazy(() => import('./pages/container')); +const MapApp = lazy(() => import('./pages/map')); +const UserApp = lazy(() => import('./pages/user')); +const FileApp = lazy(() => import('./pages/file')); +const OrgApp = lazy(() => import('./pages/org')); +const ConfigApp = lazy(() => import('./pages/config')); +const DomainApp = lazy(() => import('./pages/domain')); + export const CustomThemeProvider2 = ({ children }: { children: React.ReactNode }) => { return {children}; }; @@ -75,7 +85,14 @@ export const App = () => { } /> - } /> + + + + } + /> } /> } /> } /> @@ -83,7 +100,6 @@ export const App = () => { } /> } /> } /> - } /> } /> } /> 404} /> diff --git a/src/assets/index.tsx b/src/assets/index.tsx new file mode 100644 index 0000000..fcfe45f --- /dev/null +++ b/src/assets/index.tsx @@ -0,0 +1,4 @@ +import PandaPNG from '@/assets/panda.jpg'; +// import PandaPNG from '@/assets/panda.png'; + +export { PandaPNG }; diff --git a/src/assets/panda-320*320.jpg b/src/assets/panda-320*320.jpg new file mode 100644 index 0000000..0f1beff Binary files /dev/null and b/src/assets/panda-320*320.jpg differ diff --git a/src/assets/panda.jpg b/src/assets/panda.jpg new file mode 100644 index 0000000..0f1beff Binary files /dev/null and b/src/assets/panda.jpg differ diff --git a/src/main.tsx b/src/main.tsx index 6894e00..889c9ed 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,7 +1,6 @@ import { createRoot } from 'react-dom/client'; import { App } from './App.tsx'; import './globals.css'; -import { basename } from './modules/basename.ts'; import { Suspense } from 'react'; import { I18NextProvider } from '@kevisual/components/translate/I18Next.tsx'; diff --git a/src/modules/layout/LayoutUser.tsx b/src/modules/layout/LayoutUser.tsx index 7a4e250..d541c40 100644 --- a/src/modules/layout/LayoutUser.tsx +++ b/src/modules/layout/LayoutUser.tsx @@ -12,7 +12,6 @@ import { useNewNavigate } from '../navicate'; import { LogOut, Map, SquareUser, Users, X, ArrowDownLeftFromSquareIcon } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import React from 'react'; -import { useQuickMenu } from './Menu'; export const LayoutUser = () => { const { open, setOpen, isAdmin, ...store } = useLayoutStore( diff --git a/src/modules/layout/Menu.tsx b/src/modules/layout/Menu.tsx index 897e755..dbe35f6 100644 --- a/src/modules/layout/Menu.tsx +++ b/src/modules/layout/Menu.tsx @@ -16,6 +16,11 @@ import { Map } from 'lucide-react'; export const useQuickMenu = () => { const { t } = useTranslation(); return [ + { + title: t('Home'), + icon: , + link: '/home', + }, { title: t('User App'), icon: , diff --git a/src/modules/layout/index.tsx b/src/modules/layout/index.tsx index 6c9c3d4..b61dcaa 100644 --- a/src/modules/layout/index.tsx +++ b/src/modules/layout/index.tsx @@ -6,7 +6,7 @@ import { useLayoutStore, usePlatformStore } from './store'; import { useShallow } from 'zustand/react/shallow'; import { useEffect, useLayoutEffect, useState } from 'react'; import { LayoutUser } from './LayoutUser'; -import PandaPNG from '@/assets/panda.png'; +import { PandaPNG } from '@/assets/index.tsx'; import QRCodePNG from '@/assets/qrcode-8x8.jpg'; import { Panel, PanelGroup } from 'react-resizable-panels'; import clsx from 'clsx'; @@ -93,7 +93,7 @@ export const LayoutMain = (props: LayoutMainProps) => {
-
{props.title}
+
{props.title}
{quickMenu.map((item, index) => { const isActive = location.pathname.includes(item.link); diff --git a/src/pages/app/index.tsx b/src/pages/app/index.tsx index ad04eab..88567a0 100644 --- a/src/pages/app/index.tsx +++ b/src/pages/app/index.tsx @@ -14,3 +14,5 @@ export const App = () => { ); }; + +export default App; \ No newline at end of file diff --git a/src/pages/config/index.tsx b/src/pages/config/index.tsx index 392761d..36bec72 100644 --- a/src/pages/config/index.tsx +++ b/src/pages/config/index.tsx @@ -12,3 +12,5 @@ export const App = () => { ); }; + +export default App; \ No newline at end of file diff --git a/src/pages/container/index.tsx b/src/pages/container/index.tsx index 7e1adbb..d33512a 100644 --- a/src/pages/container/index.tsx +++ b/src/pages/container/index.tsx @@ -16,3 +16,4 @@ export const App = () => { ); }; +export default App; diff --git a/src/pages/container/module/DrawEdit.tsx b/src/pages/container/module/DrawEdit.tsx index 682f719..2b193bc 100644 --- a/src/pages/container/module/DrawEdit.tsx +++ b/src/pages/container/module/DrawEdit.tsx @@ -1,5 +1,4 @@ -import { useEffect, useRef, useState } from 'react'; -import { BaseEditor } from '@kevisual/codemirror/editor/editor.ts'; +import { lazy, useEffect, useRef, useState } from 'react'; import { Box, Drawer } from '@mui/material'; import { useShallow } from 'zustand/shallow'; import { useContainerStore } from '../store'; @@ -8,6 +7,7 @@ import { IconButton } from '@kevisual/components/button/index.tsx'; import { LeftOutlined, SaveOutlined } from '@ant-design/icons'; // import { previewCode } from './preview-code'; // import { StackIcons } from './StackIcons'; +import { BaseEditor } from '@kevisual/codemirror/editor/editor.ts'; export const DrawEdit = () => { const editorElRef = useRef(null); diff --git a/src/pages/domain/index.tsx b/src/pages/domain/index.tsx index a099304..5ae2064 100644 --- a/src/pages/domain/index.tsx +++ b/src/pages/domain/index.tsx @@ -12,3 +12,5 @@ export const App = () => { ); }; + +export default App; \ No newline at end of file diff --git a/src/pages/file/index.tsx b/src/pages/file/index.tsx index dec3fd1..899e663 100644 --- a/src/pages/file/index.tsx +++ b/src/pages/file/index.tsx @@ -12,3 +12,5 @@ export const App = () => { ); }; + +export default App; diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx index d6035b1..8f8f8d8 100644 --- a/src/pages/home/index.tsx +++ b/src/pages/home/index.tsx @@ -10,3 +10,5 @@ export const App = () => { ); }; + +export default App; \ No newline at end of file diff --git a/src/pages/map/index.tsx b/src/pages/map/index.tsx index f9fc497..f60f33a 100644 --- a/src/pages/map/index.tsx +++ b/src/pages/map/index.tsx @@ -81,3 +81,6 @@ const ServerPath = () => { ); }; export const App = ServerPath; + + +export default App; \ No newline at end of file diff --git a/src/pages/org/index.tsx b/src/pages/org/index.tsx index 9d4fe02..4345a94 100644 --- a/src/pages/org/index.tsx +++ b/src/pages/org/index.tsx @@ -15,3 +15,5 @@ export const App = () => { ); }; + +export default App; diff --git a/src/pages/pay/index.tsx b/src/pages/pay/index.tsx index 67c315c..9097010 100644 --- a/src/pages/pay/index.tsx +++ b/src/pages/pay/index.tsx @@ -2,8 +2,7 @@ import React, { useEffect, useRef, useState } from 'react'; import { X, ChevronRight } from 'lucide-react'; import { usePayStore } from './store/pay'; import { createQrcode } from './modules/create-qrcode'; -import Panda from '@/assets/panda.png'; -import Button from '@mui/material/Button/Button'; +import { Button } from '@mui/material'; export const App = () => { const [isAgreed, setIsAgreed] = useState(false); const qrcodeRef = useRef(null); @@ -38,7 +37,7 @@ export const App = () => { {/* Header */}
- User Avatar + User Avatar

{username}

会员:已过期 @@ -89,3 +88,5 @@ export const App = () => {
); }; + +export default App; diff --git a/src/pages/user/edit/Profile.tsx b/src/pages/user/edit/Profile.tsx index 328f523..87cdbab 100644 --- a/src/pages/user/edit/Profile.tsx +++ b/src/pages/user/edit/Profile.tsx @@ -7,7 +7,7 @@ import { useShallow } from 'zustand/react/shallow'; import { isObjectNull } from '@/utils/is-null'; import { useLayoutStore } from '@/modules/layout/store'; import UploadOutlined from '@ant-design/icons/UploadOutlined'; -import PandaPNG from '@/assets/panda.png'; +import { PandaPNG } from '@/assets/index.tsx'; import { FileUpload } from '../module/FileUpload'; import { useTranslation } from 'react-i18next'; import { Edit, UserCog } from 'lucide-react'; diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 6bced85..cd3b6bd 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -18,3 +18,5 @@ export const App = () => { ); }; + +export default App; \ No newline at end of file diff --git a/submodules/query-login b/submodules/query-login index 557cd99..bae8275 160000 --- a/submodules/query-login +++ b/submodules/query-login @@ -1 +1 @@ -Subproject commit 557cd99b20ae6c051d5b448e32c6fc6075e4b04e +Subproject commit bae8275b11d5808fd07c3172441dfc738fef525c diff --git a/vite.config.ts b/vite.config.ts index c379f51..26a5d88 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -53,13 +53,14 @@ export default defineConfig({ }, base: isDev ? '/' : '/root/center/', build: { + sourcemap: false, rollupOptions: { output: { // 控制输出 // 在rollup里面, hash代表将你的文件名和文件内容进行组合计算得来的结果 assetFileNames: (chunkInfo) => { console.log(chunkInfo.names); - if (chunkInfo.names?.includes('panda.png')) { + if (chunkInfo.names?.includes('panda.jpg')) { return '[name].[ext]'; } const qrcode = ['qrcode-8x8.jpg']; @@ -69,6 +70,20 @@ export default defineConfig({ } return '[name].[hash].[ext]'; }, + manualChunks(id) { + if (id.includes('node_modules')) { + if (id.includes('react')) { + return 'vendor-react'; + } + // prettier + if (id.includes('prettier')) { + return 'vendor-prettier'; + } + // codemirror + // console.log(id); + return 'vendor'; + } + }, }, }, },