Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
67e965f
docs: 新增前端改版参考图和「用例与测试任务」术语
jacksonw111 Oct 12, 2026
a36d4e5
feat(ui): 新配色与暗色模式,打包 Inter 和 Geist Mono 字体
jacksonw111 Oct 12, 2026
b4254b8
feat(ui): 统一状态标签,替换所有页面的执行结果、测试任务状态、用例状态和优先级显示
jacksonw111 Oct 13, 2026
ed069b1
feat(ui): 交互基础部件,用在删除用例、删除项目、删除模块和项目设置上
jacksonw111 Oct 13, 2026
21376fe
feat(ui): 外框与侧栏,内容区改为卡片面板,导航分组,侧栏底部显示实时协作状态
jacksonw111 Oct 13, 2026
4c61016
feat(ui): 页面头部,外框顶部显示小号路径,各页面显示大标题、数据概要和右侧的操作按钮
jacksonw111 Oct 13, 2026
56e98a0
feat(ui): 项目概览样板页面,状态条形码、模块覆盖方格矩阵和各区域的加载、空状态与重试
jacksonw111 Oct 13, 2026
1565f1d
feat(ui): 项目侧栏导航恢复为一个平铺列表,去掉「工作」「项目」小标题
jacksonw111 Oct 13, 2026
2ef4ed2
feat(ui): 手工 vendored Kibo UI 的 status 组件,作为实时协作的状态圆点
jacksonw111 Oct 13, 2026
f40f964
feat(web): 顶栏实时协作状态的短文字和按用户去重的在线名单
jacksonw111 Oct 13, 2026
a309624
feat(web): 项目外框顶栏右上角显示实时协作状态圆点、短文字和折叠头像
jacksonw111 Oct 13, 2026
686ee2a
refactor(web): 侧栏不再显示实时协作状态,SidebarUser 去掉 status 插槽
jacksonw111 Oct 13, 2026
42c51f5
docs(web): 实时协作代码的注释和测试名统一用「在线名单」
jacksonw111 Oct 13, 2026
52330f0
feat(web): 窄屏也显示折叠头像,「+N」的提示列出隐藏用户的姓名
jacksonw111 Oct 13, 2026
d2d2ed7
chore: 合并 main 的 #49 squash 提交,内容与 ed069b1 相同,文件不变
jacksonw111 Oct 13, 2026
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions apps/web/src/components/auth-settings/auth-settings-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ import type { ReactNode } from "react";

import { AppHeader } from "@/components/layout/app-header";
import { AppShell } from "@/components/layout/app-shell";
import {
HeaderPath,
type HeaderPathItem,
} from "@/components/layout/header-path";
import { PageHeader } from "@/components/layout/page-header";
import type { PageTransitionPhase } from "@/components/layout/page-transition";
import { PageTransition } from "@/components/layout/page-transition";
import { PlatformSidebar } from "@/components/layout/platform-sidebar";

const PATH: readonly HeaderPathItem[] = [
{ key: "platform", label: "平台" },
{ current: true, key: "auth", label: "认证设置" },
];

const AUTH_SETTINGS_MAIN = "min-h-0 w-full flex-1 overflow-y-auto";

