Repository navigation
refactor(ui): move user-message layout onto Astryx primitives - #5848
Conversation
Replaces hand-written flex rules in the user-message surface with HStack/ChatMessageMetadata props: the quotes row, attachment rows, quote chips, and the meta row's redundant flex declarations. Product CSS keeps only appearance and the deliberate 6px spacing nudge; marker classes queried by tests and WorkHub stay in place. Verified lossless: 40/40 storybook pixel shots identical to the ec324da baseline, 479-render smoke all passing. Part of apache#5795. Generated-by: Devin Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Moves data-transient-message-id onto ChatMessage itself (BaseProps forwards data-*), deleting the native wrapper div entirely. Quote chip width/max-width/align/padding-block move to HStack props, leaving the variant classes with only radius and the documented 24px height pin. Verified lossless again: 40/40 pixel-identical to baseline, 45 focused tests pass. Part of apache#5795. Generated-by: Devin Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
de5596f to
a86cf89
Compare
jackwener
left a comment
There was a problem hiding this comment.
Reviewed head a86cf899aafda9f031a07ccb9d7013a89c3d41bd. No P0–P3.
- The layout moves onto
HStackprops with equivalent values: gap 1 = 4px,paddingInline2 = 8px,paddingBlock1 / 0.5 = 4px / 2px, the collapsedmaxWidthof 240px, and align start/center. The CSS keeps only paint (background, inset border, radius) and the collapsed height pin that #1879 documents. - Deleting the transient wrapper is safe:
LocalizedChatMessagespreads the remaining props intoChatMessage, sodata-transient-message-idstill reaches the DOM.- The only CSS consumer (
chat-message.css:86,overflow-anchor: none) excludes the element and its subtree either way. - The tests and stories that query the attribute look for the element itself, not a descendant of it.
- The dropped class names
maka-user-attachment-tokensandmaka-user-attachmentshave no remaining references anywhere in the repo. The marker classes WorkHub and tests rely on are kept. - The Astryx surface inventory is updated for the new
HStackimport inquote-ref-chip.tsx.
The PR reports a zero-diff pixel compare (40/40 identical) and a green Storybook smoke. CI test was still running when I posted.
hqhq1025
left a comment
There was a problem hiding this comment.
No actionable findings on this head. The user-message quote and attachment rows move to Astryx HStack props with the prior gap, wrapping, alignment, and width constraints; the quote chip keeps its visual paint and collapsed height. Removing the transient wrapper preserves data-transient-message-id on ChatMessage itself, which forwards it to the article DOM node, so the existing scroll-anchor exclusion and query selectors still apply. The Astryx inventory is updated for the new primitive.
I ran a clean Node 24 build, the three focused UI suites (45/45), the Astryx surface inventory, and git diff --check. Desktop Storybook built, and I rendered the sent-quote interaction in Chromium: the expanded chip, quotes row, metadata alignment, and hover card were present without page errors. The exact-head hosted test check is green; the PR base matches current main. I did not independently reproduce the author’s 40-image baseline pixel comparison or run the full Storybook smoke catalog.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
jackwener
left a comment
There was a problem hiding this comment.
Approving at a86cf899aafda9f031a07ccb9d7013a89c3d41bd: no P0–P3, CI green on this head. Details in #5848 (review).
English
Summary
First slice of the #5795 area split — the user-message surface (bubble, attachments, quote chips, meta row). Hand-written flex moves onto Astryx primitives: the quotes row and attachment rows are
HStacks, the quote chip'swidth/max-width/align-items/padding-blockbecomeHStackprops, the meta row's redundantdisplay/align-itemsdeclarations are dropped (ChatMessageMetadataalready owns them), and the transient-message wrapperdivis deleted by movingdata-transient-message-idontoChatMessageitself. Marker classes consumed by tests and WorkHub CSS (.maka-user-message,.maka-user-quotes,.maka-message-meta,.maka-quote-chip*) are preserved.Verified with the pixel-diff tool from #5794 (not yet merged — run from that branch).
Refs #5795
Verification
shots:storybook compareagainst theec324da4fbaseline →0 changed, 40 identical, 0 skipped(exit 0)storybook-visual-smoke.mjson the rebuilt catalog → 439 stories / 479 theme renders pass, play functions includedtsc --noEmiton@maka/uiclean; 45 focused unit tests pass (quote-ref-chip,chat-turn-answer-identity,chat-turn-steering-order)npx biome checkclean on touched filesAI use
Select exactly one:
Tool(s) and scope: Devin — refactor authored by the agent; pixel comparison, smoke, and unit tests run locally.
Checklist
Does this PR entail a change in behavior?
中文
Summary
#5795 分区拆分的第一片——用户消息面(气泡、附件、引用 chips、meta 行)。手写 flex 迁到 Astryx 原语上:引用行和附件行改为
HStack,quote chip 的width/max-width/align-items/padding-block改为HStackprops,meta 行中冗余的display/align-items声明被删除(ChatMessageMetadata本就自带),transient 消息外层的div也通过把data-transient-message-id挪到ChatMessage本体上而删除。测试和 WorkHub CSS 消费的标记类(.maka-user-message、.maka-user-quotes、.maka-message-meta、.maka-quote-chip*)全部保留。使用 #5794 的像素对比脚本验证(该工具尚未合入——在其分支上运行)。
Refs #5795
Verification
shots:storybook compare对照ec324da4f基线 →0 changed, 40 identical, 0 skipped(退出码 0)storybook-visual-smoke.mjs跑重建后的 catalog → 439 个 story / 479 个主题渲染全部通过,含 play 函数@maka/ui的tsc --noEmit干净;45 个相关单测通过(quote-ref-chip、chat-turn-answer-identity、chat-turn-steering-order)npx biome check对改动文件无告警AI use
Select exactly one:
Tool(s) and scope: Devin —— 重构由 agent 编写;像素对比、smoke 和单测均在本地运行。
Checklist
Does this PR entail a change in behavior?