Skip to content

Commit 0611628

Browse files
committed
refactor(sessions): extract single screen card
1 parent 0bf849d commit 0611628

2 files changed

Lines changed: 55 additions & 10 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* SessionScreenCard — 会话详情「画面要点」的**单卡内容**(批 5 T3 从 SessionScreenCards 抽出)。
3+
*
4+
* @ai-context: 职责边界 = **卡内容**:标题(`screen.title`)+ 正文行(`screen.body`)。
5+
* 纯展示:**零 state、零 effect、零 IPC、零 `@tauri-apps` import**(配图 URL 的
6+
* `convertFileSrc` 收口仍在容器——见下「为什么只有两块」)。
7+
*
8+
* @ai-context **为什么只抽出这两块(T3 报告的 STOP 落点,控制方需裁决)**:`SessionScreenCards.tsx`
9+
* 的每屏块里,屏头 / 标签 / 结构徽标明细携带 `fontSize: 11`「11.5」(越界字阶)、
10+
* 配图与单屏 toast 携带 `1px solid #e5e7eb`「borderRadius: 6」、块级明细 `<details>`
11+
* 携带 `#9ca3af` —— 这些字面量受**五类棘轮的文件级台账**约束:
12+
* ① 搬进新文件 ⇒ `textRatchet`/`surfaceRatchet` 的「未登记文件命中 = 0」红(新文件带字面量);
13+
* ② 就地迁移(`<Text>`/token)⇒ `textRatchet` ⑥「域内实测总数 == 冻结总数」红
14+
* (迁移让全域总数下降,而 `*Baseline.ts` 本批只读)——
15+
* ⇒ 两条路都不绿(实测读数见 `tmp/t3/raw/mutants/`)。**能安全搬出的只有标题与正文**
16+
* (字号 14 / 12.5 是合法档、不产生任何棘轮计数)。控制方若批准收紧
17+
* `textBaseline`,剩余块可随「搬迁 = 顺带落迁移」一并并入本卡。
18+
*
19+
* @ai-context 为什么这一层值得先立:T9 的 `SessionCardFlowView` 要复用本卡(C3 逐字「抽单卡子件
20+
* 供两个视图复用」)。今天它交付的是两个视图**共有的最小内容面**(标题 + 正文),
21+
* 剩余内容面(时间码 / 图 / 标签 / 结构徽标)待台账解锁后并入。
22+
*/
23+
import type { SessionScreen } from "../../types";
24+
25+
interface Props {
26+
/** 一屏的画面要点(本卡只消费其中的标题与正文行) */
27+
screen: SessionScreen;
28+
}
29+
30+
export default function SessionScreenCard({ screen }: Props) {
31+
return (
32+
<>
33+
{screen.title && (
34+
<div style={{ fontSize: 14, fontWeight: 600, color: "#111827", marginBottom: 2 }}>
35+
{screen.title}
36+
</div>
37+
)}
38+
{screen.body.map((b, j) => (
39+
<div key={j} style={{ fontSize: 12.5, color: "#374151", lineHeight: 1.6 }}>
40+
{b}
41+
</div>
42+
))}
43+
</>
44+
);
45+
}

‎app/src/components/session-detail/SessionScreenCards.tsx‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/**
22
* SessionScreenCards — 会话详情「画面要点」屏卡流(v0.7.3 REQ-155/158/160 + v0.7.7 REQ-184 框选截取)。
33
*
4+
* @ai-context 批 5 T3 拆件 B:**卡内容(标题 + 正文)抽至 `session-detail/SessionScreenCard`**(C3 的
5+
* 「抽单卡子件供两个视图复用」;T9 的卡片流消费它)。锚点 id / 框选态 / 单屏 toast /
6+
* 块级明细仍在本容器(C3 逐字)。**未搬的其余内容面不是遗漏**——它们携带的字面量被五类
7+
* 棘轮的文件级台账锁定(搬迁或迁移都不绿,`*Baseline.ts` 本批只读):实测读数与「绿色
8+
* 方案 B」见 `task-3-report.md` 的 STOP 落点;边界理由写在 `SessionScreenCard` 文件头。
9+
*
410
* @ai-context: 自 SessionDetailPanel 拆出(原 L482–603 + 面板层 toast/框选状态)——屏卡展示
511
* 屏号区间 + 标题 + 正文 + 标签 + 配图 + 结构徽标 + 可展开块级明细;v0.12.0 M5 补完成:
612
* 视频会话(kind≠photo)画面要点 = 关键帧纯图,图文会话(kind=photo)保持 OCR 文本屏,
@@ -20,6 +26,7 @@
2026
*/
2127
import { convertFileSrc } from "@tauri-apps/api/core";
2228
import BoxSelectOverlay from "../BoxSelectOverlay";
29+
import SessionScreenCard from "./SessionScreenCard";
2330
import type { SessionOcrBlock, SessionScreen } from "../../types";
2431
import { fmtMs } from "../../utils/fmt";
2532
import { Text } from "../../ui/primitives";
@@ -104,16 +111,9 @@ export default function SessionScreenCards({
104111
</span>
105112
))}
106113
</div>
107-
{s.title && (
108-
<div style={{ fontSize: 14, fontWeight: 600, color: "#111827", marginBottom: 2 }}>
109-
{s.title}
110-
</div>
111-
)}
112-
{s.body.map((b, j) => (
113-
<div key={j} style={{ fontSize: 12.5, color: "#374151", lineHeight: 1.6 }}>
114-
{b}
115-
</div>
116-
))}
114+
{/* 卡内容(标题 + 正文)已抽至 session-detail/SessionScreenCard——本容器继续持有
115+
锚点 id / 框选态 / 单屏 toast / 块级明细;剩余内容面的并入需控制方裁决(见 T3 报告) */}
116+
<SessionScreenCard screen={s} />
117117
{s.labels.length > 0 && (
118118
<div style={{ fontSize: 11.5, color: "#6b7280", marginTop: 3 }}>
119119
标签:{s.labels.join(" · ")}

0 commit comments

Comments
 (0)