Repository navigation
Commit 04f9861
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu7W7AujnHuifjn8Luh1TnAA)_
repo:objectstack#1 · os-sales · session_01L6bhgXXdtDHm8mLZYX8Bsb
Part of #36075
Clause-②: yes (widening): `@object-ui/plugin-detail` adds exports
(`CommentsPanel`, `CommentsButton`, `CommentThread`, `CommentItem`,
`CommentComposer`, `CommentHoverActions`, `useRecordComments`,
`buildCommentThreads`, `latestRepliers`, `RecordCommentsInPanelContext`)
and their types (`CommentsPanelProps`, `CommentsButtonProps`,
`RecordCommentThreadProps`, `CommentItemProps`, `CommentItemActions`,
`CommentComposerProps`, `CommentHoverActionsProps`, `CommentThreadData`,
`RecordCommentsData`), and an optional `reservedWidth` on
`useRecordPageTier`. `RichTextCommentInput` (exported) now takes the
`Esc` that closes its @ list (`preventDefault` and `stopPropagation`),
so nothing round it acts on that key. `RecordActivityTimeline` draws no
chip group when it is handed no chips. `@object-ui/components` adds an
optional `comments` slot to `RecordTopBar` and `NavigationOverlay`, and
the drawer leaves an `Esc` pressed inside a `[data-owns-escape]` region
to that region. `@object-ui/i18n` adds five keys to every pack:
`detail.closeComments`, `detail.collapseReplies`,
`detail.commentActions`, `detail.commentsEmptyHint`,
`detail.resolveThread`. Nothing existing is removed or re-typed.
Metadata-protocol: none
## 维护者速读
- 电脑端的记录页和记录抽屉,头部(编辑按钮左边)多了一个评论图标,旁边是这条记录的评论数(顶层评论条数;#36071
合并后改成未解决的线程数)。点一下打开评论栏,再点一下关上;开着还是关着,浏览器会记住,记录页和抽屉各记各的。
- 评论栏宽 380:顶上「评论」和 ✕,中间是评论线程(最早的在上),评论框固定在最下面。一条评论有回复时显示「N
条回复」和最近回复人的头像,点开在原地展开,下面有回复框;在任意一条上点「回复」会展开这个线程、光标直接进回复框。
- 鼠标移到一条评论上,右上角出现一排操作:回复、表情、更多(自己的评论才有编辑、删除)。「已解决」按钮已经做好,等 #36071
合并后再接上,现在不显示。
- 窗口 1280 及以上,评论栏放在记录右边,记录内容让出 380;窗口小于 1280,评论栏盖在记录右侧。抽屉默认宽
720,评论栏盖住整个抽屉内容(✕ 或 Esc 回到记录,焦点回到评论图标;从列表打开的抽屉也一样,抽屉本身不关);抽屉宽到 760
及以上才左右并排。
- 「动态」页签只剩系统条目(活动、字段变更),没有评论框,也没有「全部 / 活动 /
讨论」这三个筛选(卡上点名去掉的三个)。「变更」筛选照旧保留:记录开着字段历史时才有,点一下只看字段变更,再点一下回到全部。动态的数字也不再算评论。
- 只在平台默认记录页和只填插槽的页面上出现(方案 C,13:24Z)。完全手写的记录页不动:showcase 的
project-detail、sys-queue、sys-audit-log
三个页面照旧在页脚放讨论区;对象关了评论(`enable.feeds: false`)就没有图标。手机端这次不改,评论还在动态页签里,等
#36076。
## What changes
**The comment components** (`@object-ui/plugin-detail`, new
`src/comments/`)
- `useRecordComments()` reads the record's discussion off the host's
`DiscussionContext` (the rows and the writes every feed block already
gets) and returns the threads, the icon's count (`null` while unknown:
loading, refused or failed), the loading, refused and failed states, and
each write exactly where the host hands it. Nothing reads or writes any
other way, so the phone's comment page (#36076) can reuse every piece.
- `buildCommentThreads(items)`: the `comment` rows only, threads oldest
first, replies oldest first; a reply to a reply joins its thread; a
reply whose parent is not held (deleted) stays as a thread of its own,
so a delete never hides another member's reply.
- `CommentItem` (avatar, name, time, edited mark, text, reactions with
the viewer's own marked; an inline editor where Esc cancels and
Ctrl/⌘+Enter saves, the draft kept when the save is refused),
`CommentThread` (`expand` for the panel, `summary` for the phone's list;
actions handed out per comment through `renderActions`),
`CommentComposer` (keeps the draft when the write is refused;
`focusSignal` puts the caret in it), `CommentHoverActions` (the
desktop's one action row), `CommentsPanel`, `CommentsButton`. Every face
is #36070's shared `CommentAuthorAvatar`.
- `RecordCommentsInPanelContext`: while the host sets it, the default
page's `record:activity` stream (the 动态 tab and the 概览 rail's 最近动态 card)
drops comment rows, its 全部 / 活动 / 讨论 chips and its composer (the 变更 chip
stays, on #30074's rule, and pressed again goes back to every entry),
ignores a refused or failed comments read, and the tab row's count probe
(`RecordTimelineCountProbe`) counts the same rows. An authored
`record:activity` is untouched.
- **Esc** (L1-c rework at `09b716c8`): an `Esc` in the panel closes it
and puts the focus back on the comments icon. The `@` list's `Esc`
closes the list only (`RichTextCommentInput` now takes the key), so the
draft is kept. The panel closes on an `Esc` whose target is in its own
DOM; its portaled menus close themselves. `defaultPrevented` no longer
decides, because the drawer marks the key to hold itself open. The
section carries `data-owns-escape`.
- `useRecordPageTier(el, { reservedWidth })`: the tier is measured on
the width left after the panel takes its 380.
**The record page and the drawer** (`@object-ui/app-shell`)
- One predicate, `commentsPanelOffered`, in `RecordDetailView`: an
object definition with `enable.feeds !== false`, a page that takes the
default columns (no assigned page, not a blocked named page: option C),
not a phone, and a record id. It is the only place the rule lives.
- While the panel is offered, the discussion rides the record's open
request (`streamDiscussion`), so the icon's count is known without
opening the 动态 tab; activity stays lazy as before (`activityFeedWanted`
is the old `feedWanted`).
- `recordCommentsPanel.tsx`: the widths and thresholds
(`COMMENTS_PANEL_WIDTH` 380, `COMMENTS_PANEL_BESIDE_MIN_WINDOW` 1280,
`COMMENTS_PANEL_DRAWER_SPLIT_MIN_WIDTH` 760), `commentsPanelPlacement`
(`beside` / `over` / `cover`), the open state kept in `localStorage`
(`os:record-comments-panel:page` and `:drawer`, every access guarded),
and `RecordCommentsAside`.
- The icon sits in `RecordTopBar`'s new `comments` slot, ahead of the
button group, on the page; the drawer portals it into the same slot
through `RecordPaneBarApi.commentsSlot` (`RecordPaneBarComments`); a
pane without the bar draws it in the page header's trailing controls.
**Drawer width chosen**: the default drawer is `md` (720), under the 760
split threshold, so the panel covers the drawer's body there; a drawer
at 760 or wider splits, leaving the record at least as wide as the
panel.
**Strings**: `detail.closeComments`, `collapseReplies`,
`commentActions`, `commentsEmptyHint`, `resolveThread` in all eleven
packs and the provider-less defaults; everything else reuses existing
keys.
**Docs**: the plugin-detail README and
`content/docs/frontend/plugins/plugin-detail.mdx` describe the panel.
## Why
Card #36075 (phase 1 of epic #36062): comments were buried in the 动态 tab
beside system entries, so a reader had to switch tabs to see or join a
discussion. The card asks for a standalone comment panel on the desktop
record page and drawer, reached from a header icon, and an Activity tab
of system entries only.
## Side effects reviewers should know
- **Hand-written pages keep their old discussion** (option C, seat
13:24Z): showcase `project-detail`, `sys-queue` and `sys-audit-log`
still place a footer `record:discussion`, and get no icon. `sys-user`
and `sys-organization` have feeds off; `sys-approval-request` has no
discussion block on purpose. How a hand-written page opts into the panel
is a phase 2 card.
- **The 动态 tab keeps one chip on the desktop, 变更** (seat L2, 16:44Z):
the card removes 全部 / 活动 / 讨论 only, and 变更 (objectstack#30074) is merged
behaviour, offered on the same rule (only where the record shows its
field history). With no 全部 beside it, the chip is a toggle: pressed
again, it goes back to every entry. The phone keeps all its chips.
- **The 动态 count leaves the comments out** wherever the panel is offered
(page payload total less the comments it counted).
- The panel draws every comment the read holds, oldest first, with no
20-row page: a conversation is read to its end.
- Not in this PR: the resolved UI, the filter menu and the unresolved
count (wait #36071, wired in a second PR if #36071 is slow); until then
this PR is `Part of #36075`. The shared avatar and the delete toast from
#36070 are in: main was merged after #36105 landed at 16:04Z. Reactor
names on hover are not on the card.
## Verification
**New tests (all pass)**
- `plugin-detail/src/comments/commentThreads.test.ts` (6): comment rows
only, oldest first; replies and a reply to a reply nested; an orphan
reply kept; same-instant order; a parent loop loses nothing; latest
repliers.
- `plugin-detail/src/comments/CommentsPanel.test.tsx` (13): oldest
first, system rows left out; collapse and expand; Reply focuses the
reply box and answers the thread's first comment; Edit and Delete only
on the viewer's own comment; More → Delete, More → Edit saves; React;
read-only offers no actions and no box; add, and the draft kept on a
refused write; ✕ and Esc; empty; refused and failed with Retry; the
icon's count and pressed state.
-
`plugin-detail/src/__tests__/recordActivity.commentsInPanel-36075.test.tsx`
(7): no comments or composer in the stream and 变更 the one chip, with the
control; the lone 变更 chip toggles back to every entry; no chip where the
record shows no field history; a refused comment read does not replace
the system entries; the count probe counts system entries only, with the
control; an authored `record:activity` untouched.
- `app-shell/src/views/recordCommentsPanel.drawerEscape-36075.test.tsx`
(8): the REAL `NavigationOverlay` around the REAL panel, at the stack's
root (a record opened from the list) and below it. Esc in the comment
box and on ✕ closes the panel, the drawer stays at its level, and the
focus returns to the icon. Esc in the `@` list closes the list only.
CONTROL: Esc on a record control outside the panel does what the drawer
always did. With either fix removed, its pins fail (4 of 8 without the
drawer change).
- `CommentsPanel.test.tsx` +2: Esc in the `@` list keeps the panel and
the draft, and the next Esc closes the panel; Esc in the More menu
closes the menu only. Both fail with their fix removed.
- `RecordDetailView.commentsPanel-36075.test.tsx` +1: Delete in the
panel goes through the page's confirm and toasts 「Comment deleted」
(#36070).
- `app-shell/src/views/recordCommentsPanel-36075.test.ts` (2): the 1280
and 760 thresholds.
- `components/src/__tests__/record-top-bar-comments-36075.test.tsx` (2):
the slot sits ahead of the button group in both bar shapes.
- `app-shell/src/views/RecordDetailView.commentsPanel-36075.test.tsx`
(8), the real `RecordDetailView`: icon and count on the default page;
open beside at 1440 and close; over at 1100; kept open for the next
record; drawer cover, remembered apart from the page; the stream draws
no comment and the panel does, once; no icon with feeds off; no icon on
a hand-written page, which keeps its discussion.
**Changed tests**: 38 cases in 11 `RecordDetailView.*` files read the
default page's comments off the 动态 stream; they now read them in the
comment panel (same rows, same reads, same grants), and the counts drop
the comments: `feedLoading`, `feedRecordScope`, `feedLoadFailure-29188`,
`harness` (feedRefusal-11195), `replyCountOnRead-12144`,
`discussionExplicitComposition-7298`, `discussionFallbackPipeline-8983`,
`recordOpenOneRequest-28470`, `recordOpenWaves-13010`,
`recordPageTiers-26678` (变更 alone, a toggle, where `trackHistory` is on
and the audit read answers; no chip without it or on a 403),
`timelineCount-28737`. Authored-page cases in those files are unchanged.
No test deleted or skipped.
**Local runs**: every `app-shell/src/views/RecordDetailView.*`,
`recordDrawer*` and `components/src/custom` test file (98 files) pass,
the 11 above after their change and three that first failed to resolve
`@objectstack/client` before its build on a re-run; every new file above
passes. The whole app-shell, plugin-detail and components suites (3,274
files) did not fit a local run and were stopped; CI is the full reading.
`type-check` (src and tests) clean for plugin-detail, components and
app-shell; ESLint on every changed file: 0 errors; `check:i18n-keys`,
`check:i18n-drift`, `check:new-line-citations` pass;
`overlap-check.mjs`: clean against main and the 6 open PRs that share a
file.
**Browser evidence** (CRM example on `objectstack dev`, console on Vite,
zh-CN, an account seeded with three threads, one with two replies):
`/mnt/project-files/build-seat1/36075/` (seat-side folder).
| Reading | Result |
|---|---|
| Page, 1440, light and dark, panel closed → open | icon 「3」, pressed
when open; panel `beside`, 380 wide at x 1060; the record columns narrow
to leave it the width |
| Page, 1100, light and dark | panel `over`, 380 wide at the right edge,
record columns keep their width |
| Drawer (list → Initech), light and dark | the icon in the drawer's
record row; panel `cover`, the drawer body's whole width (718) |
| Thread states | 「2 条回复」 with the replier's face; expanded with the
reply box and 「收起回复」; hover row (回复, 表情, 更多) with 编辑 / 删除 open |
| 动态 tab | no 全部 / 活动 / 讨论 chips, no composer, no comment rows (shot
taken before the 变更 chip was kept) |
| A record with no comments | empty state with the hint, composer at the
foot |
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 block is the
maintainer's summary, in the maintainer's language).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
Branch name is the harness-assigned `claude/project-thread-ks7hy1`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgXXdtDHm8mLZYX8Bsb)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgXXdtDHm8mLZYX8Bsb
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgXXdtDHm8mLZYX8Bsb -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2c93001 commit 04f9861
56 files changed
Lines changed: 2774 additions & 190 deletions
File tree
- .changeset
- content/docs/frontend/plugins
- ui/packages
- app-shell/src/views
- components/src
- __tests__
- custom
- i18n/src/locales
- plugin-detail
- src
- __tests__
- comments
- renderers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
198 | 233 | | |
199 | 234 | | |
200 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
0 commit comments