chore(toolchain): upgrade Bun to 1.4.4 and migrate console to TanStack Router
This commit is contained in:
1 parent
b44ebc2ba1
commit
3b9376c75a
134 files changed
+893
-692
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import { PasswordChangeRequest, type SessionInfo } from "@umt/contracts";
|
||||
import { KeyRound, LoaderCircle, LogOut, ShieldCheck, UserRound } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { useNavigate } from "react-router";
|
||||
import { toast } from "sonner";
|
||||
import { z } from "zod";
|
||||
import { useChangePassword, useLogout } from "~/api/auth.ts";
|
||||
@@ -17,6 +16,7 @@ import {
|
||||
import { Input } from "~/components/ui/input.tsx";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "~/components/ui/popover.tsx";
|
||||
import { errorMessage, LOGIN_PATH } from "~/lib/api.ts";
|
||||
import { useNavigate } from "~/lib/router-compat.tsx";
|
||||
import { cn, formatDateTime } from "~/lib/utils.ts";
|
||||
import { FormField, zodFieldErrors } from "./form-field.tsx";
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Bot, Keyboard } from "lucide-react";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { useLocation } from "react-router";
|
||||
import { isRunActive, RUN_STATUS_LABEL, useAgentRuns } from "~/api/agent.ts";
|
||||
import { AGENT_LAUNCHER_ATTR } from "~/components/agent/agent-drawer.tsx";
|
||||
import {
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
shortGoalTitle,
|
||||
toggleAgentDrawer,
|
||||
} from "~/components/agent/agent-store.ts";
|
||||
import { useLocation } from "~/lib/router-compat.tsx";
|
||||
import { cn } from "~/lib/utils.ts";
|
||||
|
||||
// 智能体抽屉的入口只有一个按钮:桌面是侧栏最上方的「智能体」,没有侧栏的窄屏是顶栏胶囊里的智能体按钮
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Decision } from "@umt/contracts";
|
||||
import { ArrowRight, Bell, CheckCheck } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { Link, useNavigate } from "react-router";
|
||||
import { useAttention } from "~/api/attention.ts";
|
||||
import { EmptyState, ErrorState, LoadingState } from "~/components/console/empty-state.tsx";
|
||||
import { consolePath } from "~/components/console/nav.ts";
|
||||
@@ -10,6 +9,7 @@ import { SEVERITY } from "~/components/library/labels.ts";
|
||||
import { Button } from "~/components/ui/button.tsx";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "~/components/ui/popover.tsx";
|
||||
import { formatRelative } from "~/lib/labels.ts";
|
||||
import { Link, useNavigate } from "~/lib/router-compat.tsx";
|
||||
import { cn } from "~/lib/utils.ts";
|
||||
|
||||
// 顶栏铃铛(2026-10-06 起只放两类):需要你批准的智能体操作(会话里的审批 / 方案选择、计划审批、原站页面等你接手)
|
||||
|
||||
@@ -12,16 +12,18 @@ import {
|
||||
} from "./nav.ts";
|
||||
import { recordPath, taskPath } from "./record-sheet.tsx";
|
||||
|
||||
/** routes.ts 里登记的控制台路由(相对 /console) */
|
||||
/** TanStack 路由表里登记的控制台路由(相对 /console) */
|
||||
const ROUTE_PATTERNS = [
|
||||
"",
|
||||
...[...readFileSync(new URL("../../routes.ts", import.meta.url), "utf8").matchAll(/route\("([^"*]+)",/g)].map(
|
||||
"agent",
|
||||
"agent/$runId",
|
||||
...[...readFileSync(new URL("../../router.tsx", import.meta.url), "utf8").matchAll(/page\("([^"*]+)",/g)].map(
|
||||
(m) => m[1] as string,
|
||||
),
|
||||
];
|
||||
const matchesRoute = (pathname: string) => {
|
||||
const rest = pathname.replace(/^\/console\/?/, "");
|
||||
return ROUTE_PATTERNS.some((p) => new RegExp(`^${p.replace(/:[^/]+/g, "[^/]+")}$`).test(rest));
|
||||
return ROUTE_PATTERNS.some((p) => new RegExp(`^${p.replace(/\$[^/]+/g, "[^/]+")}$`).test(rest));
|
||||
};
|
||||
|
||||
describe("控制台导航", () => {
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { useCallback, useRef } from "react";
|
||||
import { Link, type LinkProps, type Location, useLocation, useNavigate, useSearchParams } from "react-router";
|
||||
import { consolePath } from "~/components/console/nav.ts";
|
||||
import {
|
||||
Link,
|
||||
type LinkProps,
|
||||
type Location,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
useSearchParams,
|
||||
} from "~/lib/router-compat.tsx";
|
||||
|
||||
// 记录抽屉的地址约定(docs/design/console-ia.md §9):从列表打开的记录 = 列表页上的右侧抽屉,
|
||||
// 打开的记录写在 ?open=<id>(其余参数不动),刷新、分享、前进后退都能还原;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback } from "react";
|
||||
import { useSearchParams } from "react-router";
|
||||
import { useSearchParams } from "~/lib/router-compat.tsx";
|
||||
|
||||
/**
|
||||
* 列表页筛选状态写进 URL query(docs/design/console-ia.md §3.6),刷新和分享链接不丢筛选。
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Construction } from "lucide-react";
|
||||
import { useLocation } from "react-router";
|
||||
import { useLocation } from "~/lib/router-compat.tsx";
|
||||
import { EmptyState } from "./empty-state.tsx";
|
||||
import { findNavItem } from "./nav.ts";
|
||||
import { PageHeader } from "./page-header.tsx";
|
||||
|
||||
Reference in new issue
Block a user