Feat: added timestamp for Youtube URL while creating link#3443
Feat: added timestamp for Youtube URL while creating link#3443bikalsiwakoti wants to merge 1 commit intodubinc:mainfrom
Conversation
|
@bikalsiwakoti is attempting to deploy a commit to the Dub Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThis pull request introduces YouTube timestamp functionality to Dub's link builder. When a destination URL is detected as a YouTube video, a new VideoTimestampInput component appears, allowing users to set video timestamps via minutes and seconds inputs. Supporting utility functions handle YouTube URL detection and timestamp query parameter management. Changes
Sequence DiagramsequenceDiagram
actor User
participant VideoTimestampInput
participant react-hook-form
participant YouTube Utilities
User->>VideoTimestampInput: Enters minutes/seconds
activate VideoTimestampInput
VideoTimestampInput->>YouTube Utilities: Call setYouTubeTimestampInUrl()
activate YouTube Utilities
YouTube Utilities->>YouTube Utilities: Parse and validate timestamp
YouTube Utilities->>YouTube Utilities: Append/update ?t= parameter
YouTube Utilities-->>VideoTimestampInput: Return updated URL
deactivate YouTube Utilities
VideoTimestampInput->>react-hook-form: Update form field value
activate react-hook-form
react-hook-form-->>VideoTimestampInput: Form state updated
deactivate react-hook-form
VideoTimestampInput-->>User: Display updated timestamp preview
deactivate VideoTimestampInput
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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. Comment |
Fixes: #496
Summary
When the destination URL is a YouTube video, the link builder now shows a Video timestamp control so users can set a start time (minutes/seconds) without editing the URL. The time is stored as ?t= on the destination URL and passed through by the short link.
Changes
packages/utils – URL helpers: isYouTubeUrl(), getYouTubeTimestampFromUrl(), setYouTubeTimestampInUrl() (detect YouTube URLs, read/write t in seconds; support 90, 1m30s, etc.).
VideoTimestampInput – New control shown only for YouTube destination URLs: minutes/seconds inputs, Clear button, helper text with ?t=..., tooltip. Kept in sync with the destination URL.
Placement – Rendered between Destination URL and Short link in the create/edit link modal and on the link detail page.
Testing
After changes : Loom video
Summary by CodeRabbit
Release Notes