-
-
블랙 호라이즌
-
- 전설적인 우주 탐험가가 미지의 행성에서 인류의 운명을 건 마지막 미션을 수행한다. 시간이 얼마 남지 않았다.
-
-
-
-
-
-
-
-
-
+ useEffect(() => {
+ loadVideos();
+ }, []);
+
+ useEffect(() => {
+ // 페이지 로드 후 2초 뒤에 비디오 플레이어 표시 (이미지 -> 비디오 전환)
+ const timer = setTimeout(() => {
+ setShowVideoPlayer(true);
+ }, 2000);
+
+ return () => clearTimeout(timer);
+ }, [featuredVideo]);
+
+ const loadVideos = async () => {
+ try {
+ setLoading(true);
+ console.log("🔍 Fetching videos from API...");
+
+ const response = await videoApi.getPublishedVideos(0, 20);
+ console.log("✅ API Response:", response);
+ console.log("📊 Total videos:", response.content.length);
+
+ setVideos(response.content);
+
+ // 첫 번째 완료된 영상을 Featured로 설정
+ const completed = response.content.find(v =>
+ v.status && v.status.toUpperCase() === "COMPLETED"
+ );
+
+ if (completed) {
+ console.log("🎬 Featured video:", completed.title);
+ setFeaturedVideo(completed);
+ } else if (response.content.length > 0) {
+ console.log("Using first video as featured:", response.content[0].title);
+ setFeaturedVideo(response.content[0]);
+ }
+ } catch (error) {
+ console.error("❌ Failed to load videos:", error);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const formatDuration = (seconds: number | null) => {
+ if (!seconds) return "0:00";
+ const hours = Math.floor(seconds / 3600);
+ const minutes = Math.floor((seconds % 3600) / 60);
+ const secs = seconds % 60;
+
+ if (hours > 0) {
+ return `${hours}:${minutes.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
+ }
+ return `${minutes}:${secs.toString().padStart(2, "0")}`;
+ };
+
+ const getCategoryVideos = (category: string) => {
+ return videos.filter(v => {
+ const isCompleted = v.status && v.status.toUpperCase() === "COMPLETED";
+ const matchesCategory = v.category === category;
+ return isCompleted && matchesCategory;
+ }).slice(0, 6);
+ };
+
+ const categories = [
+ { name: "전체", slug: "all", videos: videos.slice(0, 12) },
+ { name: "시리즈", slug: "series", videos: getCategoryVideos("시리즈") },
+ { name: "영화", slug: "movies", videos: getCategoryVideos("영화") },
+ { name: "컴투 대기", slug: "comedy", videos: getCategoryVideos("컴투 대기") },
+ { name: "SF", slug: "sf", videos: getCategoryVideos("SF") },
+ ];
+
+ if (loading) {
+ return (
+
-
+ );
+ }
- {/* Content Rows */}
-
-
-
-
-
+ return (
+
+
+
+ {/* Hero Section - Featured Video */}
+ {featuredVideo && (
+
+
+ {/* 수정된 부분: (featuredVideo.s3Url || featuredVideo.cloudfrontUrl) 뒤에 || "" 를 추가하여 null 방지 */}
+ {showVideoPlayer && (featuredVideo.s3Url || featuredVideo.cloudfrontUrl) ? (
+
+ ) : (
+ <>
+ {featuredVideo.thumbnailUrl ? (
+

+ ) : (
+
+ )}
+
+
+
+ >
+ )}
+
+
+
+
+
+
+ {featuredVideo.title}
+
+
+ {featuredVideo.description && (
+
+ {featuredVideo.description}
+
+ )}
+
+
+ {featuredVideo.durationSeconds && (
+
+
+ {formatDuration(featuredVideo.durationSeconds)}
+
+ )}
+
+
+ {featuredVideo.viewCount.toLocaleString()}회
+
+ {featuredVideo.ageRating && (
+
+ {featuredVideo.ageRating}
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )}
+
+ {/* Content Rows */}
+
+ {categories.map((category, index) => {
+ if (category.videos.length === 0) return null;
+
+ return (
+
+
+
+
{category.name}
+
+ 모두 보기 →
+
+
+
+
+ {category.videos.map(video => (
+
+
+
+ {video.thumbnailUrl ? (
+

+ ) : (
+
+ )}
+
+ {video.durationSeconds && (
+
+ {formatDuration(video.durationSeconds)}
+
+ )}
+
+
+
+
+
+ {video.title}
+
+
+
+ {video.uploaderName}
+
+
+
+ ))}
+
+
+
+ );
+ })}
+
+ {videos.length === 0 && (
+
+
아직 업로드된 영상이 없습니다
+
+
+
+
+ )}
+
-
- )
-}
+ );
+}
\ No newline at end of file
diff --git a/app/category/[slug]/page.tsx b/app/category/[slug]/page.tsx
index fbc6b11..747417a 100644
--- a/app/category/[slug]/page.tsx
+++ b/app/category/[slug]/page.tsx
@@ -1,185 +1,173 @@
-import { Badge } from "@/components/ui/badge"
-import { BrowseHeader } from "@/components/browse-header"
-import Link from "next/link"
-
-const CATEGORY_DATA: Record<
- string,
- {
- title: string
- description: string
- items: Array<{
- id: number
- title: string
- thumbnail: string
- type: "movie" | "series"
- year: number
- rating: number
- }>
- }
-> = {
- movie: {
- title: "영화",
- description: "엄선된 최고의 영화 컬렉션",
- items: [
- { id: 1, title: "다크 사이드", thumbnail: "/content-thriller-dark.jpg", type: "movie", year: 2026, rating: 4.5 },
- { id: 3, title: "레드 존", thumbnail: "/content-action-red.jpg", type: "movie", year: 2026, rating: 4.3 },
- {
- id: 5,
- title: "스카이 체이서",
- thumbnail: "/content-adventure-sky.jpg",
- type: "movie",
- year: 2026,
- rating: 4.4,
- },
- {
- id: 7,
- title: "블랙 호라이즌",
- thumbnail: "/watch-hero-background.jpg",
- type: "movie",
- year: 2026,
- rating: 4.8,
- },
- {
- id: 21,
- title: "선셋 드라이브",
- thumbnail: "/content-sunset-drive.jpg",
- type: "movie",
- year: 2026,
- rating: 4.6,
- },
- {
- id: 22,
- title: "크리스털 키",
- thumbnail: "/content-crystal-key.jpg",
- type: "movie",
- year: 2026,
- rating: 4.5,
- },
- ],
- },
- series: {
- title: "시리즈",
- description: "몰입도 높은 시리즈 콘텐츠",
- items: [
- { id: 2, title: "네온 나이트", thumbnail: "/content-scifi-neon.jpg", type: "series", year: 2025, rating: 4.8 },
- {
- id: 4,
- title: "미스터리 하우스",
- thumbnail: "/content-mystery-house.jpg",
- type: "series",
- year: 2025,
- rating: 4.6,
- },
- { id: 6, title: "오션 디프", thumbnail: "/content-ocean-deep.jpg", type: "series", year: 2025, rating: 4.7 },
- { id: 8, title: "타임 루프", thumbnail: "/content-drama-time.jpg", type: "series", year: 2025, rating: 4.5 },
- {
- id: 11,
- title: "퓨처 시티",
- thumbnail: "/content-future-city.jpg",
- type: "series",
- year: 2025,
- rating: 4.7,
- },
- {
- id: 12,
- title: "섀도우 게임",
- thumbnail: "/content-shadow-game.jpg",
- type: "series",
- year: 2025,
- rating: 4.6,
- },
- ],
- },
- korean: {
- title: "한국 콘텐츠",
- description: "국내 최고의 작품들",
- items: [
- {
- id: 31,
- title: "서울 어드벤처",
- thumbnail: "/content-seoul-adventure.jpg",
- type: "series",
- year: 2026,
- rating: 4.7,
- },
- {
- id: 32,
- title: "한강의 기적",
- thumbnail: "/content-hangang-miracle.jpg",
- type: "movie",
- year: 2026,
- rating: 4.8,
- },
- { id: 33, title: "K-히어로", thumbnail: "/content-k-hero.jpg", type: "series", year: 2026, rating: 4.6 },
- {
- id: 34,
- title: "타임 트래블러",
- thumbnail: "/content-time-traveller.jpg",
- type: "movie",
- year: 2026,
- rating: 4.5,
- },
- {
- id: 35,
- title: "사이버 서울",
- thumbnail: "/content-cyber-seoul.jpg",
- type: "series",
- year: 2026,
- rating: 4.9,
- },
- {
- id: 36,
- title: "레트로 시티",
- thumbnail: "/content-retro-city.jpg",
- type: "movie",
- year: 2026,
- rating: 4.4,
- },
- ],
- },
-}
+"use client";
+
+import { use, useEffect, useState } from "react";
+import Link from "next/link";
+import { BrowseHeader } from "@/components/browse-header";
+import { videoApi, type Video } from "@/lib/api";
+import { getCategoryBySlug } from "@/lib/categories";
+import { Play, Clock, Eye, ArrowLeft } from "lucide-react";
+import { useRouter } from "next/navigation";
+
+export default function CategoryPage({
+ params,
+}: {
+ params: Promise<{ slug: string }>;
+}) {
+ const resolvedParams = use(params);
+ const categorySlug = resolvedParams.slug; // 영어 slug (series, movies, all 등)
+ const router = useRouter();
+
+ const [videos, setVideos] = useState