From 0a0acf1fe7f5fdea0c1cc44fbc9145b29eb3071b Mon Sep 17 00:00:00 2001 From: abearxiong Date: Sat, 28 Feb 2026 04:12:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E5=8C=BA=E9=A1=B5=E9=9D=A2=E5=8F=8A=E7=9B=B8=E5=85=B3=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=AE=A1=E7=90=86=EF=BC=8C=E4=BC=98=E5=8C=96=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 6 ++--- src/pages/workspaces/page.tsx | 30 +++++++++++++++++++++++ src/pages/workspaces/store/index.ts | 14 +++++++++++ src/routeTree.gen.ts | 37 ++++++++++++++++++++++++++--- src/routes/workspaces/index.tsx | 9 +++++++ vite.config.ts | 2 +- 6 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 src/pages/workspaces/page.tsx create mode 100644 src/pages/workspaces/store/index.ts create mode 100644 src/routes/workspaces/index.tsx diff --git a/.env.example b/.env.example index 3d591d3..a4b76ec 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ ## 本地环境 -# VITE_API_URL = "http://localhost:8000" +# VITE_API_URL="http://localhost:8000" ### 开发环境 -VITE_API_URL = "https://kevisual.xiongxiao.me" +VITE_API_URL="https://kevisual.xiongxiao.me" ### 生产环境 -# VITE_API_URL = "https://kevisual.cn" +# VITE_API_UR="https://kevisual.cn" diff --git a/src/pages/workspaces/page.tsx b/src/pages/workspaces/page.tsx new file mode 100644 index 0000000..764464b --- /dev/null +++ b/src/pages/workspaces/page.tsx @@ -0,0 +1,30 @@ +import { useShallow } from "zustand/shallow"; +import { useMarkStore, useWorkspaceStore } from "./store"; +import { useEffect } from "react"; +export const App = () => { + const markStore = useMarkStore(useShallow(state => { + return { + init: state.init, + list: state.list, + } + })); + const workspaceStore = useWorkspaceStore(useShallow(state => { + return { + edit: state.edit, + setEdit: state.setEdit, + } + })); + useEffect(() => { + // @ts-ignore + markStore.init('cnb'); + }, []); + console.log('markStore.list', markStore.list); + return ( +
+

Workspaces

+

This is the workspaces page.

