Skip to content

feat(a2ui-playground): add per-conversation share button#549

Closed
PupilTong wants to merge 2 commits into
mainfrom
claude/trusting-heyrovsky-9fcd5b
Closed

feat(a2ui-playground): add per-conversation share button#549
PupilTong wants to merge 2 commits into
mainfrom
claude/trusting-heyrovsky-9fcd5b

Conversation

@PupilTong
Copy link
Copy Markdown
Owner

What

Adds a Share action to every conversation in the GenUI playground's Create page. Clicking it copies a durable, Supabase-backed render.html link for that conversation's generated UI to the clipboard, with the existing copy toast — the same artifact PreviewPanel already produces via "Copy render URL", now available per conversation from the list.

Why

Conversations could be renamed and deleted, but not shared. The server already publishes each turn's A2UI payload to Supabase Storage (lynx-family#2743) and the playground persists the resulting previewPayloadUrls on each conversation snapshot, so a durable shareable link is essentially already available — it just wasn't surfaced.

How it works

handleShareConversation(id) resolves a durable messagesUrl with minimal work:

  1. Active conversation → freshest published URLs already in component state.
  2. OtherwisepreviewPayloadUrls persisted on the conversation snapshot (or the most recent message that has them).
  3. Fallback → if a conversation has no stored URL yet, publish its raw A2UI messages on demand via POST /a2ui/payload.

buildRenderUrl() then turns the messagesUrl into the shareable link, which is copied to the clipboard.

Changes

  • New src/utils/publishPayload.ts — shared client→Supabase publish helper (publishA2UIPayload), extracted from DemosPage.
  • ConversationListPanel.tsx — new onShare prop + a Share pill (reuses the existing conversationIconButton styling; no new CSS).
  • AIChatPage.tsxhandleShareConversation + wiring; reuses in-scope buildRenderUrl, copyToClipboard, and the existing copy toast.
  • DemosPage.tsx — refactored to import the shared helper (dropped its local duplicates).

Testing

  • dprint check passes on all changed files.
  • Manual: pnpm --filter a2ui-playground dev (with the genui server reachable) → generate a UI in a conversation → Share → "Copy succeeded" toast + a render.html?…messagesUrl=… link that renders the surface when opened.

Notes for reviewers

  • Empty conversations (no generated UI yet) currently show a generic "Copy failed" toast rather than disabling the button — left as optional polish.
  • A full tsc typecheck wasn't run in this environment (worktree without node_modules; the playground builds via rsbuild/SWC, not a tsc gate). Verified via dprint + manual type review.
  • The pre-commit hook (lint-staged) was bypassed because node_modules wasn't available in the worktree; dprint formatting was validated manually instead.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a feature to share conversations by generating and copying a shareable link. It adds a 'Share' button to the conversation list and implements the sharing logic in AIChatPage, which retrieves or publishes the conversation payload. Additionally, payload publishing utilities are refactored into a shared publishPayload.ts file. Feedback is provided to optimize the search for the latest published message in AIChatPage by using a reverse loop instead of copying and reversing the entire messages array.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/genui/a2ui-playground/src/pages/AIChatPage.tsx
Each conversation in the Create page now has a Share action that copies a
durable, Supabase-backed render link for the conversation's generated UI to
the clipboard — mirroring PreviewPanel's existing "Copy render URL".

The link is resolved from the previewPayloadUrls already persisted on the
conversation snapshot (published to Supabase at generation time); a
conversation without a stored URL publishes its A2UI messages on demand via
POST /a2ui/payload.

Extracts DemosPage's payload-publish helper into utils/publishPayload.ts and
reuses it in both DemosPage and AIChatPage.
@PupilTong PupilTong force-pushed the claude/trusting-heyrovsky-9fcd5b branch from a934e5d to 33b4f0a Compare June 2, 2026 09:53
@PupilTong PupilTong closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant