"use client" import type React from "react" import { useState, useRef } from "react" import Image from "next/image" import { ArrowLeft, Heart, MessageCircle, Share, Play, Volume2, VolumeX } from "lucide-react" import Link from "next/link" interface VideoData { id: number venue: string title: string description: string likes: number comments: number shares: number videoUrl: string thumbnail: string isLiked: boolean } const mockVideos: VideoData[] = [ { id: 1, venue: "RONIN黄金篮球馆", title: "精彩三分球集锦", description: "今日比赛精彩瞬间,连续三分命中!#篮球 #精彩瞬间", likes: 1234, comments: 89, shares: 45, videoUrl: "/placeholder.svg?height=800&width=400&text=Basketball+Highlights", thumbnail: "/placeholder.svg?height=800&width=400&text=Basketball+Game+1", isLiked: false, }, { id: 2, venue: "Panda惊怒熊猫运动俱乐部", title: "激烈对抗瞬间", description: "双方激烈对抗,精彩防守反击!#运动 #篮球对抗", likes: 2156, comments: 156, shares: 78, videoUrl: "/placeholder.svg?height=800&width=400&text=Basketball+Defense", thumbnail: "/placeholder.svg?height=800&width=400&text=Basketball+Game+2", isLiked: true, }, { id: 3, venue: "星光篮球场", title: "完美扣篮时刻", description: "力量与技巧的完美结合,震撼扣篮!#扣篮 #力量", likes: 3421, comments: 234, shares: 123, videoUrl: "/placeholder.svg?height=800&width=400&text=Basketball+Dunk", thumbnail: "/placeholder.svg?height=800&width=400&text=Basketball+Game+3", isLiked: false, }, { id: 4, venue: "蓝天体育馆", title: "团队配合精彩", description: "完美的团队配合,流畅的传球配合!#团队 #配合", likes: 987, comments: 67, shares: 34, videoUrl: "/placeholder.svg?height=800&width=400&text=Team+Play", thumbnail: "/placeholder.svg?height=800&width=400&text=Basketball+Game+4", isLiked: false, }, ] export default function ImmersivePage() { const [currentIndex, setCurrentIndex] = useState(0) const [videos, setVideos] = useState(mockVideos) const [isPlaying, setIsPlaying] = useState(true) const [isMuted, setIsMuted] = useState(false) const containerRef = useRef(null) const startY = useRef(0) const currentY = useRef(0) const handleTouchStart = (e: React.TouchEvent) => { startY.current = e.touches[0].clientY } const handleTouchMove = (e: React.TouchEvent) => { currentY.current = e.touches[0].clientY } const handleTouchEnd = () => { const deltaY = startY.current - currentY.current const threshold = 50 if (Math.abs(deltaY) > threshold) { if (deltaY > 0 && currentIndex < videos.length - 1) { // 向上滑动,下一个视频 setCurrentIndex(currentIndex + 1) } else if (deltaY < 0 && currentIndex > 0) { // 向下滑动,上一个视频 setCurrentIndex(currentIndex - 1) } } } const handleLike = (videoId: number) => { setVideos( videos.map((video) => { if (video.id === videoId) { return { ...video, isLiked: !video.isLiked, likes: video.isLiked ? video.likes - 1 : video.likes + 1, } } return video }), ) } const formatNumber = (num: number) => { if (num >= 1000) { return (num / 1000).toFixed(1) + "k" } return num.toString() } const currentVideo = videos[currentIndex] return (
{/* Header - Minimized */}
沉浸模式
{/* Video Container */}
{videos.map((video, index) => (
{/* Video Background */}
{video.title} {/* Video Overlay */}
{/* Play/Pause Button - Minimized */}
setIsPlaying(!isPlaying)} > {!isPlaying && (
)}
{/* Right Side Actions - Minimized */}
{/* Like Button */}
{formatNumber(video.likes)}
{/* Comment Button */}
{formatNumber(video.comments)}
{/* Share Button */}
{formatNumber(video.shares)}
{/* Volume Button */}
{/* Bottom Info - Minimized */}

{video.venue}

{video.description}

{/* Progress Indicator - Minimized */}
{videos.map((_, idx) => (
))}
))}
{/* Swipe Hint - Minimized */} {currentIndex === 0 && (
上滑查看更多
)}
) }