Skip to content

feat(web): share button in local app header#160

Merged
naorsabag merged 2 commits into
masterfrom
worktree-add-share-button-local-app
May 17, 2026
Merged

feat(web): share button in local app header#160
naorsabag merged 2 commits into
masterfrom
worktree-add-share-button-local-app

Conversation

@naorsabag
Copy link
Copy Markdown
Owner

@naorsabag naorsabag commented May 17, 2026

Summary

  • Adds a header Share button to the local app (packages/web/src/App.tsx) that copies a self-contained URL of the currently-loaded flow to the clipboard. The URL targets the public Pages playground (https://naorsabag.github.io/openhop/#<encoded>), so recipients can view the flow without installing OpenHop or running a server.
  • New buildPagesShareUrl helper in packages/web/src/lib/share-url.ts centralises the Pages destination behind a single call. Reuses the existing v1 fragment encoder, so old share URLs and the playground's decoder are unaffected.
  • Inline SVG share icon (three connected nodes) + cyan toast confirmation, matching the playground's New/Edit button style. Sub-flow drilldown state is intentionally omitted from the payload — sharing is per-top-level-flow, like AppFragment's Save.

Why

Until now the local app had no first-class way to send a flow to anyone else — only the Pages playground encoded YAML into the URL hash on Save. Anyone editing a flow locally had to manually paste YAML over chat. This closes that gap with one button, and routes through Pages because that's the only host that can decode share fragments without a local server.

Test plan

  • npm --workspace packages/web run typecheck — clean
  • npm --workspace packages/web test — 48/48 pass, including a new buildPagesShareUrl round-trip test
  • npm --workspace packages/web run lint — 0 errors (pre-existing warnings only)
  • npm --workspace packages/web run build — bundles cleanly
  • npm --workspace packages/cli run build — CLI bundles cleanly
  • Manual: opened the local dev server, selected a flow, clicked Share, pasted the resulting URL into a fresh browser tab → playground renders the same flow
  • Maintainer: visual check of the icon's vertical alignment in the header

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a "Share" header button that generates a shareable URL for the currently loaded flow, enabling others to view it on the public playground without installation
    • Automatically copies the share URL to clipboard with confirmation toast notification; falls back to manual copy if needed
  • Documentation

    • Updated documentation describing the new Share button and URL generation functionality

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

Warning

Rate limit exceeded

@naorsabag has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 10 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 437ec9cd-c5bb-416f-b44d-86d50ac554bd

📥 Commits

Reviewing files that changed from the base of the PR and between b2b4aae and dcf2cfa.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • README.md
  • packages/web/__tests__/share-url.test.ts
  • packages/web/src/App.tsx
  • packages/web/src/lib/share-url.ts

Walkthrough

This PR adds a Share button to the web app header that generates a self-contained URL pointing to the OpenHop Pages playground with the current flow encoded in the fragment, enabling users to share flows without requiring installation. The feature includes a new Pages-specific share URL builder, clipboard copy interaction with fallback prompt, and visual toast feedback.

Changes

Share URL to Pages Playground

Layer / File(s) Summary
Pages share URL builder and tests
packages/web/src/lib/share-url.ts, packages/web/__tests__/share-url.test.ts
Introduces PAGES_SHARE_ORIGIN and PAGES_SHARE_BASE constants plus buildPagesShareUrl(yamlText) helper that constructs the Pages playground URL, with test coverage verifying the generated hash decodes to the original YAML.
Share button UI and clipboard interaction
packages/web/src/App.tsx
Adds Share button in header with ShareIcon SVG component, toast state with auto-clear timer to prevent stacked notifications, and handleShareFlow callback that generates the Pages URL, copies to clipboard (with fallback to prompt), and displays success toast.
Feature documentation
CHANGELOG.md, README.md
Documents the new Share button in the Unreleased changelog and README, explaining that it copies a Pages playground URL for the current flow to clipboard.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • naorsabag/openhop#77: Both PRs touch packages/web/src/lib/share-url.ts and tests for share URL handling; this PR builds on top of the fragment encoding/decoding helpers from that PR.
  • naorsabag/openhop#144: Both PRs modify packages/web/src/lib/share-url.ts and share-url test infrastructure; this PR's buildPagesShareUrl depends on the deflate+base64url fragment format changes introduced in that PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(web): share button in local app header' clearly and concisely summarizes the main change: adding a Share button feature to the web app's header.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-add-share-button-local-app

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/web/src/App.tsx (1)

1-657: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Run Prettier on this file to unblock CI.

prettier --check is failing for this file in the pipeline; please format and recommit so required checks pass.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/web/src/App.tsx` around lines 1 - 657, Prettier formatting failed
for packages/web/src/App.tsx; run the project's formatter and re-commit the
changes to satisfy CI. Open App.tsx (containing the React component App, helper
functions like ShareIcon, and exports) and run the configured Prettier command
(e.g. prettier --write packages/web/src/App.tsx or yarn/npm script that
formats), then stage and commit the formatted file so the pipeline's prettier
--check passes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/web/src/App.tsx`:
- Around line 1-657: Prettier formatting failed for packages/web/src/App.tsx;
run the project's formatter and re-commit the changes to satisfy CI. Open
App.tsx (containing the React component App, helper functions like ShareIcon,
and exports) and run the configured Prettier command (e.g. prettier --write
packages/web/src/App.tsx or yarn/npm script that formats), then stage and commit
the formatted file so the pipeline's prettier --check passes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: aea93a20-7e0f-4a95-85b8-ffca458a02cc

📥 Commits

Reviewing files that changed from the base of the PR and between 05ce55d and b2b4aae.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • README.md
  • packages/web/__tests__/share-url.test.ts
  • packages/web/src/App.tsx
  • packages/web/src/lib/share-url.ts

naorsabag and others added 2 commits May 17, 2026 07:07
The local app had no first-class way to send someone the flow you're
looking at — only the Pages playground did, by encoding the YAML into
the URL hash on Save. That mismatch meant every "look at this" turned
into a YAML paste-and-instruction.

This wires the same affordance into the local app:

- Header gets a "Share" button (only when a flow is loaded). Clicks
  YAML-stringify the in-memory flow, encode it via the existing v1
  fragment format, build a URL pointing at the public Pages playground
  (https://naorsabag.github.io/openhop/#<encoded>), and copy that URL
  to the clipboard with a cyan toast confirmation. Falls back to
  window.prompt if clipboard access is blocked.
- New buildPagesShareUrl helper in lib/share-url.ts hardcodes the
  Pages destination as a module-level constant, so the local-app
  share target stays in one place if the playground ever moves. The
  generic buildShareUrl is unchanged — AppFragment.tsx still uses
  Vite's BASE_URL like before.

The Pages site is the only host that can decode share fragments without
a local server, so sharing always targets it (regardless of where the
sharer is running OpenHop). Sub-flow drilldown state is recipient-side
navigation and intentionally omitted from the payload — share is
per-top-level-flow, matching AppFragment's Save behaviour.

Inline SVG share icon (Android-style three connected nodes) sits in
the button instead of a glyph, with display:block + edge-to-edge
content so it lines up with the pixel font without padding asymmetry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nto one line

CI's npm run format:check rejected the multi-line svg props in
packages/web/src/App.tsx. Run prettier --write to match repo style; no
behaviour change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@naorsabag naorsabag force-pushed the worktree-add-share-button-local-app branch from b2b4aae to dcf2cfa Compare May 17, 2026 07:08
@naorsabag naorsabag merged commit 4742214 into master May 17, 2026
8 checks passed
naorsabag added a commit that referenced this pull request May 17, 2026
…3.3 (#161)

Patch release covering everything merged since 0.3.2 (#157, #158, #160).

Versions:
- @openhop/server  0.3.2 -> 0.3.3
- @openhop/web     0.3.2 -> 0.3.3
- openhop (CLI)    0.3.2 -> 0.3.3

What's in this release:

- @openhop/web picks up two unrelated user-facing additions: the new
  "Share" button in the local-app header (#160) which copies a
  Pages-playground share URL of the current flow to the clipboard, and
  the SEO/AI-search wiring for the Pages deploy (#157) — robots.txt,
  sitemap.xml, social-preview.png, Open Graph / Twitter Card meta,
  schema.org JSON-LD, and crawler-visible static landing content in
  index.html.
- The CLI bump keeps the @openhop/server / @openhop/web deps in
  lockstep. No CLI-bundled change (skills/ payload unchanged).
- @openhop/server has no behavioural delta this release; the bump is
  lockstep-only so the version-diff publisher tags all three together.
- Repository also ships a single-plugin Claude Code marketplace
  (.claude-plugin/ + commands/, #158) — install via
  `/plugin marketplace add naorsabag/openhop` then
  `/plugin install openhop@openhop`. Plugin files are repo-only and do
  NOT ship in any npm tarball (`files` lists are unchanged), so this
  bump does not need to cover them — but the README install
  instructions that landed alongside #158 are user-facing and worth
  publishing under the new tag.

No breaking changes -- additive only.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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