Improve video card interaction by passing click events to parent components
Update the `VideoCard` component in `client/src/components/video-card.tsx` to pass video click events to a parent handler via an `onClick` prop, instead of directly navigating using `window.location.href`. This change decouples the card's navigation logic and allows for more flexible handling of clicks. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/PjBvWAg
This commit is contained in:
parent
914510612a
commit
8804f34b8c
@ -49,7 +49,7 @@ export default function VideoCard({ video, onClick }: VideoCardProps) {
|
|||||||
{/* Simple thumbnail with fallback - no HLS loading until needed */}
|
{/* Simple thumbnail with fallback - no HLS loading until needed */}
|
||||||
<div
|
<div
|
||||||
className="relative gradient-card rounded-xl overflow-hidden mb-4 aspect-video cursor-pointer group"
|
className="relative gradient-card rounded-xl overflow-hidden mb-4 aspect-video cursor-pointer group"
|
||||||
onClick={() => window.location.href = `/video/${video.id}`}
|
onClick={() => onClick?.(video)}
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={video.thumbnailUrl}
|
src={video.thumbnailUrl}
|
||||||
@ -92,7 +92,7 @@ export default function VideoCard({ video, onClick }: VideoCardProps) {
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<h3
|
<h3
|
||||||
className="font-semibold line-clamp-2 hover:text-bunny-blue transition-colors text-bunny-light cursor-pointer"
|
className="font-semibold line-clamp-2 hover:text-bunny-blue transition-colors text-bunny-light cursor-pointer"
|
||||||
onClick={() => window.location.href = `/video/${video.id}`}
|
onClick={() => onClick?.(video)}
|
||||||
data-testid={`text-title-${video.id}`}
|
data-testid={`text-title-${video.id}`}
|
||||||
>
|
>
|
||||||
{video.title}
|
{video.title}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user