Repository navigation
已寄出的信无法查看详情:补只读详情视图 - #37
Merged
todosdev[bot] merged 1 commit intoOct 29, 2026
Merged
Conversation
不可编辑状态(sent/failed/sending)的卡片标题改为链到新增的 /letters/:id 只读详情页; 详情页复用抽出的 LetterPreview 与 LETTER_CONTENT_CLASS,展示正文、收件人快照与寄送信息。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/letters/:id,卡片标题改为按状态分流——可编辑(草稿/待寄出/已取消)仍进/compose/:id,不可编辑(已寄出/失败/发送中)进详情页。GET /api/letters/:id(fetchOwnedLetter+serializeLetter)与前端lettersApi.get(id);未动契约、schema、鉴权。sent,计划按「同一根因的不可编辑状态」一并覆盖failed/sending(fleet-discipline §5 按族处理),页面本身按任意状态通用只读渲染,无额外成本。Changes
web/src/pages/letter-detail.tsx:加载/错误/成功三态;头部为返回链接(aria-label="返回我的信件")+ 标题 + 状态徽标;failed时在预览之上显示「失败原因:…(已尝试 N 次)」;正文用共享预览组件全文渲染;「寄送信息」卡片列出收件人快照(name <email>)、寄出于、送达时间、写于、可见范围。全页只读,无保存/寄出/删除/重发动作;可编辑状态经深链打开时给「编辑」按钮。web/src/components/letter-preview.tsx:把compose.tsx内联的PreviewPanel迁出为LetterPreview(props 不变,新增可选writtenAt),写信页与详情页共用同一份LETTER_CONTENT_CLASS+dangerouslySetInnerHTML渲染,不出现第二套正文样式。web/src/pages/compose.tsx相应删除本地组件与独有 import,渲染结果不变。web/src/lib/letter-status.ts:导出isEditableStatus(与 worker 同义)与statusBadgeClass(自letters.tsx移入)。letters.tsx的标题链接规则、编辑按钮、状态徽标均改调此处,避免判定漂移。web/src/App.tsx:在RequireAuth分支内/letters之后新增/letters/:id,eager import(详情页不依赖 TipTap,无需 lazy 分包)。web/src/pages/letter-detail.test.tsx(已寄出 / 失败 / 发送中 / 草稿深链 / 404 五例);web/src/pages/letters.test.tsx补三条标题href断言(/letters/:id× 2,/compose/:id× 1)。Testing
pnpm typecheck:web + worker 通过(tsc -b/tsc --noEmit无输出)。pnpm test:web 20 文件 156 通过,worker 21 文件 232 通过,0 失败;pnpm build成功(写信页仍独立分包 404.84 kB,详情页未引入 TipTap)。max-w-2xl)居中,documentElement.scrollWidth = 1440 = innerWidth,无横向溢出。scrollWidth = 375,无横向溢出。href为/letters/l1、/letters/l2(375 与 1440 一致);404 页为居中提示「无法打开这封信:信件不存在或无权查看」+ 返回按钮。