Skip to content

fix(ui): make message action rows use Astryx Icon and IconButton without product overrides #5133

Closed

Description

@Astro-Han

Problem

The action row under user and assistant messages (copy / edit on the user side; regenerate / branch / copy / info on the assistant side) uses Astryx for the container and the button shell, but everything inside and around them is product-owned and drifts from the Astryx component contract and from DESIGN.md §7 ("no second icon system or parallel component path").

Verified against main (8b3655a17), all in packages/ui/src:

  1. Icons come from lucide-react, not Astryx Icon. chat-turn.tsx renders <RefreshCcw size={14}>, <GitBranch size={14}>, <Copy size={14}>, <Info size={14}>, <Pencil size={14}>, <Check size={14}> directly inside IconButton (chat-turn.tsx:976-981, chat-turn.tsx:197). Astryx's Icon already has semantic names for copy, check, info and clock, sizes via size="sm", and colour via color="secondary"; the remaining glyphs (regenerate, branch, edit) can be passed to Icon as SVG components instead of bypassing it. The hand-picked 14px comes from a product-side ICON_SIZE.control rung (icons.tsx) that exists because the lucide glyphs are not going through Icon.
  2. Product CSS overrides Astryx IconButton geometry and state colours. styles.css:885-898 resets border, border-radius and color on .maka-turn-footer-action, then paints pending / copied / failed via custom data-pending, data-copy-feedback attributes. DESIGN.md §10 says busy controls use the Astryx isLoading prop, "no hand-swapped labels, icons, or disable-plus-spinner recreations"; the copy button does exactly that (swaps Copy for Check, drives colour from data-copy-feedback).
  3. User and assistant rows follow different reveal rules. User-side actions fade in per button on .maka-user-message:hover (styles.css:212-219); the assistant side fades the whole .maka-turn-footer on .maka-assistant-answer:hover (styles.css:875-883). The user side also removes Astryx ChatMessageMetadata's own separator positionally (.maka-message-meta > span + span { display: none }), which depends on Astryx's internal DOM order.
  4. info is a fake button. It is an IconButton whose click handler is a no-op and whose only content is a tooltip carrying "model · duration · cost" (chat-turn.tsx:920). A pressable control that does nothing is the wrong primitive for read-only metadata; ChatMessageMetadata already has timestamp and footer text slots for that.
  5. Disabled is expressed as aria-disabled + opacity, not isDisabled. Footer actions keep aria-disabled and swallow the click in JS so the tooltip can still explain why; Astryx's disabled state and focus/hover treatment are therefore not applied.

Desired outcome

  • Every glyph in the message action rows goes through Astryx Icon (semantic name where one exists, SVG component otherwise), sized and coloured by Icon props, with no product-side pixel constant on these call sites.
  • IconButton keeps its own border, radius, colour, hover, focus, disabled and isLoading treatment; styles.css stops restyling .maka-turn-footer-action. Copy feedback uses the same mechanism as other Astryx buttons in the app.
  • User and assistant action rows share one reveal rule and one layout, and do not reach into Astryx DOM order to remove separators.
  • Turn metadata is rendered as metadata text, not as a button with a tooltip.
  • Light/dark before/after captures from the same Storybook stories in the PR, per the repo's visual-PR convention.

Non-goals: which actions exist and when they are enabled. That is a product-model question tracked separately (#5132).

Alternatives or workarounds

Keep lucide as the glyph source but route it through <Icon icon={RefreshCcw} size="sm" />. This is the smallest change that removes the pixel constant and the IconButton overrides; it still leaves two icon families visible side by side where an Astryx semantic name already exists (copy, check, info), so it should be a step, not the end state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions