Skip to content

Feat/story deeplinks#43

Open
theshantanujoshi wants to merge 3 commits into
adhit-r:mainfrom
theshantanujoshi:feat/story-deeplinks
Open

Feat/story deeplinks#43
theshantanujoshi wants to merge 3 commits into
adhit-r:mainfrom
theshantanujoshi:feat/story-deeplinks

Conversation

@theshantanujoshi

Copy link
Copy Markdown

PR Description: Implement Story Deeplinks & Share-to-Clipboard

This PR implements deep-linking support for cinematic stories (Issue #29), enabling users to share specific moments and maintain story state across browser sessions.

Changes

1. URL State Synchronization

  • Bidirectional Sync: The application now reads story, beat, and paused parameters from the URL on mount.
  • State Reflection: As the story progresses, the address bar is updated via window.history.replaceState to allow for easy bookmarking and link sharing without page reloads.
  • Cleanup: Parameters are automatically removed from the URL when a story is ended.

2. Share Interface

  • One-Click Share: Integrated a new "Share" button (Network icon) into the StoryControls component.
  • Clipboard Integration: Copies the current state-synchronized URL to the clipboard.
  • Visual Feedback: Implemented a 2-second "Copied" transition (Check icon) with motion for polished user feedback.

3. Architecture

  • Store Extension: Updated the global store to support starting a story at a specific beat index.
  • Component Integrity: Centralized initialization logic in AppShell to ensure robust client-side state recovery.
  • Motion Standards: All transitions and feedback animations respect prefers-reduced-motion.

Verification Checklist

  • npm run typecheck passes.
  • Navigating to ?story=rise-of-vader&beat=2 starts the story at the 3rd beat.
  • "Share" button correctly copies the deep-link with the current beat index.
  • URL parameters are cleared upon clicking the "X" (End Story) button.
  • Invalid story IDs in the URL are gracefully ignored.

Related Issues

Closes #29

@safedep

safedep Bot commented May 15, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

Installation is not linked with SafeDep Tenant. Click here to optionally link your GitHub App installation with SafeDep Tenant.

This report is generated by SafeDep Github App

@adhit-r

adhit-r commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Holding this before merge. npm run typecheck passes, but git diff --check fails in components/cinematic/StoryMode.tsx and components/game/MemoryPalace.tsx.

There is also a deeplink parsing bug: parseInt(beatStr, 10) can produce NaN for URLs like ?story=rise-of-vader&beat=abc, and that value is passed into playStory. StoryMode then writes beat=NaN back to the URL and the timer keeps advancing NaN. Please validate/clamp the beat parameter before storing it.

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.

Story share-URL deeplinks (?story=rise-of-vader&beat=5)

2 participants