Skip to content
18 changes: 18 additions & 0 deletions .changeset/39085-list-comments-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@object-ui/types': patch
'@object-ui/data-objectstack': patch
'@object-ui/plugin-list': patch
'@object-ui/plugin-detail': patch
'@object-ui/i18n': patch
---

feat(console): a comments column on the list page, with the threads of the records the view shows

Clause-②: yes (widening) — new optional members and exports only: `DataSource.queryCommentThreads` and the `CommentThreadsQueryRequest` / `CommentThreadsQueryResponse` types on `@object-ui/types`; `ListView`'s `onEffectiveFilterChange` host prop and the `ListEffectiveFilter` type on `@object-ui/plugin-list`; `ViewCommentsPanel`, `splitCommentMentions` and their types on `@object-ui/plugin-detail`; nothing removed or renamed
Metadata-protocol: none

An object's list page now has a comments icon in its header, on a grid and on a board, where the object's discussion is on (`enable.feeds` not `false`). A press opens a 380 px column at the page's right and the list narrows to make room; ✕ or Esc closes it, and the browser remembers whether it was left open.

The column lists the comment threads on the records the view shows, newest first: the view's saved filter together with the filters the reader has set on the list and not saved. The search box does not narrow it. The server runs the filter as the reader's own read, so someone who may read fewer records sees fewer threads. Each card names the record (which opens it the way a row does), who wrote the first comment and when, its text with mentions highlighted, and 「N 条回复」 with the latest repliers' faces; 「加载更多」 reads the next page. A card opens its thread in place, with reply, resolve and reopen, reactions, edit and delete as the record page offers them; there is no box for a new thread. The filter menu holds 「显示已解决」 (off) and 「只看我参与的」. The column reads again when the view, its filter or a toggle changes and when a comment is written, and reads nothing while closed. It says so when the reader may not read the comments, when the read failed (with a retry), when the list's filter cannot be sent, and when the server does not answer the threads read (`POST /api/v1/comments/threads/query`).

For React hosts: `ObjectStackAdapter.queryCommentThreads(request)` calls that read; `ListView`'s `onEffectiveFilterChange` reports the filter the list applies, on every layout (`{ kind: 'filter', filter }`, or `{ kind: 'unlowerable' }` for a filter it cannot lower); `ViewCommentsPanel` draws the column from threads its host reads.
36 changes: 36 additions & 0 deletions content/docs/frontend/plugins/plugin-detail.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,42 @@ The components are exported from `@object-ui/plugin-detail` (`CommentsPanel`,
`CommentComposer`, `useRecordComments`); each reads the discussion off the host's
`DiscussionContext`, as the feed blocks do.

## The list page's comments column

An object's list page carries the same comments icon, without a number, in its
header's button group, on a grid and on a board (objectstack#39085). It is
there only on the desktop, on an object whose discussion is on
(`enable.feeds` not `false`), against a server that answers the threads read
(`POST /api/v1/comments/threads/query`). A press opens a 380 px column at the
page's right and the list narrows to make room; the icon shows it pressed. ✕
or Esc closes it, and the browser remembers whether it was left open. The
record drawer still shows no comments.

- **Which threads.** The comment threads on the records the list shows: the
view's saved filter together with the filters you have set on the list and
not saved. The search box does not narrow them. The server runs that filter
as your own read of the object, so someone who may read fewer records sees
fewer threads. Where the list's filter cannot be sent, the column says so
instead of listing every record's threads.
- **The cards** are newest first, one per thread: the object's icon and the
record's name, who wrote the first comment and when, its text with the
people it mentions highlighted, and 「N 条回复」 with the faces of the latest
repliers. 「加载更多」 reads the next page. The record's name opens the
record the way a row of the list does.
- **A thread in place.** The card, or its 「N 条回复」, opens the thread where
it is, with reply, ✓ resolve and reopen, reactions, Edit and Delete, each
offered exactly as on the record page. There is no box for a new thread:
a new thread starts on the record.
- **The filter menu** holds 「显示已解决」 (off) and 「只看我参与的」, as on the
record page. With nothing left to show it offers 「显示全部」.
- **It stays current.** The column reads again when the view, its filter or a
toggle changes, and when a comment is written: a reply raises the count, a
thread resolved while 「显示已解决」 is off leaves the column, and the row's
comment dot goes with it. Closed, it reads nothing.
- **When it cannot read**, it says which: you may not read this object's
comments, the read failed (with a retry), or the server does not list a
view's comments.

