From 1a51fa71f20ee05212c4a5019df78674b7a090bc Mon Sep 17 00:00:00 2001 From: waleed Date: Fri, 17 Apr 2026 17:12:03 -0700 Subject: [PATCH 1/5] fix(docs): preserve gif playback position in lightbox and clean up ui components - Capture currentTime on click and seek lightbox video to match using useLayoutEffect - Convert lightboxStartTime from useState to useRef (no independent render needed) - Apply same fix to ActionVideo in action-media.tsx - Remove dead AnimatedBlocks component (zero imports) - Fix language-dropdown to derive currentLang during render instead of mirroring into state via effect - Replace template literals with cn() in faq.tsx and video.tsx --- apps/docs/components/ui/action-media.tsx | 7 +- apps/docs/components/ui/animated-blocks.tsx | 195 ------------------ apps/docs/components/ui/faq.tsx | 17 +- apps/docs/components/ui/language-dropdown.tsx | 22 +- apps/docs/components/ui/lightbox.tsx | 13 +- apps/docs/components/ui/video.tsx | 14 +- 6 files changed, 40 insertions(+), 228 deletions(-) delete mode 100644 apps/docs/components/ui/animated-blocks.tsx diff --git a/apps/docs/components/ui/action-media.tsx b/apps/docs/components/ui/action-media.tsx index 629716b6640..77b885f1527 100644 --- a/apps/docs/components/ui/action-media.tsx +++ b/apps/docs/components/ui/action-media.tsx @@ -1,6 +1,6 @@ 'use client' -import { useState } from 'react' +import { useRef, useState } from 'react' import { cn, getAssetUrl } from '@/lib/utils' import { Lightbox } from './lightbox' @@ -50,11 +50,14 @@ export function ActionImage({ src, alt, enableLightbox = true }: ActionImageProp } export function ActionVideo({ src, alt, enableLightbox = true }: ActionVideoProps) { + const videoRef = useRef(null) + const startTimeRef = useRef(0) const [isLightboxOpen, setIsLightboxOpen] = useState(false) const resolvedSrc = getAssetUrl(src) const handleClick = () => { if (enableLightbox) { + startTimeRef.current = videoRef.current?.currentTime ?? 0 setIsLightboxOpen(true) } } @@ -62,6 +65,7 @@ export function ActionVideo({ src, alt, enableLightbox = true }: ActionVideoProp return ( <>