From 3578c52b448d2bb2d19199e168becaade0ce71b6 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 00:44:05 +0000 Subject: [PATCH 1/9] feat(plugin-detail): dense label-left field rows on the default record page Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me --- .../plugin-detail/src/DetailSection.tsx | 65 +++++++++++++++---- 1 file changed, 54 insertions(+), 11 deletions(-) diff --git a/ui/packages/plugin-detail/src/DetailSection.tsx b/ui/packages/plugin-detail/src/DetailSection.tsx index 692b97aa8be..382dc04405d 100644 --- a/ui/packages/plugin-detail/src/DetailSection.tsx +++ b/ui/packages/plugin-detail/src/DetailSection.tsx @@ -115,6 +115,23 @@ export function getResponsiveSpanClass(span: number | undefined, columns: number return ''; } +/** The frameless grid's columns by its column count, opened by container width. */ +const FRAMELESS_GRID_COLUMNS: Record<1 | 2 | 3, string> = { + 1: 'grid-cols-1', + 2: 'grid-cols-1 @xl:grid-cols-2', + 3: 'grid-cols-1 @xl:grid-cols-2 @4xl:grid-cols-3', +}; + +/** + * A wide field's span on the frameless grid: the same container widths the + * grid opens its columns at, never more cells than the grid draws. + */ +export function framelessSpanClass(span: number | undefined, columns: 1 | 2 | 3): string { + if (!span || span <= 1 || columns <= 1) return ''; + if (columns === 2 || span === 2) return '@xl:col-span-2'; + return '@xl:col-span-2 @4xl:col-span-3'; +} + /** * The `onChange` a read display is handed. The `readonly` branches of * `TextAreaField` and `TextField`, and the read-only `FormulaField` and @@ -471,8 +488,9 @@ export const DetailSection: React.FC = ({ // A frameless section (objectstack#27055) takes 1–3 columns by the fields it // shows, never the object-wide count, and at most two beside the right // column of the two-column tier (objectstack#27524). + const framelessColumns = framelessSectionColumns(visibleFields.length, framelessColumnCap); const effectiveColumns = frameless - ? framelessSectionColumns(visibleFields.length, framelessColumnCap) + ? framelessColumns : Math.min(rawColumns, Math.max(1, visibleFields.length)); const renderField = (field: DetailViewField) => { @@ -799,16 +817,34 @@ export const DetailSection: React.FC = ({ // value (raw JSON, a GPS pair, a URL) sets the track's min width and // overflows into the neighbouring cell — visible once columns narrow // (objectui#2578). Allowing the item to shrink lets the value wrap. + // The frameless face (the default record page) draws a dense row: the + // label left in a fixed-width 12 px muted column, the value right at + // 13 px, one 32 px line for a one-line value. return ( -
+
{/* The label as authored, in the header highlights' style: no case transform, which only Latin text takes, so a translated label and an untranslated one beside it read in one style. */} -
- {fieldLabel(objectName || '', field.name, field.label || field.name)} +
+ {fieldLabelText}
{isEditing && fieldEditable ? ( -
+
= ({
= ({ tabIndex={copyInteractive ? 0 : undefined} title={canInlineEditField ? t('detail.editInlineHint') : undefined} > -
+
{displayValue}
{canInlineEditField ? ( @@ -984,11 +1026,12 @@ export const DetailSection: React.FC = ({
Date: Fri, 20 Nov 2026 00:48:35 +0000 Subject: [PATCH 2/9] wip(plugin-detail): dense day-grouped activity stream Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me --- .../src/RecordActivityTimeline.tsx | 335 +++++++++++++++--- 1 file changed, 282 insertions(+), 53 deletions(-) diff --git a/ui/packages/plugin-detail/src/RecordActivityTimeline.tsx b/ui/packages/plugin-detail/src/RecordActivityTimeline.tsx index 5283b1fe7b1..105aae3aee0 100644 --- a/ui/packages/plugin-detail/src/RecordActivityTimeline.tsx +++ b/ui/packages/plugin-detail/src/RecordActivityTimeline.tsx @@ -52,6 +52,7 @@ import { TIMELINE_STREAM_FILTERS, fieldHistoryEntriesOf, fieldHistoryOf, + isFieldHistoryEntry, filterTimelineStream, isSystemStreamEntry, timelineStreamFilters, @@ -182,10 +183,20 @@ export interface RecordActivityTimelineProps { totalCount?: number; /** The peek's 「查看全部 N 条 →」: open the 动态 tab. Absent: not drawn. */ onViewAll?: () => void; + /** + * The stream's 「看审批」 on an approval entry: open the record's approvals. + * Absent: the entry is its one line with no link. + */ + onViewApprovals?: () => void; className?: string; } /** The stream chips' copy (objectstack#27055): 全部 / 活动 / 讨论 / 变更. */ +/** The stream comment's icon cell: the stream row's 14 px icon, centred on its first line. */ +const STREAM_ICON_CELL = 'shrink-0 flex h-[30px] w-3.5 items-center justify-center text-muted-foreground'; +/** The stream comment's header line: who, then when, 30 px tall, wrapping between pieces. */ +const STREAM_COMMENT_HEADER = 'flex min-h-[30px] flex-wrap items-center gap-x-2 text-[13px]'; + const STREAM_FILTER_KEYS: Record = { all: { key: 'detail.streamAll', fallback: 'All' }, activity: { key: 'detail.streamActivity', fallback: 'Activity' }, @@ -229,6 +240,69 @@ const FEED_TYPE_COLORS: Record = { approval: 'bg-violet-100 text-violet-600', }; +/** + * Whether a stream entry is one person's field change, the kind + * {@link foldStreamChanges} folds: an audit entry or an `updated` activity + * row, not a milestone (`activityKind`) and not a reply. + */ +function isStreamFieldChange(item: FeedItem): boolean { + return ( + item.type === 'field_change' + && (isFieldHistoryEntry(item) || item.activityType === 'updated') + && item.activityKind === undefined + && !item.parentId + ); +} + +/** The local calendar day an entry was written on (`YYYY-M-D`), or '' when unparseable. */ +function dayKeyOf(createdAt: string | undefined): string { + const date = createdAt ? new Date(createdAt) : null; + if (!date || Number.isNaN(date.getTime())) return ''; + return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; +} + +/** + * The stream's display grouping: consecutive field changes by one person + * (the same `actorId` and display name) on one day become ONE fold row, which + * expands to each change. Every entry stays in the stream, in order; nothing + * is merged in the data. A run of one is an ordinary row. + */ +export function foldStreamChanges(items: readonly FeedItem[]): ActivityTimelineEntry[] { + const entries: ActivityTimelineEntry[] = []; + let run: FeedItem[] = []; + const flush = () => { + if (run.length > 1) entries.push({ kind: 'fold', id: `fold:${String(run[0].id)}`, items: run }); + else if (run.length === 1) entries.push({ kind: 'item', item: run[0] }); + run = []; + }; + for (const item of items) { + if (!isStreamFieldChange(item)) { + flush(); + entries.push({ kind: 'item', item }); + continue; + } + const prev = run[run.length - 1]; + if ( + prev + && ((prev.actorId ?? null) !== (item.actorId ?? null) + || prev.actor !== item.actor + || dayKeyOf(prev.createdAt) !== dayKeyOf(item.createdAt)) + ) { + flush(); + } + run.push(item); + } + flush(); + return entries; +} + +/** The fields a stream field change names: its own list, its changes, or its paired audit entry's. */ +function streamChangedFieldsOf(item: FeedItem): string[] { + if (item.changedFields && item.changedFields.length > 0) return item.changedFields; + const changes = fieldHistoryOf(item)?.fieldChanges ?? item.fieldChanges ?? []; + return changes.map((change) => change.field); +} + /** * The dropdown's options, given whether the record's field history is shown * (`RecordFieldHistoryContext`): `changes_only` is offered exactly when the @@ -378,6 +452,7 @@ export const RecordActivityTimeline: React.FC = ({ onStreamFilterChange, totalCount, onViewAll, + onViewApprovals, className, }) => { const isPeek = variant === 'peek'; @@ -537,11 +612,10 @@ export const RecordActivityTimeline: React.FC = ({ // Runs of consecutive updates by one actor, folded into one row each // (objectstack#25959). Folded at render from the rows the reader sees; the // feed itself keeps every entry. - // The stream draws every entry as its own line (objectstack#27055): a - // system entry is already one compact line, so there is nothing to fold. + // The stream folds a run of one person's field changes on one day into one + // expandable row ({@link foldStreamChanges}): display grouping only. const timelineEntries = React.useMemo( - (): ActivityTimelineEntry[] => - isStream ? (rootItems.map((item) => ({ kind: 'item', item })) as ActivityTimelineEntry[]) : foldFeedItems(rootItems), + (): ActivityTimelineEntry[] => (isStream ? foldStreamChanges(rootItems) : foldFeedItems(rootItems)), [rootItems, isStream], ); // Which folded rows the reader has expanded, by the fold's id. @@ -661,39 +735,108 @@ export const RecordActivityTimeline: React.FC = ({ }) : t('detail.activityUpdated'); }; + // The stream's dense row (the record page's 动态 tab): a small icon, who, + // what, and the time at the right, on ONE 30 px line. The what truncates + // (its whole text is the row's title) and the time never breaks + // (objectstack#34614), so a narrow drawer keeps one line per entry. + const streamRow = ( + item: FeedItem, + Icon: React.ElementType, + what: React.ReactNode, + whatTitle: string, + extra?: React.ReactNode, + rowProps?: Record, + ): React.ReactNode => { + const when = formatTimestamp(item.createdAt, t, displayLocale); + return ( +
+ + + {item.actor} + + {what} + {extra} + + {when} + +
+ ); + }; const renderSystemLine = (item: FeedItem): React.ReactNode => { const Icon = FEED_TYPE_ICONS[item.type] || Zap; const what = systemLineText(item); const paired = fieldHistoryOf(item); - return ( -
- - - -

- {what} - {' · '} - {item.actor} - {/* "· 3d ago" never breaks inside (objectstack#34614): the space - before it is the line's last break opportunity. */} - {' '} - - {'· '} - {formatTimestamp(item.createdAt, t, displayLocale)} - - {paired && ( - - {changesText(paired)} - - )} -

-
+ const diff = paired ? changesText(paired) : ''; + return streamRow( + item, + Icon, + <> + {what} + {paired && ( + <> + {' · '} + {diff} + + )} + , + diff ? `${what} · ${diff}` : what, + undefined, + { 'data-stream-system-row': '' }, + ); + }; + // An approval entry is one line; its progress lives on the approvals tab, + // which 「看审批」 opens (the epic's direction: no approval detail here). + const renderApprovalLine = (item: FeedItem): React.ReactNode => { + const what = (item.body ?? '').replace(/\s+/g, ' ').trim() || t('detail.activityUpdated'); + return streamRow( + item, + FEED_TYPE_ICONS.approval, + what, + what, + onViewApprovals ? ( + + ) : undefined, + { 'data-stream-approval-row': '' }, ); }; const renderItem = (item: FeedItem): React.ReactNode => { if (isStream && isSystemStreamEntry(item)) return renderSystemLine(item); + if (isStream && item.type === 'approval') return renderApprovalLine(item); const Icon = FEED_TYPE_ICONS[item.type] || Zap; + // Every stream entry but a comment is its one line: what it says, and a + // link to its source record where it has one (ADR-0052 ActivityPointer). + if (isStream && item.type !== 'comment') { + const what = (item.body ?? '').replace(/\s+/g, ' ').trim() || t('detail.activityUpdated'); + return streamRow( + item, + Icon, + what, + what, + item.sourceObject && item.sourceId != null ? ( + + {t('detail.viewSource')} + + ) : undefined, + ); + } const colorClass = FEED_TYPE_COLORS[item.type] || 'bg-gray-100 text-gray-600'; // Threading (objectui#12144). The reply LIST shows only under a @@ -712,12 +855,14 @@ export const RecordActivityTimeline: React.FC = ({ : undefined; const changeLines = fieldHistoryOf(item)?.fieldChanges ?? (item.type === 'field_change' ? item.fieldChanges : undefined); + // A stream comment is the stream's row with the comment under it: a + // small icon, who and when on one line, then what they wrote. return ( -
-
+
+
{/* Icon */}
= ({ {item.actor} ) : ( )}
{/* Content */} -
+
{/* The row wraps between its pieces and the time is one unbreakable piece (objectstack#34614): in a narrow drawer the time moves to the next line instead of breaking per word. */} -
+
{item.actor} {item.source && ( @@ -767,7 +912,7 @@ export const RecordActivityTimeline: React.FC = ({ // The body is what the author wrote, so it reads in the // foreground colour, as a reply's body does; the muted grey // belongs to the meta line above it (objectstack#27520 row 14). - bodyClassName="text-sm whitespace-pre-wrap break-words text-foreground" + bodyClassName={cn(isStream ? 'text-[13px] leading-5' : 'text-sm', 'whitespace-pre-wrap break-words text-foreground')} /> {/* Drill to source rich entity (ADR-0052 ActivityPointer) */} @@ -835,9 +980,13 @@ export const RecordActivityTimeline: React.FC = ({ // the fields they changed. The toggle expands the run to its entries, each // rendered exactly as an unfolded row. const renderFold = (entry: Extract): React.ReactNode => { - const latest = entry.items[entry.items.length - 1]; + // The stream is newest first, so its run's latest entry is its first. + const latest = isStream ? entry.items[0] : entry.items[entry.items.length - 1]; const count = entry.items.length; - const labels = changedFieldsOf(entry.items).map(labelOfField); + const labels = (isStream + ? Array.from(new Set(entry.items.flatMap(streamChangedFieldsOf))) + : changedFieldsOf(entry.items) + ).map(labelOfField); const shown = labels.slice(0, FOLD_FIELDS_SHOWN); const rest = labels.length - shown.length; const named = rest > 0 ? [...shown, t('detail.foldedMoreFields', { count: rest })] : shown; @@ -851,6 +1000,38 @@ export const RecordActivityTimeline: React.FC = ({ : t('detail.activityUpdated'); const expanded = expandedFolds.has(entry.id); const Icon = FEED_TYPE_ICONS.field_change; + if (isStream) { + return ( +
+ {streamRow( + latest, + Icon, + summary, + summary, + <> + + {t('detail.foldedUpdateCount', { count })} + + + , + { 'data-stream-fold-row': '' }, + )} + {expanded && ( +
+ {entry.items.map((item) => renderItem(item))} +
+ )} +
+ ); + } return (
@@ -914,7 +1095,7 @@ export const RecordActivityTimeline: React.FC = ({ placeholder={t('detail.leaveCommentPlaceholder')} disabled={isSubmitting} canSubmitEmpty={pendingAttachments.length > 0} - autoFocus={isPeek} + autoFocus={isStream} extraSlot={ onUploadAttachments ? ( = ({ /> ); + // The peek's and the stream's composer: ONE line until the reader presses it + // (or a draft is held), then the full composer, focused. + const composerLine = + composerOpen || commentText || pendingAttachments.length > 0 ? ( + composer + ) : ( + + ); + + // The stream's day header over its entries: 今天, 昨天, then the date. + const dayLabelOf = (createdAt: string | undefined): string => { + const key = dayKeyOf(createdAt); + if (!key || !createdAt) return ''; + const now = new Date(); + if (key === dayKeyOf(now.toISOString())) return t('detail.streamToday', { defaultValue: 'Today' }); + const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1); + if (key === dayKeyOf(yesterday.toISOString())) return t('detail.streamYesterday', { defaultValue: 'Yesterday' }); + const date = new Date(createdAt); + return date.toLocaleDateString(displayLocale, { + month: 'short', + day: 'numeric', + ...(date.getFullYear() !== now.getFullYear() ? { year: 'numeric' as const } : {}), + }); + }; + const firstItemOf = (entry: ActivityTimelineEntry): FeedItem => (entry.kind === 'fold' ? entry.items[0] : entry.item); + const renderStreamDays = (): React.ReactNode => { + const days: { key: string; label: string; entries: ActivityTimelineEntry[] }[] = []; + for (const entry of timelineEntries) { + const createdAt = firstItemOf(entry).createdAt; + const key = dayKeyOf(createdAt); + const last = days[days.length - 1]; + if (last && last.key === key) last.entries.push(entry); + else days.push({ key, label: dayLabelOf(createdAt), entries: [entry] }); + } + return ( +
+ {days.map((day, index) => ( +
+ {day.label && ( +
+ {day.label} +
+ )} + {day.entries.map((entry) => (entry.kind === 'fold' ? renderFold(entry) : renderItem(entry.item)))} +
+ ))} +
+ ); + }; + // objectstack#27524, Target 5 — the 动态 panel's body. The panel around it // draws the header (「动态」 and the count); here: the composer, one line // until pressed, then the entries this block was handed (the newest, roots @@ -967,18 +1205,7 @@ export const RecordActivityTimeline: React.FC = ({
{showCommentInput && (
- {composerOpen || commentText || pendingAttachments.length > 0 ? ( - composer - ) : ( - - )} + {composerLine}
)} {filtered.length > 0 && readNotice &&
{readNotice}
} @@ -1024,7 +1251,7 @@ export const RecordActivityTimeline: React.FC = ({ // pinned to the right rail it wraps this with its own border, so // we don't double up. className={cn( - 'border-t border-border/60 pt-5', + isStream ? 'border-t border-border/60 pt-3' : 'border-t border-border/60 pt-5', className, )} // Named with the heading's own title value, not a second string @@ -1043,7 +1270,7 @@ export const RecordActivityTimeline: React.FC = ({ // mounts' HTML byte for byte, and both went red on that id. aria-label={title} > -
+
{/* Wraps: in a 320 px foot card the stream's chips go under the title rather than past the card's edge (objectstack#27055). */}
@@ -1093,7 +1320,7 @@ export const RecordActivityTimeline: React.FC = ({
-
+
{/* Filter dropdown — the stream has its chips instead */} {showFilter && !isStream && (
@@ -1119,7 +1346,7 @@ export const RecordActivityTimeline: React.FC = ({ )} {/* Comment Input — rich text with @mention + bold/italic/list/code + preview */} - {showCommentInput && composer} + {showCommentInput && (isStream ? composerLine : composer)} {/* A refusal with rows on screen (objectui#11195): the comments were readable and the activity was not, or the other way round. @@ -1169,6 +1396,8 @@ export const RecordActivityTimeline: React.FC = ({ className="py-6" /> ) + ) : isStream ? ( + renderStreamDays() ) : (
{/* Timeline line */} From a4f5aca9d553b659a5fcd12341cd63e3e6a50ad4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 00:57:59 +0000 Subject: [PATCH 3/9] wip(plugin-detail): dense activity rows in panel and stream, one-line composer Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me --- .../src/CommentAuthorControls.tsx | 5 +- .../src/RecordActivityTimeline.tsx | 331 +++++++----------- .../src/RichTextCommentInput.tsx | 32 +- 3 files changed, 156 insertions(+), 212 deletions(-) diff --git a/ui/packages/plugin-detail/src/CommentAuthorControls.tsx b/ui/packages/plugin-detail/src/CommentAuthorControls.tsx index f39cbb84b81..42735937601 100644 --- a/ui/packages/plugin-detail/src/CommentAuthorControls.tsx +++ b/ui/packages/plugin-detail/src/CommentAuthorControls.tsx @@ -39,6 +39,8 @@ export interface CommentBodyProps { onDeleteComment?: (itemId: string | number) => void | Promise; /** The body paragraph's classes: the timeline row and a reply each keep their own. */ bodyClassName: string; + /** The Edit and Delete row's classes; a row under the body by default. */ + controlsClassName?: string; } /** @@ -61,6 +63,7 @@ export const CommentBody: React.FC = ({ onEditComment, onDeleteComment, bodyClassName, + controlsClassName = 'mt-1 flex items-center gap-0.5', }) => { const { t } = useDetailTranslation(); const own = offersAuthorControls(item); @@ -137,7 +140,7 @@ export const CommentBody: React.FC = ({ <> {item.body &&

{item.body}

} {(edit || remove) && ( -
+
{edit && ( + )} + + ) : null}
{/* Body text, and the author's Edit and Delete on their own comment (objectui#12268). The host decides whose comment it is (`authoredByViewer`) and hands each handler over under the caller's grant; a row that - offers neither renders the same paragraph as before. */} + offers neither renders the same paragraph as before. + The body is what the author wrote, so it reads in the + foreground colour; the muted grey belongs to the meta line + above it (objectstack#27520 row 14). */} {/* Drill to source rich entity (ADR-0052 ActivityPointer) */} {item.sourceObject && item.sourceId != null && ( {t('detail.viewSource')} @@ -927,46 +934,22 @@ export const RecordActivityTimeline: React.FC = ({ )} - {/* Field changes. An activity row paired with its audit entry - (objectstack#30122) shows that entry's before and after values, - as the stream's row does (objectstack#33996). */} - {changeLines && ( -
- {changeLines.map((change, idx) => ( - - ))} -
- )} - {/* Reactions */} {enableReactions && item.reactions && item.reactions.length > 0 && ( -
- -
- )} - - {/* Add reaction button (even if no reactions yet) */} - {(!item.reactions || item.reactions.length === 0) && toggleReaction && ( -
- +
+
)}
{/* Threading */} - {enableThreading && (replies.length > 0 || offersReply) && ( + {enableThreading && (replies.length > 0 || replyOpen) && ( @@ -976,12 +959,11 @@ export const RecordActivityTimeline: React.FC = ({ }; // A run of consecutive updates by one actor, as one row (objectstack#25959): - // who, when the latest entry was written, how many entries, and the union of - // the fields they changed. The toggle expands the run to its entries, each - // rendered exactly as an unfolded row. + // who, when the latest entry was written, how many entries, and the fields + // they changed. The chevron expands the run to its entries, each drawn as + // its own row. const renderFold = (entry: Extract): React.ReactNode => { - // The stream is newest first, so its run's latest entry is its first. - const latest = isStream ? entry.items[0] : entry.items[entry.items.length - 1]; + const latest = entry.items.reduce((a, b) => (Date.parse(b.createdAt) > Date.parse(a.createdAt) ? b : a)); const count = entry.items.length; const labels = (isStream ? Array.from(new Set(entry.items.flatMap(streamChangedFieldsOf))) @@ -999,85 +981,31 @@ export const RecordActivityTimeline: React.FC = ({ ? t('detail.foldedUpdates', { fields: named.join(t('validation.formInvalidJoiner')) }) : t('detail.activityUpdated'); const expanded = expandedFolds.has(entry.id); - const Icon = FEED_TYPE_ICONS.field_change; - if (isStream) { - return ( -
- {streamRow( - latest, - Icon, - summary, - summary, - <> - - {t('detail.foldedUpdateCount', { count })} - - - , - { 'data-stream-fold-row': '' }, - )} - {expanded && ( -
- {entry.items.map((item) => renderItem(item))} -
- )} -
- ); - } return (
-
-
- {latest.actorAvatarUrl ? ( - {latest.actor} - ) : ( - - )} -
-
-
- {latest.actor} - - {formatTimestamp(latest.createdAt, t, displayLocale)} - - - {t('detail.foldedUpdateCount', { count })} - -
-

{summary}

+ {streamRow( + latest, + FEED_TYPE_ICONS.field_change, + summary, + summary, + <> + + {t('detail.foldedUpdateCount', { count })} + -
-
+ , + { 'data-stream-fold-row': '' }, + )} {expanded && ( -
+
{entry.items.map((item) => renderItem(item))}
)} @@ -1095,7 +1023,8 @@ export const RecordActivityTimeline: React.FC = ({ placeholder={t('detail.leaveCommentPlaceholder')} disabled={isSubmitting} canSubmitEmpty={pendingAttachments.length > 0} - autoFocus={isStream} + autoFocus={isPeek} + compact={!isPeek} extraSlot={ onUploadAttachments ? ( = ({ /> ); - // The peek's and the stream's composer: ONE line until the reader presses it - // (or a draft is held), then the full composer, focused. + // The peek's composer: ONE line until the reader presses it (or a draft is + // held), then the full composer, focused. The panel and the stream draw the + // composer itself, one line until focused (`compact`). const composerLine = composerOpen || commentText || pendingAttachments.length > 0 ? ( composer @@ -1131,7 +1061,7 @@ export const RecordActivityTimeline: React.FC = ({ ); - // The stream's day header over its entries: 今天, 昨天, then the date. + // The day header over its entries: 今天, 昨天, then the date. const dayLabelOf = (createdAt: string | undefined): string => { const key = dayKeyOf(createdAt); if (!key || !createdAt) return ''; @@ -1147,7 +1077,7 @@ export const RecordActivityTimeline: React.FC = ({ }); }; const firstItemOf = (entry: ActivityTimelineEntry): FeedItem => (entry.kind === 'fold' ? entry.items[0] : entry.item); - const renderStreamDays = (): React.ReactNode => { + const renderDays = (): React.ReactNode => { const days: { key: string; label: string; entries: ActivityTimelineEntry[] }[] = []; for (const entry of timelineEntries) { const createdAt = firstItemOf(entry).createdAt; @@ -1251,7 +1181,7 @@ export const RecordActivityTimeline: React.FC = ({ // pinned to the right rail it wraps this with its own border, so // we don't double up. className={cn( - isStream ? 'border-t border-border/60 pt-3' : 'border-t border-border/60 pt-5', + 'border-t border-border/60 pt-3', className, )} // Named with the heading's own title value, not a second string @@ -1270,11 +1200,11 @@ export const RecordActivityTimeline: React.FC = ({ // mounts' HTML byte for byte, and both went red on that id. aria-label={title} > -
+
{/* Wraps: in a 320 px foot card the stream's chips go under the title rather than past the card's edge (objectstack#27055). */}
-

+

{title} {/* A refused read leaves the count unknown, not zero: the rows @@ -1311,6 +1241,28 @@ export const RecordActivityTimeline: React.FC = ({ ))}

)} + {/* The filter: a quiet text button at the right of the title + row (「全部动态 ▾」) — the stream has its chips instead. */} + {showFilter && !isStream && ( + + )} {showSubscription && subscription && ( = ({
-
- {/* Filter dropdown — the stream has its chips instead */} - {showFilter && !isStream && ( -
- -
- )} - +
{/* Comment Input — rich text with @mention + bold/italic/list/code + preview */} - {showCommentInput && (isStream ? composerLine : composer)} + {showCommentInput && composer} {/* A refusal with rows on screen (objectui#11195): the comments were readable and the activity was not, or the other way round. @@ -1396,19 +1324,8 @@ export const RecordActivityTimeline: React.FC = ({ className="py-6" /> ) - ) : isStream ? ( - renderStreamDays() ) : ( -
- {/* Timeline line */} -
- -
- {timelineEntries.map((entry) => - entry.kind === 'fold' ? renderFold(entry) : renderItem(entry.item), - )} -
-
+ renderDays() )} {/* Load More */} diff --git a/ui/packages/plugin-detail/src/RichTextCommentInput.tsx b/ui/packages/plugin-detail/src/RichTextCommentInput.tsx index 5b11a99c7de..c1495fed33e 100644 --- a/ui/packages/plugin-detail/src/RichTextCommentInput.tsx +++ b/ui/packages/plugin-detail/src/RichTextCommentInput.tsx @@ -48,6 +48,12 @@ export interface RichTextCommentInputProps { /** Called when the editor takes focus: the host reads the mention * suggestions then, not when the record opens (objectstack#28470). */ onMentionSuggestionsWanted?: () => void; + /** + * One line until used: while the composer holds no text, nothing to send + * and no focus, it is the editor alone at one line, with no toolbar and no + * extra slot. Focus opens it in full. The record timeline's composer. + */ + compact?: boolean; } /** The look of a picked mention, in the preview and in the composer's chip row. */ @@ -114,9 +120,12 @@ export const RichTextCommentInput: React.FC = ({ canSubmitEmpty = false, autoFocus = false, onMentionSuggestionsWanted, + compact = false, }) => { const { t } = useDetailTranslation(); const [isPreview, setIsPreview] = React.useState(false); + const [focused, setFocused] = React.useState(false); + const collapsed = compact && !focused && !value && !canSubmitEmpty && !isPreview; const [showMentions, setShowMentions] = React.useState(false); const [mentionQuery, setMentionQuery] = React.useState(''); const [mentionIndex, setMentionIndex] = React.useState(0); @@ -262,9 +271,20 @@ export const RichTextCommentInput: React.FC = ({ ); return ( -
+
setFocused(true) : undefined} + onBlur={ + compact + ? (e) => { + if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setFocused(false); + } + : undefined + } + > {/* Toolbar */} -
+