## The `record:activity` block

`RecordActivityTimeline` is a presenter: you hand it `items`. The SDUI block
Expand Down
3 changes: 2 additions & 1 deletion ui/e2e/list-frame-geometry-35548.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ test.describe('the list page frame (objectstack#35548)', () => {
// The page bar names the object as the page's heading, and the view bar
// does not (objectstack#36113, which split objectstack#35878's one row).
expect(SRC.pageBar.includes('data-testid="list-view-bar-object-name"'), `${FILES.pageBar} names the object in the view bar again`).toBe(false);
expect(/<ObjectViewPageHeader \{\.\.\.pageBarProps\} hosted=\{listBarHosted\} \/>/.test(read('packages/app-shell/src/views/ObjectView.tsx')), 'the list page no longer draws its page bar above the view bar').toBe(true);
// objectstack#39085 — the bar also carries the comments icon (`comments=`).
expect(/<ObjectViewPageHeader \{\.\.\.pageBarProps\} hosted=\{listBarHosted\}(?: comments=\{[\w.]+\})? \/>/.test(read('packages/app-shell/src/views/ObjectView.tsx')), 'the list page no longer draws its page bar above the view bar').toBe(true);
// One trigger: type icon → name → count → caret, in that source order.
const at = SWITCHER_PARTS.map((p) => switcherBody.indexOf(`data-testid="list-view-switcher-${p}"`));
expect(at.every((i) => i > 0), `a switcher part is missing: ${JSON.stringify(at)}`).toBe(true);
Expand Down
13 changes: 11 additions & 2 deletions ui/packages/app-shell/src/layout/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ export interface ConsolePageHeaderProps {
* nothing keeps today's header at every width.
*/
compactBelow?: number;
/**
* objectstack#39085 — the page's comments entry (the list page's comments
* icon): the first button of the shell's group where the shell draws one,
* else after the page's own actions.
*/
comments?: React.ReactNode;
/**
* CSS color used to tint the top hairline, icon chip background, and
* icon stroke. Defaults to the Shadcn `--primary` token so the header
Expand Down Expand Up @@ -233,6 +239,7 @@ export function PageHeader({
actions,
foldedActions,
compactBelow,
comments,
accentColor,
sticky = false,
posture,
Expand Down Expand Up @@ -283,7 +290,8 @@ export function PageHeader({
const renderSidebarExpand = useShellSidebarExpandSlot();
const leading = renderSidebarExpand?.();
const pageActions = refreshButton || drawnActions;
const trailing = (pageActions || renderShellGroup) && (
const ownComments = renderShellGroup ? null : comments ?? null;
const trailing = (pageActions || renderShellGroup || ownComments) && (
<div
ref={clusterRef}
className="flex items-center gap-1.5 sm:gap-2 shrink-0"
Expand All @@ -295,7 +303,8 @@ export function PageHeader({
{renderShellGroup && pageActions && (
<span aria-hidden="true" className="h-4 w-px shrink-0 bg-border" data-testid="page-header-shell-divider" />
)}
{renderShellGroup?.({ assistantIconOnly })}
{ownComments}
{renderShellGroup?.({ comments, assistantIconOnly })}
</div>
);

Expand Down
5 changes: 3 additions & 2 deletions ui/packages/app-shell/src/layout/shellPageActionsSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import { usePhoneViewport } from '../hooks/usePhoneViewport.js';

export interface ShellPageActionsSlotProps {
/**
* The comments entry, first in the group: handed by the list and record
* pages only, nothing until the comments work puts its icon here.
* The comments entry, first in the group: handed by the record page
* (objectstack#36112) and the list page (objectstack#39085, through
* `PageHeader`'s `comments`) only.
*/
comments?: React.ReactNode;
/**
Expand Down
Loading
Loading