Skip to content

Add group permalink feature with copy-to-clipboard support#5

Merged
connortsui20 merged 3 commits into
developfrom
claude/benchmark-group-links-5edmyx
Jul 8, 2026
Merged

Add group permalink feature with copy-to-clipboard support#5
connortsui20 merged 3 commits into
developfrom
claude/benchmark-group-links-5edmyx

Conversation

@connortsui20

Copy link
Copy Markdown
Member

Summary

Adds a shareable permalink feature for groups on the landing page. Users can click a copy-link button next to each group's chart count to copy a URL fragment (/#<slug>) to the clipboard. The fragment enables direct linking to specific groups, with automatic expansion and scrolling on page load.

Key Changes

  • New GroupPermalink component (web/components/GroupPermalink.tsx):

    • Icon button that copies group permalinks to clipboard
    • Displays a checkmark confirmation for 1.5 seconds after copying
    • Uses history.replaceState to mirror the fragment in the address bar (fallback for environments without Clipboard API)
    • Prevents the native <details> toggle when clicked via preventDefault
    • Exports groupPermalinkUrl() utility for URL construction with percent-encoding
  • Enhanced GroupNav component (web/components/GroupNav.tsx):

    • New jumpToLocationHash() function that expands and scrolls to groups referenced by URL fragments
    • Listens to hashchange events to support back/forward navigation and in-page anchor clicks
    • Decodes percent-encoded slugs symmetrically with the encoding in GroupPermalink
  • Updated GroupSection component (web/components/GroupSection.tsx):

    • Adds id={group.slug} to section element to create stable URL anchors
    • Integrates GroupPermalink button into the group summary header
  • Styling (web/app/globals.css):

    • New .group-permalink button styles with hover/focus states
    • Added .visually-hidden utility class for screen-reader-only status announcements
    • Accent color on copied state for visual feedback
  • Comprehensive test coverage:

    • GroupPermalink.test.tsx: URL generation, markup, and click behavior
    • GroupNav.test.tsx: Hash-jump functionality with encoding/decoding
    • GroupSection.test.tsx: Integration of permalink button

Implementation Details

  • Slugs are percent-encoded in URLs to safely handle user-influenced characters
  • The fragment works as a native anchor even without JavaScript (browser scroll)
  • JavaScript enhancement via jumpToLocationHash() opens the <details> disclosure that the browser cannot do automatically
  • Clipboard API failures gracefully degrade to the address bar fragment (already set via replaceState)
  • Timers are properly cleaned up on component unmount to prevent state updates after unmounting

https://claude.ai/code/session_01PhSqCumFaHEizXJYxRcohi

Each group's summary header gains a copy-link button (GroupPermalink)
that copies /#<slug> to the clipboard, mirrors the fragment into the
address bar, and flashes a checkmark as confirmation; preventDefault
keeps the click from toggling the disclosure. The section now carries
id={slug} so the fragment scrolls natively even without JavaScript,
and GroupNav's new hash-jump effect (jumpToLocationHash) expands the
target group's disclosure on load and on hashchange via the existing
jumpToGroup path, so the group's charts hydrate and scroll into view.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhSqCumFaHEizXJYxRcohi
Signed-off-by: Claude <noreply@anthropic.com>
@connortsui20 connortsui20 force-pushed the claude/benchmark-group-links-5edmyx branch from 48a2084 to 6b49451 Compare July 8, 2026 13:07
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Vercel preview for 7c91195b2a965d37ca92072ae93a1a9f7d25c1d5: https://benchmarks-website-htl5abggb-vortex-data.vercel.app

Group permalinks now use a human-readable anchor slugified from the
group's display name (TPC-H (NVMe) (SF=1) -> #tpc-h-nvme-sf-1) instead
of the opaque <prefix>.<base64-json> API slug, which only exists to be
machine-decoded by /api/group/[slug] and made for unreadable URLs. The
new lib/anchor.ts derives anchors and de-duplicates collisions with
numeric suffixes; page.tsx assigns them in render order; the section
id, GroupPermalink, and jumpToLocationHash all consume the anchor,
with a legacy fallback that still resolves old slug-carrying fragments
via the data-group-slug match. A guard keeps fragments naming other
element ids (e.g. #group-nav-panel) from being treated as groups.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhSqCumFaHEizXJYxRcohi
Signed-off-by: Claude <noreply@anthropic.com>
Clicking a group in the bottom-left jump menu already expanded and
scrolled to the section via jumpToGroup; now it also writes the
group's readable anchor into the address bar (replaceState, so no
hashchange fires and the hash-jump effect cannot double-scroll), so a
menu jump leaves the same shareable URL the header copy-link button
produces. The URL is only touched when the jump actually finds its
section. GroupNavItem gains the anchor field, threaded from the
page's existing groupAnchors pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhSqCumFaHEizXJYxRcohi
Signed-off-by: Claude <noreply@anthropic.com>
@connortsui20 connortsui20 merged commit 832b43a into develop Jul 8, 2026
6 checks passed
@connortsui20 connortsui20 deleted the claude/benchmark-group-links-5edmyx branch July 8, 2026 13:59
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.

2 participants