export function AuthSettingsShell({
Expand All @@ -18,10 +28,13 @@ export function AuthSettingsShell({
return (
<AppShell sidebar={<PlatformSidebar />}>
<AppHeader>
<h1 className="font-medium text-sm">认证设置</h1>
<HeaderPath items={PATH} />
</AppHeader>
<PageTransition className={AUTH_SETTINGS_MAIN} phase={phase}>
<div className="mx-auto w-full max-w-3xl px-4 py-6">{children}</div>
<div className="mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 pt-4 pb-6">
<PageHeader title="认证设置" />
{children}
</div>
</PageTransition>
</AppShell>
);
Expand Down
8 changes: 8 additions & 0 deletions apps/web/src/components/cases/case-list-skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { Skeleton } from "@automationstack/ui/components/skeleton";

import { CASE_PAGE_SIZE } from "@/components/cases/case-list-query";
import { CaseTableSkeleton } from "@/components/cases/case-table-skeleton";
import { PageHeader } from "@/components/layout/page-header";
import { WORKSPACE_VIEW_LABELS } from "@/components/layout/workspace-path";
import { ToolbarSkeleton } from "@/components/skeletons/toolbar-skeleton";

export function CaseListSkeleton() {
return (
<>
<PageHeader
actions={<Skeleton className="h-8 w-24" />}
title={WORKSPACE_VIEW_LABELS.list}
/>
<ToolbarSkeleton endGap="gap-2" startWrap={false} />
<CaseTableSkeleton rows={CASE_PAGE_SIZE} />
</>
Expand Down
54 changes: 31 additions & 23 deletions apps/web/src/components/cases/case-list-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { CaseFilters } from "@/components/cases/case-filters";
import { CaseListOverlays } from "@/components/cases/case-list-overlays";
import { caseListInput } from "@/components/cases/case-list-query";
import { CaseListResult } from "@/components/cases/case-list-result";
import { PageHeader } from "@/components/layout/page-header";
import { PageTransition } from "@/components/layout/page-transition";
import { WORKSPACE_VIEW_LABELS } from "@/components/layout/workspace-path";
import type { WorkspaceNavigation } from "@/components/workspace/use-workspace-navigation";
import { useWorkspaceNavigation } from "@/components/workspace/use-workspace-navigation";
import type { WorkspaceSearch } from "@/components/workspace/workspace-search";
Expand All @@ -22,13 +24,12 @@ const NO_TAGS: string[] = [];

const CREATE_HINT_ID = "case-create-hint";

interface CaseListActionsProps {
interface CaseCreateActionProps {
canCreate: boolean;
onCreate: () => void;
total: number | undefined;
}

function CaseListActions({ canCreate, onCreate, total }: CaseListActionsProps) {
function CaseCreateAction({ canCreate, onCreate }: CaseCreateActionProps) {
const handleCreate = useCallback(() => {
if (!canCreate) {
return;
Expand All @@ -37,14 +38,7 @@ function CaseListActions({ canCreate, onCreate, total }: CaseListActionsProps) {
}, [canCreate, onCreate]);

return (
<div className="flex items-center gap-3">
<span
aria-busy={total === undefined}
className="text-muted-foreground text-xs"
role="status"
>
{total === undefined ? "" : `共 ${total} 条`}
</span>
<>
{canCreate ? null : (
<span className="text-muted-foreground text-xs" id={CREATE_HINT_ID}>
请先在左侧选择一个模块
Expand All @@ -58,18 +52,23 @@ function CaseListActions({ canCreate, onCreate, total }: CaseListActionsProps) {
<PlusIcon data-icon="inline-start" />
新建用例
</Button>
</div>
</>
);
}

interface CaseListToolbarProps extends CaseListActionsProps {
interface CaseListToolbarProps {
navigation: WorkspaceNavigation;
projectId: string;
search: WorkspaceSearch;
total: number | undefined;
}

function CaseListToolbar(props: CaseListToolbarProps) {
const { navigation, search } = props;
function CaseListToolbar({
navigation,
projectId,
search,
total,
}: CaseListToolbarProps) {
return (
<div className="flex flex-wrap items-center justify-between gap-2">
<CaseFilters
Expand All @@ -79,15 +78,17 @@ function CaseListToolbar(props: CaseListToolbarProps) {
onStatusChange={navigation.setStatus}
onTagsChange={navigation.setTags}
priority={search.priority ?? NO_PRIORITY}
projectId={props.projectId}
projectId={projectId}
status={search.status}
tags={search.tags ?? NO_TAGS}
/>
<CaseListActions
canCreate={props.canCreate}
onCreate={props.onCreate}
total={props.total}
/>
<span
aria-busy={total === undefined}
className="text-muted-foreground text-xs"
role="status"
>
{total === undefined ? "" : `共 ${total} 条`}
</span>
</div>
);
}
Expand All @@ -110,10 +111,17 @@ export function CaseListView({ projectId }: CaseListViewProps) {

return (
<PageTransition className={CASE_LIST_MAIN} phase="ready">
<PageHeader
actions={
<CaseCreateAction
canCreate={search.moduleId !== undefined}
onCreate={navigation.openCreate}
/>
}
title={WORKSPACE_VIEW_LABELS.list}
/>
<CaseListToolbar
canCreate={search.moduleId !== undefined}
navigation={navigation}
onCreate={navigation.openCreate}
projectId={projectId}
search={search}
total={listQuery.data?.total}
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/layout/app-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ interface AppHeaderProps {
children?: ReactNode;
}

/** 外框顶部的一行:小号路径和全局状态,没有分隔线。大标题和操作按钮在各页面的 PageHeader 中。 */
export function AppHeader({ children }: AppHeaderProps) {
return (
<header className="sticky top-0 z-30 flex min-h-12 shrink-0 flex-wrap items-center gap-x-4 gap-y-2 border-b bg-background/95 px-4 py-1 backdrop-blur">
<header className="flex min-h-12 shrink-0 flex-wrap items-center gap-x-3 gap-y-2 px-4 pt-2 text-muted-foreground text-xs">
<SidebarTrigger className="lg:hidden" />
{children}
</header>
Expand Down
10 changes: 9 additions & 1 deletion apps/web/src/components/layout/app-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ interface AppShellProps {
sidebar: ReactNode;
}

/** 宽屏下内容区是带圆角和阴影的卡片面板,上、右、下三边露出侧栏的底色。窄屏下面板占满屏幕。 */
export function AppShell({ children, sidebar }: AppShellProps) {
return (
<SidebarProvider defaultOpen={readSidebarDefaultOpen()}>
{sidebar}
<SidebarInset className="h-svh">{children}</SidebarInset>
<SidebarInset className="h-svh bg-sidebar lg:py-2 lg:pr-2">
<div
className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-card lg:rounded-xl lg:border lg:shadow-card"
data-slot="content-panel"
>
{children}
</div>
</SidebarInset>
</SidebarProvider>
);
}
34 changes: 34 additions & 0 deletions apps/web/src/components/layout/header-path.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { ReactNode } from "react";

export interface HeaderPathItem {
/** 当前页面的那一项。路径的其他项是上级位置。 */
current?: boolean;
key: string;
label: ReactNode;
}

export const HEADER_PATH_LINK_CLASS =
"rounded-sm underline-offset-4 hover:text-foreground hover:underline";

/** 外框顶部的小号路径。 */
export function HeaderPath({ items }: { items: readonly HeaderPathItem[] }) {
return (
<nav aria-label="面包屑" className="min-w-0">
<ol className="flex min-w-0 items-center gap-1.5">
{items.map((item, index) => (
<li className="flex min-w-0 items-center gap-1.5" key={item.key}>
{index === 0 ? null : <span aria-hidden="true">/</span>}
<div
aria-current={item.current === true ? "page" : undefined}
className={
item.current === true ? "truncate text-foreground" : "truncate"
}
>
{item.label}
</div>
</li>
))}
</ol>
</nav>
);
}
124 changes: 124 additions & 0 deletions apps/web/src/components/layout/header-realtime-status.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import type { PresenceEntry } from "@automationstack/api/realtime/protocol";
import { render, screen } from "@testing-library/react";
import type { ReactNode } from "react";
import { describe, expect, it } from "vitest";

import { HeaderRealtimeStatus } from "@/components/layout/header-realtime-status";
import type { RealtimeConnection, RealtimeStatus } from "@/realtime/connection";
import { PresenceStore } from "@/realtime/presence-store";
import {
RealtimeContext,
type RealtimeContextValue,
} from "@/realtime/realtime-context";

const CONNECTION = {} as RealtimeConnection;

function makeEntry(clientId: string, name: string): PresenceEntry {
return {
clientId,
color: "#111111",
editingCaseId: null,
joinedAt: 1000,
name,
page: null,
view: "list",
viewingCaseId: null,
};
}

const TWO_USERS = [makeEntry("a", "alice"), makeEntry("b", "bob")];

function contextValue(
status: RealtimeStatus,
entries: PresenceEntry[] = TWO_USERS
): RealtimeContextValue {
const presenceStore = new PresenceStore();
presenceStore.apply({ entries, type: "presence:sync" });
return { clientId: "a", connection: CONNECTION, presenceStore, status };
}

function wrap(value: RealtimeContextValue): ReactNode {
return (
<RealtimeContext.Provider value={value}>
<HeaderRealtimeStatus />
</RealtimeContext.Provider>
);
}

const statusRegion = () => screen.getByRole("status");

describe("HeaderRealtimeStatus", () => {
it("已连接:显示在线人数,状态区域读出连接状态", () => {
render(wrap(contextValue("open")));
expect(screen.getByText("2 人在线")).toBeDefined();
expect(statusRegion().dataset.tone).toBe("online");
expect(statusRegion().textContent).toContain("实时协作已连接");
expect(statusRegion().textContent).toContain("2 人在线");
});

it("鼠标悬停显示完整文字,但 title 不放在状态区域上,避免屏幕阅读器读两遍", () => {
render(wrap(contextValue("open")));
expect(screen.getByTitle("实时协作已连接,2 人在线")).toBeDefined();
expect(statusRegion().hasAttribute("title")).toBe(false);
});

it("第一次连接成功之前的 closed:显示连接中", () => {
render(wrap(contextValue("closed")));
expect(screen.getByText("连接中")).toBeDefined();
expect(statusRegion().dataset.tone).toBe("connecting");
expect(statusRegion().textContent).toContain("正在连接实时协作");
});

it("连接成功后断开:重连期间一直显示已断开和重连说明", () => {
const { rerender } = render(wrap(contextValue("open")));
rerender(wrap(contextValue("closed")));
rerender(wrap(contextValue("connecting")));
expect(screen.getByText("已断开")).toBeDefined();
expect(statusRegion().dataset.tone).toBe("offline");
expect(statusRegion().textContent).toContain(
"实时协作已断开,其他人的修改暂时不会同步,正在自动重连"
);
});

it("没有实时协作连接(项目还在加载):显示连接中", () => {
render(<HeaderRealtimeStatus />);
expect(screen.getByText("连接中")).toBeDefined();
expect(statusRegion().dataset.tone).toBe("connecting");
});

it("只有已连接时显示扩散的呼吸圈,并且只在允许动效时显示", () => {
const { rerender } = render(wrap(contextValue("open")));
const ring = () =>
statusRegion().querySelector<HTMLElement>(
'[aria-hidden="true"] [class*="animate-"]'
);
// jsdom 不计算样式:圈默认 hidden,只在 .online 组内且 motion-safe 时显示。
expect(ring()?.classList).toContain("hidden");
expect(ring()?.classList).toContain(
"motion-safe:group-[.online]:inline-flex"
);
expect(statusRegion().classList).toContain("online");
rerender(wrap(contextValue("closed")));
expect(statusRegion().classList).not.toContain("online");
expect(statusRegion().classList).toContain("offline");
});

it("同一个用户的两个标签页只算一人", () => {
render(
wrap(
contextValue("open", [
makeEntry("a", "alice"),
makeEntry("a2", "alice"),
makeEntry("b", "bob"),
])
)
);
expect(screen.getByText("2 人在线")).toBeDefined();
});

it("头像不在 role=status 的区域里", () => {
render(wrap(contextValue("open")));
const avatar = screen.getByRole("button", { name: "alice(我) · 列表" });
expect(statusRegion().contains(avatar)).toBe(false);
});
});
Loading
Loading