2026-01-11 22:04:08 +09:00
|
|
|
import { motion, AnimatePresence } from 'framer-motion';
|
2026-01-12 17:44:28 +09:00
|
|
|
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
|
2026-01-07 10:10:12 +09:00
|
|
|
import { useParams, useNavigate } from 'react-router-dom';
|
2026-01-12 17:44:28 +09:00
|
|
|
import { useQuery } from '@tanstack/react-query';
|
2026-01-11 23:15:56 +09:00
|
|
|
import { Play, Calendar, Music2, Clock, X, Download, ChevronDown, ChevronUp, FileText, ChevronRight } from 'lucide-react';
|
|
|
|
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
|
|
|
import { Virtual } from 'swiper/modules';
|
|
|
|
|
import 'swiper/css';
|
2026-01-11 22:04:08 +09:00
|
|
|
import { getAlbumByName } from '../../../api/public/albums';
|
|
|
|
|
import { formatDate } from '../../../utils/date';
|
2026-01-11 23:15:56 +09:00
|
|
|
import LightboxIndicator from '../../../components/common/LightboxIndicator';
|
2026-01-07 10:10:12 +09:00
|
|
|
|
|
|
|
|
function MobileAlbumDetail() {
|
|
|
|
|
const { name } = useParams();
|
|
|
|
|
const navigate = useNavigate();
|
2026-01-11 22:17:28 +09:00
|
|
|
const [lightbox, setLightbox] = useState({ open: false, images: [], index: 0, showNav: true });
|
|
|
|
|
const [showAllTracks, setShowAllTracks] = useState(false);
|
|
|
|
|
const [showDescriptionModal, setShowDescriptionModal] = useState(false);
|
2026-01-11 23:15:56 +09:00
|
|
|
const swiperRef = useRef(null);
|
2026-01-11 22:04:08 +09:00
|
|
|
|
2026-01-12 17:44:28 +09:00
|
|
|
// useQuery로 앨범 데이터 로드
|
|
|
|
|
const { data: album, isLoading: loading } = useQuery({
|
|
|
|
|
queryKey: ['album', name],
|
|
|
|
|
queryFn: () => getAlbumByName(name),
|
|
|
|
|
enabled: !!name,
|
|
|
|
|
});
|
|
|
|
|
|
2026-01-11 23:15:56 +09:00
|
|
|
// 라이트박스 열기 - 히스토리 추가
|
|
|
|
|
const openLightbox = useCallback((images, index, options = {}) => {
|
|
|
|
|
setLightbox({ open: true, images, index, showNav: options.showNav !== false, teasers: options.teasers });
|
|
|
|
|
window.history.pushState({ lightbox: true }, '');
|
|
|
|
|
}, []);
|
2026-01-11 22:04:08 +09:00
|
|
|
|
|
|
|
|
const closeLightbox = useCallback(() => {
|
|
|
|
|
setLightbox(prev => ({ ...prev, open: false }));
|
|
|
|
|
}, []);
|
|
|
|
|
|
2026-01-11 23:15:56 +09:00
|
|
|
// 앨범 소개 열기 - 히스토리 추가
|
|
|
|
|
const openDescriptionModal = useCallback(() => {
|
|
|
|
|
setShowDescriptionModal(true);
|
|
|
|
|
window.history.pushState({ description: true }, '');
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const closeDescriptionModal = useCallback(() => {
|
|
|
|
|
setShowDescriptionModal(false);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
// 뒤로가기 처리
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const handlePopState = () => {
|
|
|
|
|
if (showDescriptionModal) {
|
|
|
|
|
setShowDescriptionModal(false);
|
|
|
|
|
} else if (lightbox.open) {
|
|
|
|
|
setLightbox(prev => ({ ...prev, open: false }));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.addEventListener('popstate', handlePopState);
|
|
|
|
|
return () => window.removeEventListener('popstate', handlePopState);
|
|
|
|
|
}, [showDescriptionModal, lightbox.open]);
|
|
|
|
|
|
2026-01-11 22:04:08 +09:00
|
|
|
// 이미지 다운로드
|
|
|
|
|
const downloadImage = useCallback(async () => {
|
|
|
|
|
const imageUrl = lightbox.images[lightbox.index];
|
|
|
|
|
if (!imageUrl) return;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch(imageUrl);
|
|
|
|
|
const blob = await response.blob();
|
|
|
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
|
|
const link = document.createElement('a');
|
|
|
|
|
link.href = url;
|
|
|
|
|
link.download = `fromis9_photo_${String(lightbox.index + 1).padStart(2, '0')}.webp`;
|
|
|
|
|
document.body.appendChild(link);
|
|
|
|
|
link.click();
|
|
|
|
|
document.body.removeChild(link);
|
|
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('다운로드 오류:', error);
|
|
|
|
|
}
|
|
|
|
|
}, [lightbox.images, lightbox.index]);
|
|
|
|
|
|
|
|
|
|
// 라이트박스 body 스크롤 방지
|
|
|
|
|
useEffect(() => {
|
2026-01-11 22:17:28 +09:00
|
|
|
if (lightbox.open || showDescriptionModal) {
|
2026-01-11 22:04:08 +09:00
|
|
|
document.body.style.overflow = 'hidden';
|
|
|
|
|
} else {
|
|
|
|
|
document.body.style.overflow = '';
|
|
|
|
|
}
|
|
|
|
|
return () => { document.body.style.overflow = ''; };
|
2026-01-11 22:17:28 +09:00
|
|
|
}, [lightbox.open, showDescriptionModal]);
|
2026-01-07 10:10:12 +09:00
|
|
|
|
2026-01-11 22:04:08 +09:00
|
|
|
// 총 재생 시간 계산
|
|
|
|
|
const getTotalDuration = () => {
|
|
|
|
|
if (!album?.tracks) return '';
|
|
|
|
|
let totalSeconds = 0;
|
|
|
|
|
album.tracks.forEach(track => {
|
|
|
|
|
if (track.duration) {
|
|
|
|
|
const parts = track.duration.split(':');
|
|
|
|
|
totalSeconds += parseInt(parts[0]) * 60 + parseInt(parts[1]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const mins = Math.floor(totalSeconds / 60);
|
|
|
|
|
const secs = totalSeconds % 60;
|
|
|
|
|
return `${mins}:${String(secs).padStart(2, '0')}`;
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-07 10:10:12 +09:00
|
|
|
if (loading) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-center h-64">
|
|
|
|
|
<div className="w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin" />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!album) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="text-center py-12">
|
|
|
|
|
<p className="text-gray-500">앨범을 찾을 수 없습니다</p>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-11 22:04:08 +09:00
|
|
|
// 모든 컨셉 포토를 하나의 배열로
|
|
|
|
|
const allPhotos = album.conceptPhotos ? Object.values(album.conceptPhotos).flat() : [];
|
2026-01-11 22:17:28 +09:00
|
|
|
const displayTracks = showAllTracks ? album.tracks : album.tracks?.slice(0, 5);
|
2026-01-11 22:04:08 +09:00
|
|
|
|
2026-01-07 10:10:12 +09:00
|
|
|
return (
|
2026-01-11 22:04:08 +09:00
|
|
|
<>
|
2026-01-12 12:47:59 +09:00
|
|
|
<div>
|
2026-01-11 22:17:28 +09:00
|
|
|
{/* 앨범 히어로 섹션 - 커버 이미지 배경 */}
|
|
|
|
|
<div className="relative">
|
|
|
|
|
{/* 배경 블러 이미지 */}
|
|
|
|
|
<div className="absolute inset-0 overflow-hidden">
|
|
|
|
|
<img
|
|
|
|
|
src={album.cover_medium_url}
|
|
|
|
|
alt=""
|
|
|
|
|
className="w-full h-full object-cover blur-2xl scale-110 opacity-30"
|
|
|
|
|
/>
|
|
|
|
|
<div className="absolute inset-0 bg-gradient-to-b from-white/60 via-white/80 to-white" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 콘텐츠 */}
|
|
|
|
|
<div className="relative px-5 pt-4 pb-5">
|
|
|
|
|
<div className="flex flex-col items-center">
|
|
|
|
|
{/* 앨범 커버 */}
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 20 }}
|
|
|
|
|
animate={{ opacity: 1, y: 0 }}
|
|
|
|
|
className="w-44 h-44 rounded-2xl overflow-hidden shadow-xl mb-4"
|
2026-01-11 23:15:56 +09:00
|
|
|
onClick={() => openLightbox(
|
|
|
|
|
[album.cover_original_url || album.cover_medium_url],
|
|
|
|
|
0,
|
|
|
|
|
{ showNav: false }
|
|
|
|
|
)}
|
2026-01-11 22:17:28 +09:00
|
|
|
>
|
2026-01-11 22:04:08 +09:00
|
|
|
<img
|
|
|
|
|
src={album.cover_medium_url}
|
|
|
|
|
alt={album.title}
|
|
|
|
|
className="w-full h-full object-cover"
|
|
|
|
|
/>
|
2026-01-11 22:17:28 +09:00
|
|
|
</motion.div>
|
2026-01-11 22:04:08 +09:00
|
|
|
|
2026-01-11 22:17:28 +09:00
|
|
|
{/* 앨범 정보 */}
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 10 }}
|
|
|
|
|
animate={{ opacity: 1, y: 0 }}
|
|
|
|
|
transition={{ delay: 0.1 }}
|
|
|
|
|
className="text-center"
|
|
|
|
|
>
|
|
|
|
|
<span className="inline-block px-3 py-1 bg-primary/10 text-primary text-xs font-medium rounded-full mb-2">
|
|
|
|
|
{album.album_type}
|
|
|
|
|
</span>
|
|
|
|
|
<h1 className="text-2xl font-bold mb-2">{album.title}</h1>
|
|
|
|
|
|
|
|
|
|
{/* 메타 정보 */}
|
|
|
|
|
<div className="flex items-center justify-center gap-4 text-sm text-gray-500">
|
|
|
|
|
<div className="flex items-center gap-1">
|
|
|
|
|
<Calendar size={14} />
|
|
|
|
|
<span>{formatDate(album.release_date, 'YYYY.MM.DD')}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center gap-1">
|
|
|
|
|
<Music2 size={14} />
|
|
|
|
|
<span>{album.tracks?.length || 0}곡</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center gap-1">
|
|
|
|
|
<Clock size={14} />
|
|
|
|
|
<span>{getTotalDuration()}</span>
|
|
|
|
|
</div>
|
2026-01-11 22:04:08 +09:00
|
|
|
</div>
|
2026-01-11 22:17:28 +09:00
|
|
|
|
|
|
|
|
{/* 앨범 소개 버튼 */}
|
|
|
|
|
{album.description && (
|
|
|
|
|
<button
|
2026-01-11 23:15:56 +09:00
|
|
|
onClick={openDescriptionModal}
|
2026-01-11 22:17:28 +09:00
|
|
|
className="mt-3 flex items-center gap-1.5 mx-auto px-3 py-1.5 text-xs text-gray-500 bg-white/80 rounded-full shadow-sm"
|
|
|
|
|
>
|
|
|
|
|
<FileText size={12} />
|
|
|
|
|
앨범 소개
|
|
|
|
|
</button>
|
|
|
|
|
)}
|
|
|
|
|
</motion.div>
|
|
|
|
|
</div>
|
2026-01-07 10:10:12 +09:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-01-13 13:02:40 +09:00
|
|
|
{/* 티저 이미지 */}
|
2026-01-11 22:04:08 +09:00
|
|
|
{album.teasers && album.teasers.length > 0 && (
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0 }}
|
|
|
|
|
animate={{ opacity: 1 }}
|
2026-01-11 22:17:28 +09:00
|
|
|
className="px-4 py-4 border-b border-gray-100"
|
2026-01-11 22:04:08 +09:00
|
|
|
>
|
2026-01-13 13:02:40 +09:00
|
|
|
<p className="text-sm font-semibold mb-3">티저 이미지</p>
|
2026-01-11 22:17:28 +09:00
|
|
|
<div className="flex gap-3 overflow-x-auto pb-1 -mx-4 px-4 scrollbar-hide">
|
2026-01-11 22:04:08 +09:00
|
|
|
{album.teasers.map((teaser, index) => (
|
2026-01-13 11:59:12 +09:00
|
|
|
<div
|
2026-01-11 22:04:08 +09:00
|
|
|
key={index}
|
2026-01-11 23:15:56 +09:00
|
|
|
onClick={() => openLightbox(
|
2026-01-13 11:59:12 +09:00
|
|
|
album.teasers.map(t =>
|
|
|
|
|
t.media_type === 'video' ? (t.video_url || t.original_url) : t.original_url
|
|
|
|
|
),
|
2026-01-11 22:04:08 +09:00
|
|
|
index,
|
2026-01-11 23:15:56 +09:00
|
|
|
{ teasers: album.teasers, showNav: true }
|
|
|
|
|
)}
|
2026-01-11 22:17:28 +09:00
|
|
|
className="w-24 h-24 flex-shrink-0 bg-gray-100 rounded-2xl overflow-hidden relative shadow-sm"
|
2026-01-11 22:04:08 +09:00
|
|
|
>
|
2026-01-13 11:59:12 +09:00
|
|
|
<img
|
|
|
|
|
src={teaser.thumb_url || teaser.original_url}
|
|
|
|
|
alt={`Teaser ${index + 1}`}
|
|
|
|
|
className="w-full h-full object-cover"
|
|
|
|
|
/>
|
|
|
|
|
{teaser.media_type === 'video' && (
|
|
|
|
|
<div className="absolute inset-0 flex items-center justify-center bg-black/30">
|
|
|
|
|
<div className="w-8 h-8 bg-white/90 rounded-full flex items-center justify-center">
|
|
|
|
|
<Play size={14} fill="currentColor" className="ml-0.5 text-gray-800" />
|
2026-01-11 22:04:08 +09:00
|
|
|
</div>
|
2026-01-13 11:59:12 +09:00
|
|
|
</div>
|
2026-01-11 22:04:08 +09:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</motion.div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* 수록곡 */}
|
|
|
|
|
{album.tracks && album.tracks.length > 0 && (
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 20 }}
|
|
|
|
|
animate={{ opacity: 1, y: 0 }}
|
2026-01-11 22:17:28 +09:00
|
|
|
className="px-4 py-4 border-b border-gray-100"
|
2026-01-11 22:04:08 +09:00
|
|
|
>
|
2026-01-11 22:17:28 +09:00
|
|
|
<p className="text-sm font-semibold mb-3">수록곡</p>
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
{displayTracks?.map((track) => (
|
2026-01-11 22:04:08 +09:00
|
|
|
<div
|
|
|
|
|
key={track.id}
|
2026-01-12 18:48:00 +09:00
|
|
|
onClick={() => navigate(`/album/${encodeURIComponent(album.title)}/track/${encodeURIComponent(track.title)}`)}
|
|
|
|
|
className="flex items-center gap-3 py-2.5 px-3 rounded-xl hover:bg-gray-50 active:bg-gray-100 transition-colors cursor-pointer"
|
2026-01-11 22:04:08 +09:00
|
|
|
>
|
2026-01-11 22:17:28 +09:00
|
|
|
<span className="w-6 text-center text-sm text-gray-400 tabular-nums">
|
|
|
|
|
{String(track.track_number).padStart(2, '0')}
|
|
|
|
|
</span>
|
|
|
|
|
<div className="flex-1 min-w-0 flex items-center gap-2">
|
|
|
|
|
<p className={`text-sm font-medium truncate ${track.is_title_track ? 'text-primary' : 'text-gray-800'}`}>
|
|
|
|
|
{track.title}
|
|
|
|
|
</p>
|
|
|
|
|
{track.is_title_track === 1 && (
|
|
|
|
|
<span className="px-1.5 py-0.5 bg-primary text-white text-[10px] font-bold rounded flex-shrink-0">
|
|
|
|
|
TITLE
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
2026-01-11 22:04:08 +09:00
|
|
|
</div>
|
|
|
|
|
<span className="text-xs text-gray-400 tabular-nums">
|
|
|
|
|
{track.duration || '-'}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-01-11 22:17:28 +09:00
|
|
|
{/* 더보기/접기 버튼 */}
|
|
|
|
|
{album.tracks.length > 5 && (
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => setShowAllTracks(!showAllTracks)}
|
|
|
|
|
className="w-full mt-2 py-2 text-sm text-gray-500 flex items-center justify-center gap-1"
|
|
|
|
|
>
|
|
|
|
|
{showAllTracks ? '접기' : `${album.tracks.length - 5}곡 더보기`}
|
|
|
|
|
{showAllTracks ? <ChevronUp size={16} /> : <ChevronDown size={16} />}
|
|
|
|
|
</button>
|
|
|
|
|
)}
|
2026-01-11 22:04:08 +09:00
|
|
|
</motion.div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* 컨셉 포토 */}
|
|
|
|
|
{allPhotos.length > 0 && (
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 20 }}
|
|
|
|
|
animate={{ opacity: 1, y: 0 }}
|
|
|
|
|
transition={{ delay: 0.1 }}
|
2026-01-11 22:17:28 +09:00
|
|
|
className="px-4 py-4"
|
2026-01-11 22:04:08 +09:00
|
|
|
>
|
2026-01-11 22:17:28 +09:00
|
|
|
<p className="text-sm font-semibold mb-3">컨셉 포토</p>
|
2026-01-11 22:04:08 +09:00
|
|
|
<div className="grid grid-cols-3 gap-2">
|
|
|
|
|
{allPhotos.slice(0, 6).map((photo, idx) => (
|
|
|
|
|
<div
|
|
|
|
|
key={photo.id}
|
2026-01-11 23:15:56 +09:00
|
|
|
onClick={() => openLightbox(
|
|
|
|
|
[photo.original_url],
|
|
|
|
|
0,
|
|
|
|
|
{ showNav: false }
|
|
|
|
|
)}
|
2026-01-11 22:17:28 +09:00
|
|
|
className="aspect-square bg-gray-100 rounded-xl overflow-hidden shadow-sm"
|
2026-01-11 22:04:08 +09:00
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src={photo.thumb_url || photo.medium_url}
|
|
|
|
|
alt={`컨셉 포토 ${idx + 1}`}
|
|
|
|
|
loading="lazy"
|
|
|
|
|
className="w-full h-full object-cover"
|
|
|
|
|
/>
|
2026-01-07 10:10:12 +09:00
|
|
|
</div>
|
2026-01-11 22:04:08 +09:00
|
|
|
))}
|
|
|
|
|
</div>
|
2026-01-11 22:17:28 +09:00
|
|
|
{/* 전체보기 버튼 - 모바일 스타일 */}
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => navigate(`/album/${name}/gallery`)}
|
|
|
|
|
className="w-full mt-3 py-3 text-sm text-primary font-medium bg-primary/5 rounded-xl flex items-center justify-center gap-1"
|
|
|
|
|
>
|
|
|
|
|
전체 {allPhotos.length}장 보기
|
|
|
|
|
<ChevronRight size={16} />
|
|
|
|
|
</button>
|
2026-01-11 22:04:08 +09:00
|
|
|
</motion.div>
|
|
|
|
|
)}
|
2026-01-11 22:17:28 +09:00
|
|
|
</div>
|
2026-01-11 22:04:08 +09:00
|
|
|
|
2026-01-11 22:17:28 +09:00
|
|
|
{/* 앨범 소개 다이얼로그 */}
|
|
|
|
|
<AnimatePresence>
|
|
|
|
|
{showDescriptionModal && album?.description && (
|
|
|
|
|
<motion.div
|
2026-01-11 22:04:08 +09:00
|
|
|
initial={{ opacity: 0 }}
|
|
|
|
|
animate={{ opacity: 1 }}
|
2026-01-11 22:17:28 +09:00
|
|
|
exit={{ opacity: 0 }}
|
|
|
|
|
className="fixed inset-0 bg-black/60 z-[60] flex items-end justify-center"
|
2026-01-11 23:15:56 +09:00
|
|
|
onClick={() => window.history.back()}
|
2026-01-11 22:04:08 +09:00
|
|
|
>
|
2026-01-11 22:17:28 +09:00
|
|
|
<motion.div
|
|
|
|
|
initial={{ y: '100%' }}
|
|
|
|
|
animate={{ y: 0 }}
|
|
|
|
|
exit={{ y: '100%' }}
|
|
|
|
|
transition={{ type: 'spring', damping: 25, stiffness: 300 }}
|
|
|
|
|
drag="y"
|
|
|
|
|
dragConstraints={{ top: 0, bottom: 0 }}
|
|
|
|
|
dragElastic={{ top: 0, bottom: 0.5 }}
|
|
|
|
|
onDragEnd={(_, info) => {
|
2026-01-11 23:15:56 +09:00
|
|
|
if (info.offset.y > 100 || info.velocity.y > 300) {
|
|
|
|
|
window.history.back();
|
2026-01-11 22:17:28 +09:00
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
className="bg-white rounded-t-3xl w-full max-h-[80vh] overflow-hidden"
|
|
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
|
>
|
|
|
|
|
{/* 드래그 핸들 */}
|
|
|
|
|
<div className="flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing">
|
|
|
|
|
<div className="w-10 h-1 bg-gray-300 rounded-full" />
|
|
|
|
|
</div>
|
|
|
|
|
{/* 헤더 */}
|
|
|
|
|
<div className="flex items-center justify-between px-5 pb-3 border-b border-gray-100">
|
|
|
|
|
<h3 className="text-lg font-bold">앨범 소개</h3>
|
|
|
|
|
<button
|
2026-01-11 23:15:56 +09:00
|
|
|
onClick={() => window.history.back()}
|
2026-01-11 22:17:28 +09:00
|
|
|
className="p-1.5"
|
|
|
|
|
>
|
|
|
|
|
<X size={20} className="text-gray-500" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
{/* 내용 */}
|
|
|
|
|
<div className="px-5 py-4 overflow-y-auto max-h-[60vh]">
|
2026-01-12 14:51:15 +09:00
|
|
|
<p className="text-sm text-gray-600 leading-relaxed whitespace-pre-line text-justify">
|
2026-01-11 22:17:28 +09:00
|
|
|
{album.description}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</motion.div>
|
2026-01-11 22:04:08 +09:00
|
|
|
</motion.div>
|
|
|
|
|
)}
|
2026-01-11 22:17:28 +09:00
|
|
|
</AnimatePresence>
|
2026-01-11 22:04:08 +09:00
|
|
|
|
2026-01-11 23:15:56 +09:00
|
|
|
{/* 라이트박스 - Swiper ViewPager 스타일 */}
|
2026-01-11 22:04:08 +09:00
|
|
|
<AnimatePresence>
|
|
|
|
|
{lightbox.open && (
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0 }}
|
|
|
|
|
animate={{ opacity: 1 }}
|
|
|
|
|
exit={{ opacity: 0 }}
|
2026-01-11 23:15:56 +09:00
|
|
|
className="fixed inset-0 bg-black z-[60] flex flex-col"
|
2026-01-11 22:04:08 +09:00
|
|
|
>
|
2026-01-11 23:15:56 +09:00
|
|
|
{/* 상단 헤더 - 3등분 */}
|
|
|
|
|
<div className="absolute top-0 left-0 right-0 flex items-center px-4 py-3 z-20">
|
|
|
|
|
<div className="flex-1 flex justify-start">
|
|
|
|
|
<button onClick={() => window.history.back()} className="text-white/80 p-1">
|
|
|
|
|
<X size={24} />
|
|
|
|
|
</button>
|
2026-01-11 22:04:08 +09:00
|
|
|
</div>
|
2026-01-11 23:15:56 +09:00
|
|
|
{lightbox.showNav && lightbox.images.length > 1 && (
|
|
|
|
|
<span className="text-white/70 text-sm tabular-nums">
|
|
|
|
|
{lightbox.index + 1} / {lightbox.images.length}
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
<div className="flex-1 flex justify-end">
|
|
|
|
|
<button onClick={downloadImage} className="text-white/80 p-1">
|
|
|
|
|
<Download size={22} />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-01-11 22:04:08 +09:00
|
|
|
|
2026-01-11 23:15:56 +09:00
|
|
|
{/* Swiper */}
|
|
|
|
|
<Swiper
|
|
|
|
|
modules={[Virtual]}
|
|
|
|
|
virtual
|
|
|
|
|
initialSlide={lightbox.index}
|
|
|
|
|
onSwiper={(swiper) => { swiperRef.current = swiper; }}
|
|
|
|
|
onSlideChange={(swiper) => setLightbox(prev => ({ ...prev, index: swiper.activeIndex }))}
|
|
|
|
|
className="w-full h-full"
|
|
|
|
|
spaceBetween={0}
|
|
|
|
|
slidesPerView={1}
|
|
|
|
|
resistance={true}
|
|
|
|
|
resistanceRatio={0.5}
|
|
|
|
|
>
|
|
|
|
|
{lightbox.images.map((url, index) => (
|
|
|
|
|
<SwiperSlide key={index} virtualIndex={index}>
|
|
|
|
|
<div className="w-full h-full flex items-center justify-center">
|
|
|
|
|
{lightbox.teasers?.[index]?.media_type === 'video' ? (
|
|
|
|
|
<video
|
|
|
|
|
src={url}
|
|
|
|
|
className="max-w-full max-h-full object-contain"
|
|
|
|
|
controls
|
|
|
|
|
autoPlay={index === lightbox.index}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<img
|
|
|
|
|
src={url}
|
|
|
|
|
alt=""
|
|
|
|
|
className="max-w-full max-h-full object-contain"
|
|
|
|
|
loading={Math.abs(index - lightbox.index) <= 2 ? 'eager' : 'lazy'}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</SwiperSlide>
|
|
|
|
|
))}
|
|
|
|
|
</Swiper>
|
2026-01-11 22:04:08 +09:00
|
|
|
|
2026-01-11 23:15:56 +09:00
|
|
|
{/* 모바일용 인디케이터 */}
|
2026-01-11 22:17:28 +09:00
|
|
|
{lightbox.showNav && lightbox.images.length > 1 && (
|
2026-01-11 23:15:56 +09:00
|
|
|
<LightboxIndicator
|
|
|
|
|
count={lightbox.images.length}
|
|
|
|
|
currentIndex={lightbox.index}
|
|
|
|
|
goToIndex={(i) => swiperRef.current?.slideTo(i)}
|
|
|
|
|
width={120}
|
|
|
|
|
/>
|
2026-01-11 22:04:08 +09:00
|
|
|
)}
|
|
|
|
|
</motion.div>
|
|
|
|
|
)}
|
|
|
|
|
</AnimatePresence>
|
|
|
|
|
</>
|
2026-01-07 10:10:12 +09:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default MobileAlbumDetail;
|