You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c30ce97
Browse filesBrowse the repository at this point in the historyBrowse files
feat(record-page): on a phone the record's comments open as a page: threads first, replies inside, the box docked at the foot, a long press for actions (#36076) (#36208)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuLteuRKBSRXDK9REnG68QAD)_
repo:objectstack#1 · os-sales · session_01L6bhgTfxZyB5T41DdoPaBy
Fixes#36076
Clause-②: yes (widening) — `@object-ui/plugin-detail` exports
`CommentsPage` and `CommentsPageProps`; `CommentThread` takes a third
`mode` (`'page'`) and optional `itemInteraction`, `heldId` and
`onHeldActions`; `CommentItem` an optional `interactionProps`;
`CommentComposer` and `RichTextCommentInput` an optional `layout`
(`'default' | 'phone'`). `@object-ui/app-shell` reserves the console URL
parameter `comments` (`RECORD_COMMENTS_PARAM`, listed in
`RESERVED_URL_PARAMS`). `@object-ui/i18n` gains four `detail.*` keys in
every pack. Nothing is removed or re-typed; the desktop is unchanged.
Metadata-protocol: none
## 维护者速读
- 手机上打开一条记录,右上角多了评论图标,旁边是未解决的评论串数。点了进**整页**评论,盖在记录页上;左上「‹
记录名」或系统返回键回到记录页,记录页滚到哪还在哪(实测返回前后都是 74)。
- **两层**:列表只列第一层评论,有回复的下面是回复人头像加「N 条回复」;点一条进这一串,原评论在上,回复按时间往下,左上「‹
评论」回列表。
-
**输入框固定在屏幕底部**,键盘弹起时站在键盘上面。平时一行,点了展开,下面一排:提到人、加粗、斜体、列表、代码,右边发送。在列表里发的是新评论,在一串里发的是回复(两个框各留各的草稿)。页面上没有「Ctrl+Enter」字样。
-
**长按一条评论**(或系统的长按菜单),从底部升起面板:第一行六个表情,下面「标记已解决」(只在第一层)、「编辑」「删除」(红色,点了先确认)。每一项出现的条件和电脑端悬停那排完全一样,手机没有另判权限。
- 列表右上角筛选:「显示已解决」「只看我参与的」,和电脑端同一个菜单。手机上「动态」页签只剩系统记录。
- **删除的门**:#36186+#36191
已合并并合入本分支。手机长按面板和电脑端用同一套判定:普通成员能删自己没有回复的评论,能给自己看得到的任何评论串标记已解决。
- 不改电脑端,不改任何权限和服务端。
## What changes
**The phone's comment page** (`@object-ui/plugin-detail`,
`src/comments/`)
- `CommentsPage`: a full-screen page (`role="dialog"`, fixed over the
host) that reads `useRecordComments()`, the same discussion, writes and
gates as the desktop panel. Props: `threadId` (`null` = the list),
`onOpenThread`, `onBack`, `backLabel`, `onEngage`.
- The list draws each thread with `CommentThread mode="summary"`; a tap
on a comment outside its own controls, Enter on a focused comment, or
its 「N 条回复」 opens the thread. A thread that is not held (deleted, stale
link) shows the list.
- The thread draws `CommentThread mode="page"` (new): its comment, then
every reply, with no reply box of its own; 「回复」 there puts the caret in
the docked box.
- Two docked `CommentComposer layout="phone"` boxes (list and reply),
each keeping its own draft; the list's stays mounted while a thread is
open, so its draft and the list's scroll survive a visit to a thread.
- The page follows the on-screen keyboard through `visualViewport` (top
and height while the keyboard covers more than 80 px), the same reading
as `PhoneListPanels`' sheet; the inline style is positional only.
- Esc returns one level (`data-owns-escape`); the focus lands on 「‹」
when a level opens.
- `useCommentPress`: 500 ms hold, cancelled past 10 px of travel; the
click that ends a hold is swallowed. `onPressStart` fires at the press
itself (pointer down, context menu, Enter/Space), and the page hands it
`onEngage`, so the host's question about the comment's actions is on the
wire before the hold completes. `contextmenu` opens the same sheet
(Android's own long press, the keyboard's menu key, a right click). One
record of the press serves every comment.
- `CommentActionSheet` (vaul `Drawer`): six reactions (the viewer's own
marked `aria-pressed`), then Mark resolved / Reopen, Edit, Delete
(destructive). A row is drawn only where the comment's
`CommentItemActions` hands its handler: these are the object
`CommentThread.actionsOf` builds for the desktop's hover row, so every
gate is the thread's. The sheet is never a snapshot of the press:
`CommentThread` takes `heldId` and reports the held comment's current
actions to `onHeldActions` each time what they offer changes, so a
verdict that lands while the sheet is up adds its rows (L1-c REWORK
7070700220). A comment with no action raises nothing.
- `CommentsFilterMenu`: the desktop panel's filter menu, extracted
unchanged so both surfaces draw the same one.
- `CommentItem.interactionProps`: spread on the comment's box with
`select-none` and no iOS callout, except while it is being edited.
- `RichTextCommentInput layout="phone"`: the editor first, then one row
(mention, bold, italic, list, code; send at the right end, round, 44
px), no preview, the names without their shortcut (`detail.formatBold`,
`detail.formatItalic`), 16 px text. A press on the row keeps the caret
(and the keyboard) in the box. The default layout is untouched.
**The record page** (`@object-ui/app-shell`)
- `commentsPageOffered` in `RecordDetailView`: the same rule as
`commentsPanelOffered` (feeds on, a standard page, a record id) on a
phone and not embedded. `commentsSurfaceOffered` (either one) now drives
what `commentsPanelOffered` drove: the discussion rides the open's
payload, the 动态 stream gives the comments up
(`RecordCommentsInPanelContext`) and its count leaves them out.
- `?comments=` (list) / `?comments=<id>` (thread), read from the router:
opening and a thread push an entry flagged `__commentsPushed` in history
state (the entry's other state kept); 「‹」 pops a flagged entry and
otherwise replaces the URL one level up (a reload or a shared link). The
page is mounted inside the record's `DiscussionContextProvider`, over
the record, which stays mounted, so nothing is read again and the scroll
is kept. Closing returns the focus to the top bar's comments icon.
- The phone's `RecordTopBar` gets the `comments` slot (`CommentsButton`
at 44 px).
- The explain probes: `moderatesComments` is asked while the panel or
the page is open; `updatesOthersComments` on the first press on a
comment (the page's `onEngage`, fired at pointer down), as on the
desktop's first reach into the panel. Opening the record asks nothing
more.
**Strings**: `detail.addReactionEmoji`, `detail.commentThread`,
`detail.formatBold`, `detail.formatItalic` in all eleven packs (zh-Hant
regenerated) and the provider-less defaults; the rest reuse existing
keys (`detail.sendComment` already existed).
**Docs**: `content/docs/frontend/plugins/plugin-detail.mdx` (### On a
phone) and the plugin-detail README (### The phone's comment page).
**Pending release notes**: `.changeset/36075-record-comments-panel.md`
(from #36114) is left as it stands on main. Its line "the phone keeps
the comments in its 动态 tab" is answered in this PR's own changeset,
which says that on a phone the comments live on the phone's page and
that this replaces that line. `36075-comments-resolved.md` ("…and the
phone keep their feed as before") is left as it stands too; the same
sentence of this PR's changeset answers it.
## Small calls made here (dev-thread rule, Sales 22:19:27Z)
1. The full page is a URL parameter over the record route, not a new
route: the record stays mounted (no re-read, scroll kept), precedent
`?related=`.
2. No 「回复」 row in the long-press sheet: in a thread the docked box is
the reply; in the list a tap opens the thread.
3. No 「预览」 on the phone toolbar; the card's row lists mention, bold,
italic, list, code and send.
4. The filter is the desktop's dropdown, not a bottom sheet.
5. A long press on a comment with no available action opens nothing (a
read-only discussion).
6. Thread title 「评论串」; the list keeps 「评论」.
## Overlap
- #36136 (wide-screen pinned details): MERGED (48c732c) and merged into
this branch; the only conflict was the `@object-ui/plugin-detail` import
line in `RecordDetailView.tsx` (main's list plus `CommentsPage`). After
the merge `tsc` for app-shell is clean and every `RecordDetailView.*`
and `plugin-detail/src/comments` test passes (103 files, 873 tests), as
does `i18n` (105 files).
- #36200 (#36186+#36191 comment doors): MERGED (d12ac84) and merged
into this branch with no conflict. The phone sheet draws from the same
`actionsOf`, so it takes the new ✓ gate (any thread the viewer reads)
and the own-comment delete door (`ownCommentDeletesOnly`: own comment
with no reply only) with no code change; one CommentsPage test
expectation moved from `['delete']` to `['resolve','delete']`, and a new
test pins the door on the phone sheet.
- #36151 (phone record bottom bar, not pushed yet) and #36147: same
file, different blocks.
## Verification
**New tests (all pass)**
- `plugin-detail/src/comments/CommentsPage.test.tsx` (18): the list
shows top-level comments with 「2 replies」, no reply; a tap on a comment
or its count opens the thread, a tap on a reaction is the reaction's;
Enter opens; 「‹」 names the record; the docked box writes a comment,
toolbar order @ B I list code Send, no 「Ctrl」 in the page; a thread
shows comment then replies and replies to its comment; a missing thread
shows the list; the list draft survives a thread visit; long press on
own comment: 6 reactions (own one pressed), resolve, edit, delete, and
the release opens nothing, `onEngage` once; another's comment: no edit
or delete; a reply: no resolve; a sheet reaction toggles, Delete reaches
the host; a press that travels is a scroll; contextmenu opens the sheet;
read-only raises nothing and docks no box; a moderator's press on
another's comment engages at pointer down, the sheet opens with Mark
resolved and Delete, and when `updatesOthersComments` turns true with
the sheet up Edit joins (fails on the pre-fix head); behind the
own-comment delete door Delete is on the viewer's own reply only, not on
their comment with replies nor on another's reply; resolved threads
hidden by default with the filter offered.
- `app-shell/src/views/RecordDetailView.commentsPanel-36075.test.tsx`,
new top-level describe (6), the real `RecordDetailView` at 375: the
top-bar icon with 「2」, a press pushes `?comments=` (flagged) and draws
the list over the still-mounted record; tap → `?comments=c-ada` with the
reply, 「‹」 → list → record, focus on the icon; a link straight to a
thread: 「‹」 replaces one level up twice; the 动态 tab draws no comment and
no 「Ctrl」; no icon with feeds off; a moderator's first long press on
Grace's comment with the `sys_comment` explain answered late: no comment
explain before the press, asked at the press, the sheet shows Delete,
then Edit and Delete once the answer lands (fails on the pre-fix head).
**Local runs** (after merging main `cbd582f4`): every
`app-shell/src/views/RecordDetailView.*`, `plugin-detail/src/comments`
and `i18n` test file, 209 files, 2,830 tests pass. Before the merge, a
wider set (all `RecordDetailView.*`, `recordCommentsPanel*`,
`ObjectView.phone*`, `app-shell/src/__tests__`, all of `plugin-detail`
and `i18n`): 640 files, 6,991 tests pass. `tsc` (src and tests) clean
for plugin-detail and app-shell. ESLint on the changed files: 0 errors
(warnings only of the kinds already in these files).
`overlap-check.mjs`: clean against main; #36136 conflict as above. After
the L1-c fix: all of `plugin-detail` (405 files, 3,745 tests) and the
host comments file (16 tests) pass; ESLint 0 errors on the touched
files.
**Browser evidence** (CRM example on `objectstack dev --fresh`, console
on Vite from this branch, zh-CN, 375×812 touch, light and dark;
seat-side folder `/mnt/project-files/build-seat1/36076/`, script and
readings in its README)
| Shot | Reading |
|---|---|
| Record page | icon 「3」 at the top bar's right |
| List | 「‹ Globex Ltd」 · 评论 · filter; three first-level comments, 「2
条回复」 under the first |
| Thread | comment, then both replies; URL `?comments=<id>` |
| Composer expanded | @ B I list code, round send at the right; the
box's bottom at 812 (the viewport's) |
| Long press, own comment | six reactions, 标记已解决, 编辑, 删除 (red) |
| After 👍 | 「👍 1」 under the comment, marked as own |
| Back to the record | scrollTop 74 before, 74 after |
| 动态 tab | 「动态 (0)」, no comment, no box |
Not shown in the browser (the run's only account is an administrator,
who moderates): a member's long press on someone else's comment; pinned
by the unit test above. The iOS keyboard cannot be emulated in headless
Chromium.
## 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 on the changed files.
- [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).
Branch name is the harness-assigned `claude/project-thread-uzlelf`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgTfxZyB5T41DdoPaBy)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgTfxZyB5T41DdoPaBy
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgTfxZyB5T41DdoPaBy -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
feat(record-page): on a phone, the record's comments open as a page of their own: the threads first, a thread's replies inside it, the comment box docked at the foot, and a long press for a comment's actions
8
+
9
+
Clause-②: yes (widening) — `@object-ui/plugin-detail` adds the export `CommentsPage` and its type `CommentsPageProps`; `CommentThread` takes a third `mode`, `'page'`, and optional `itemInteraction`, `heldId` and `onHeldActions`; `CommentItem` an optional `interactionProps`; `CommentComposer` and `RichTextCommentInput` (exported) an optional `layout` (`'default' | 'phone'`). `@object-ui/app-shell` reserves the console URL parameter `comments` (`RECORD_COMMENTS_PARAM`, in `RESERVED_URL_PARAMS`). `@object-ui/i18n` adds four keys to every pack: `detail.addReactionEmoji`, `detail.commentThread`, `detail.formatBold`, `detail.formatItalic` (the toolbar's names without their shortcut). Nothing existing is removed or re-typed; the desktop's panel, toolbar and labels are unchanged.
10
+
Metadata-protocol: none
11
+
Skills-docs: none — no skill under `skills/**` teaches where the console draws a record's comments; `content/docs/frontend/plugins/plugin-detail.mdx` and the plugin-detail README gain the phone's page in this change.
12
+
13
+
On a phone the record page's top bar gains the comments icon, with the number of unresolved threads. A press opens the record's comments as a page over the record, which stays where it was under it; 「‹」 and the browser's Back return to it.
14
+
15
+
- The page lists each thread's first comment with 「N 条回复」 under it; a tap opens the thread, the comment first and its replies after it. 「‹ 评论」 returns to the list.
16
+
- The comment box is docked at the foot of the screen and stands on the keyboard while it is up. One line until tapped; then a row under the text holds mention, bold, italic, list and code, and send at the right end. In the list it writes a comment, in a thread a reply. No 「Ctrl+Enter」 hint.
17
+
- A long press on a comment (or its context menu) raises a sheet from the bottom: six reactions, 「标记已解决」 on a thread's first comment, 「编辑」 and 「删除」 (red, confirmed first), each offered exactly where the desktop's hover row offers it.
18
+
- The filter at the top right is the desktop's: 「显示已解决」 and 「只看我参与的」.
19
+
- The 动态 tab holds the system entries alone, as on the desktop. On a phone the comments live on this page: this replaces the lines of the two objectstack#36075 entries (the record comment panel, and resolved threads) that said the phone keeps the comments in its 动态 tab, or keeps its feed as before.
20
+
- The page is in the URL (`?comments=` for the list, `?comments=<id>` for a thread), so a link or a reload opens it where it was.
21
+
22
+
Unchanged: the desktop; who may write, resolve, edit or delete a comment (the phone offers each exactly where the desktop does); a record page authored in full and an object with `enable.feeds: false` show no icon.
0 commit comments