+
+ ); +}; + +export default App; \ No newline at end of file diff --git a/src/pages/workspaces/store/index.ts b/src/pages/workspaces/store/index.ts new file mode 100644 index 0000000..e0e73cd --- /dev/null +++ b/src/pages/workspaces/store/index.ts @@ -0,0 +1,14 @@ +import { useMarkStore } from '@kevisual/api/store-mark'; +export { useMarkStore } + +import { create } from 'zustand'; + +type WorkspaceState = { + edit: boolean; + setEdit: (edit: boolean) => void; +} + +export const useWorkspaceStore = create((set) => ({ + edit: false, + setEdit: (edit) => set({ edit }), +})); \ No newline at end of file diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts index 0275425..f65db4d 100644 --- a/src/routeTree.gen.ts +++ b/src/routeTree.gen.ts @@ -11,6 +11,7 @@ import { Route as rootRouteImport } from './routes/__root' import { Route as LoginRouteImport } from './routes/login' import { Route as IndexRouteImport } from './routes/index' +import { Route as WorkspacesIndexRouteImport } from './routes/workspaces/index' import { Route as RepoIndexRouteImport } from './routes/repo/index' import { Route as ConfigIndexRouteImport } from './routes/config/index' import { Route as ConfigGiteaRouteImport } from './routes/config/gitea' @@ -25,6 +26,11 @@ const IndexRoute = IndexRouteImport.update({ path: '/', getParentRoute: () => rootRouteImport, } as any) +const WorkspacesIndexRoute = WorkspacesIndexRouteImport.update({ + id: '/workspaces/', + path: '/workspaces/', + getParentRoute: () => rootRouteImport, +} as any) const RepoIndexRoute = RepoIndexRouteImport.update({ id: '/repo/', path: '/repo/', @@ -47,6 +53,7 @@ export interface FileRoutesByFullPath { '/config/gitea': typeof ConfigGiteaRoute '/config/': typeof ConfigIndexRoute '/repo/': typeof RepoIndexRoute + '/workspaces/': typeof WorkspacesIndexRoute } export interface FileRoutesByTo { '/': typeof IndexRoute @@ -54,6 +61,7 @@ export interface FileRoutesByTo { '/config/gitea': typeof ConfigGiteaRoute '/config': typeof ConfigIndexRoute '/repo': typeof RepoIndexRoute + '/workspaces': typeof WorkspacesIndexRoute } export interface FileRoutesById { __root__: typeof rootRouteImport @@ -62,13 +70,27 @@ export interface FileRoutesById { '/config/gitea': typeof ConfigGiteaRoute '/config/': typeof ConfigIndexRoute '/repo/': typeof RepoIndexRoute + '/workspaces/': typeof WorkspacesIndexRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/login' | '/config/gitea' | '/config/' | '/repo/' + fullPaths: + | '/' + | '/login' + | '/config/gitea' + | '/config/' + | '/repo/' + | '/workspaces/' fileRoutesByTo: FileRoutesByTo - to: '/' | '/login' | '/config/gitea' | '/config' | '/repo' - id: '__root__' | '/' | '/login' | '/config/gitea' | '/config/' | '/repo/' + to: '/' | '/login' | '/config/gitea' | '/config' | '/repo' | '/workspaces' + id: + | '__root__' + | '/' + | '/login' + | '/config/gitea' + | '/config/' + | '/repo/' + | '/workspaces/' fileRoutesById: FileRoutesById } export interface RootRouteChildren { @@ -77,6 +99,7 @@ export interface RootRouteChildren { ConfigGiteaRoute: typeof ConfigGiteaRoute ConfigIndexRoute: typeof ConfigIndexRoute RepoIndexRoute: typeof RepoIndexRoute + WorkspacesIndexRoute: typeof WorkspacesIndexRoute } declare module '@tanstack/react-router' { @@ -95,6 +118,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof IndexRouteImport parentRoute: typeof rootRouteImport } + '/workspaces/': { + id: '/workspaces/' + path: '/workspaces' + fullPath: '/workspaces/' + preLoaderRoute: typeof WorkspacesIndexRouteImport + parentRoute: typeof rootRouteImport + } '/repo/': { id: '/repo/' path: '/repo' @@ -125,6 +155,7 @@ const rootRouteChildren: RootRouteChildren = { ConfigGiteaRoute: ConfigGiteaRoute, ConfigIndexRoute: ConfigIndexRoute, RepoIndexRoute: RepoIndexRoute, + WorkspacesIndexRoute: WorkspacesIndexRoute, } export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) diff --git a/src/routes/workspaces/index.tsx b/src/routes/workspaces/index.tsx new file mode 100644 index 0000000..2ab3dd9 --- /dev/null +++ b/src/routes/workspaces/index.tsx @@ -0,0 +1,9 @@ +import { createFileRoute } from '@tanstack/react-router' +import App from '@/pages/workspaces/page' +export const Route = createFileRoute('/workspaces/')({ + component: RouteComponent, +}) + +function RouteComponent() { + return +} diff --git a/vite.config.ts b/vite.config.ts index 9e19d8d..029423b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,7 +4,7 @@ import path from 'path'; import pkgs from './package.json'; import tailwindcss from '@tailwindcss/vite'; import { tanstackRouter } from '@tanstack/router-plugin/vite' - +import 'dotenv/config'; const isDev = process.env.NODE_ENV === 'development'; const basename = isDev ? '/' : pkgs?.basename || '/';