test(frontend): UIUX E2E 测试 — 新增路由导航/创始人端/Admin端/工作台/移动端适配
新增 6 个 E2E 测试文件,覆盖 2-task-uiux.md 全部 50 项任务: - uiux-navigation.spec.ts: 8 tests (today/compare/threads/workspace/ooda/ai-plus/profiles) - sidebar-navigation.spec.ts: 6 tests (投资人 Sidebar 6 业务域) - founder-uiux.spec.ts: 7 tests (创始人端 6 域导航) - admin-uiux.spec.ts: 3 tests (Admin 6 管理域 + 商业秘密保护) - workbench-uiux.spec.ts: 5 tests (Highlights/WorkMode/Tab/InsightRail) - mobile-uiux.spec.ts: 5 tests (移动端抽屉导航 + 创始人底部导航) 同时修复全部 no-explicit-any 警告,替换为 TypeScript 接口定义。 测试结果: 41 E2E passed, 405 backend passed
This commit is contained in:
@@ -1,19 +1,35 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { Target, Plus } from "lucide-react";
|
||||
import {Plus } from "lucide-react";
|
||||
import { listOKRs } from "@/lib/api-v2";
|
||||
import { PageContainer, Badge, Card } from "@/components/shared/PageContainer";
|
||||
import { LoadingSpinner } from "@/components/shared/LoadingSpinner";
|
||||
import { EmptyState } from "@/components/shared/EmptyState";
|
||||
|
||||
/** OKR 关键结果项。 */
|
||||
interface KeyResult {
|
||||
title?: string;
|
||||
objective?: string;
|
||||
progress?: number;
|
||||
}
|
||||
|
||||
/** OKR 项。 */
|
||||
interface OKRItem {
|
||||
quarter: string;
|
||||
objective: string;
|
||||
alignment_score?: number;
|
||||
status: string;
|
||||
key_results?: KeyResult[];
|
||||
}
|
||||
|
||||
export default function OKRsPage() {
|
||||
const [items, setItems] = useState<Record<string, any>[]>([]);
|
||||
const [items, setItems] = useState<OKRItem[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
listOKRs()
|
||||
.then((resp) => setItems((resp.data as Record<string, any>[]) ?? []))
|
||||
.then((resp) => setItems((resp.data as OKRItem[]) ?? []))
|
||||
.catch(() => setItems([]))
|
||||
.finally(() => setIsLoading(false));
|
||||
}, []);
|
||||
@@ -38,21 +54,21 @@ export default function OKRsPage() {
|
||||
<Card key={i}>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<Badge color="blue">{item.quarter as string}</Badge>
|
||||
<h3 className="mt-1 font-medium text-gray-900">{item.objective as string}</h3>
|
||||
<Badge color="blue">{item.quarter}</Badge>
|
||||
<h3 className="mt-1 font-medium text-gray-900">{item.objective}</h3>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{item.alignment_score != null && (
|
||||
<Badge color={(item.alignment_score as number) >= 75 ? "green" : "amber"}>
|
||||
<Badge color={item.alignment_score >= 75 ? "green" : "amber"}>
|
||||
对齐度 {item.alignment_score}
|
||||
</Badge>
|
||||
)}
|
||||
<Badge color={item.status === "active" ? "green" : "gray"}>{item.status as string}</Badge>
|
||||
<Badge color={item.status === "active" ? "green" : "gray"}>{item.status}</Badge>
|
||||
</div>
|
||||
</div>
|
||||
{Array.isArray(item.key_results) && (
|
||||
<div className="mt-2 space-y-1">
|
||||
{(item.key_results as Record<string, any>[]).map((kr, ki) => (
|
||||
{item.key_results.map((kr, ki) => (
|
||||
<div key={ki} className="flex items-center gap-2 text-sm text-gray-600">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-gray-400" />
|
||||
{String(kr.title ?? kr.objective ?? kr)}
|
||||
|
||||
Reference in New Issue
Block a user