Skip to content

feat: copy screen ID to clipboard from Sidebar and ScreensPanel#44

Merged
trmquang93 merged 1 commit intomainfrom
feat/copy-screen-id
Apr 27, 2026
Merged

feat: copy screen ID to clipboard from Sidebar and ScreensPanel#44
trmquang93 merged 1 commit intomainfrom
feat/copy-screen-id

Conversation

@trmquang93
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a clickable monospace ID chip under the screen name in the Sidebar; one click copies the screen ID to the clipboard and flips the chip in place to Copied! for COPY_FEEDBACK_MS (2s).
  • Adds ⧉ Copy Screen ID as the first entry in the ScreensPanel row context menu, so users can copy a screen's ID without selecting it first.
  • Updates the user guide (#/docs) with a new ### Copying screen IDs for agent prompts subsection under the MCP area, including a > [!TIP] callout noting that connection/hotspot/document/data-model copy is deferred.

Closes the MVP scope of backlog item 5.2 — Copy Screen ID to Clipboard (backlog/items/5.2-copy-screen-id-to-clipboard.json). Connections, hotspots, documents, and data-models are explicitly deferred to a follow-up item.

Why

Screen IDs were not surfaced anywhere in the UI, so users working with the MCP server or AI agents had to open the raw .drawd JSON to reference a screen by ID. This breaks the visual-to-instruction pipeline that Drawd is built for. The chip-as-affordance pattern (mirroring GitHub commit-SHA chips) keeps the UI chrome-free while making IDs both visible and one-click copyable.

Implementation notes

  • No new dependencies, no new hook/util — navigator.clipboard.writeText is called directly, mirroring the existing ShareModal.jsx pattern.
  • Reuses COPY_FEEDBACK_MS from src/constants.js and COLORS / FONTS from src/styles/theme.js.
  • Both affordances render unconditionally in read-only mode because copying is non-mutating; other gated context-menu entries below remain gated.
  • Sidebar resets the idCopied flag via useEffect([screen.id]) so feedback never lingers across screen switches.

Test plan

  • Sidebar: select a screen → click the ID chip → verify the chip flips to Copied! and reverts after ~2s; paste in a text field to confirm clipboard content matches screen.id.
  • Sidebar: select screen A → click chip → switch to screen B during the Copied! window → verify B shows its own ID immediately (no leftover Copied!).
  • Sidebar in read-only collaborator mode: chip is visible and copying still works.
  • ScreensPanel: right-click a non-selected screen row → choose ⧉ Copy Screen ID → verify clipboard contains that screen's ID and the menu closes.
  • ScreensPanel in read-only mode: ⧉ Copy Screen ID entry is visible and works; other gated entries remain gated.
  • Keyboard: Tab to the chip → press Enter / Space → copies (real <button>, focusable).
  • Docs page (#/docs): the new ### Copying screen IDs for agent prompts subsection renders with the > [!TIP] callout.
  • npm run lint passes.
  • npm run build passes.
  • npm test — pre-existing mcp-server/ Satori failures are unchanged; all other suites pass.

Surfaces screen IDs in the UI so users can grab them for AI agent prompts
without opening the .drawd JSON. The selected-screen Sidebar shows a
monospace ID chip under the screen name; clicking it copies the ID and
flips in place to "Copied!" for COPY_FEEDBACK_MS. The ScreensPanel
right-click menu also gains a "Copy Screen ID" entry as its first item,
so users can copy without selecting first. Both affordances are
read-only-safe (copying is non-mutating).

Mirrors the existing ShareModal clipboard pattern. No new hook/util.
Connections, hotspots, documents, and data-models are deferred per
backlog 5.2 scope decision (MVP-only-screens).
@trmquang93 trmquang93 merged commit 5377f23 into main Apr 27, 2026
1 check passed
@trmquang93 trmquang93 deleted the feat/copy-screen-id branch April 27, 2026 16:15
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