refactor: 콘서트 상세 페이지 UI 개선

- 히어로 섹션 배경을 포스터 확대 + 블러 효과로 변경
- 회차 선택을 드롭다운 형태로 변경 및 디자인 개선
- 드롭다운 열릴 때 선택된 항목 자동 스크롤
- 장소 카드 디자인 정리 (MapPin 아이콘 사용)
- 지도 높이 2배로 증가 (h-64 → h-[32rem])
- 길찾기 버튼 색상 분기 (카카오맵: #0079f4, 구글맵: #4285F4)
- 글래스모피즘 효과 제거
This commit is contained in:
caadiq 2026-01-16 02:15:32 +09:00
parent b023e08750
commit 28e48614ce

View file

@ -1,8 +1,8 @@
import { useParams, Link } from 'react-router-dom'; import { useParams, Link } from 'react-router-dom';
import { useQuery, keepPreviousData } from '@tanstack/react-query'; import { useQuery, keepPreviousData } from '@tanstack/react-query';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { motion } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
import { Clock, Calendar, ExternalLink, ChevronRight, Link2, MapPin, Navigation } from 'lucide-react'; import { Clock, Calendar, ExternalLink, ChevronRight, ChevronDown, ChevronLeft, Check, Link2, MapPin, Navigation } from 'lucide-react';
import { getSchedule, getXProfile } from '../../../api/public/schedules'; import { getSchedule, getXProfile } from '../../../api/public/schedules';
// SDK // SDK
@ -398,12 +398,12 @@ function KakaoMap({ lat, lng, name }) {
href={`https://map.kakao.com/link/to/${encodeURIComponent(name)},${lat},${lng}`} href={`https://map.kakao.com/link/to/${encodeURIComponent(name)},${lat},${lng}`}
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className="block w-full h-80 rounded-2xl bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center hover:from-gray-200 hover:to-gray-300 transition-all group" className="group flex h-full w-full items-center justify-center bg-white/80 text-center backdrop-blur transition-all hover:bg-white"
> >
<div className="text-center"> <div>
<Navigation size={32} className="mx-auto text-gray-400 group-hover:text-blue-500 transition-colors mb-2" /> <Navigation size={32} className="mx-auto text-gray-400 group-hover:text-primary transition-colors mb-3" />
<p className="text-gray-600 font-medium">{name}</p> <p className="text-gray-700 font-semibold">{name}</p>
<p className="text-sm text-gray-400 mt-1">클릭하여 길찾</p> <p className="text-sm text-gray-400 mt-1">길찾기 </p>
</div> </div>
</a> </a>
); );
@ -412,27 +412,117 @@ function KakaoMap({ lat, lng, name }) {
return ( return (
<div <div
ref={mapRef} ref={mapRef}
className="w-full h-80 rounded-2xl overflow-hidden shadow-inner" className="h-full w-full"
/> />
); );
} }
// //
function ConcertSection({ schedule }) { function ConcertSection({ schedule }) {
const hasLocation = schedule.location_lat && schedule.location_lng; // ID ( state - URL )
const hasPoster = schedule.images?.length > 0; const [selectedDateId, setSelectedDateId] = useState(schedule.id);
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const dropdownRef = useRef(null);
const dropdownListRef = useRef(null);
// state ( )
const [displayData, setDisplayData] = useState({
posterUrl: schedule.images?.[0] || null,
title: schedule.title,
date: schedule.date,
time: schedule.time,
locationName: schedule.location_name,
locationAddress: schedule.location_address,
locationLat: schedule.location_lat,
locationLng: schedule.location_lng,
description: schedule.description,
sourceUrl: schedule.source_url,
});
//
const { data: selectedSchedule } = useQuery({
queryKey: ['schedule', selectedDateId],
queryFn: () => getSchedule(selectedDateId),
placeholderData: keepPreviousData,
enabled: selectedDateId !== schedule.id,
});
//
useEffect(() => {
const newData = selectedDateId === schedule.id ? schedule : selectedSchedule;
if (!newData) return;
setDisplayData(prev => {
const updates = {};
const newPosterUrl = newData.images?.[0] || null;
if (prev.posterUrl !== newPosterUrl) updates.posterUrl = newPosterUrl;
if (prev.title !== newData.title) updates.title = newData.title;
if (prev.date !== newData.date) updates.date = newData.date;
if (prev.time !== newData.time) updates.time = newData.time;
if (prev.locationName !== newData.location_name) updates.locationName = newData.location_name;
if (prev.locationAddress !== newData.location_address) updates.locationAddress = newData.location_address;
if (prev.locationLat !== newData.location_lat) updates.locationLat = newData.location_lat;
if (prev.locationLng !== newData.location_lng) updates.locationLng = newData.location_lng;
if (prev.description !== newData.description) updates.description = newData.description;
if (prev.sourceUrl !== newData.source_url) updates.sourceUrl = newData.source_url;
if (Object.keys(updates).length > 0) {
return { ...prev, ...updates };
}
return prev;
});
}, [selectedDateId, schedule, selectedSchedule]);
//
useEffect(() => {
const handleClickOutside = (event) => {
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
setIsDropdownOpen(false);
}
};
document.addEventListener('mousedown', handleClickOutside);
return () => document.removeEventListener('mousedown', handleClickOutside);
}, []);
//
useEffect(() => {
if (isDropdownOpen && dropdownListRef.current) {
const selectedElement = dropdownListRef.current.querySelector('[data-selected="true"]');
if (selectedElement) {
// ( )
setTimeout(() => {
selectedElement.scrollIntoView({ block: 'center', behavior: 'smooth' });
}, 50);
}
}
}, [isDropdownOpen]);
const relatedDates = schedule.related_dates || []; const relatedDates = schedule.related_dates || [];
const hasMultipleDates = relatedDates.length > 1; const hasMultipleDates = relatedDates.length > 1;
const hasLocation = displayData.locationLat && displayData.locationLng;
const hasPoster = !!displayData.posterUrl;
const hasDescription = !!displayData.description;
// //
const formatSingleDate = (dateStr, timeStr) => { const selectedIndex = relatedDates.findIndex(d => d.id === selectedDateId);
const selectedDisplayIndex = selectedIndex >= 0 ? selectedIndex + 1 : 1;
//
const handleSelectDate = (id) => {
setSelectedDateId(id);
setIsDropdownOpen(false);
};
// ( )
const formatShortDate = (dateStr, timeStr) => {
const date = new Date(dateStr); const date = new Date(dateStr);
const dayNames = ['일', '월', '화', '수', '목', '금', '토']; const dayNames = ['일', '월', '화', '수', '목', '금', '토'];
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); const day = date.getDate();
const weekday = dayNames[date.getDay()]; const weekday = dayNames[date.getDay()];
let result = `${month}${day}일 (${weekday})`; let result = `${month}/${day} (${weekday})`;
if (timeStr) { if (timeStr) {
result += ` ${timeStr.slice(0, 5)}`; result += ` ${timeStr.slice(0, 5)}`;
} }
@ -440,182 +530,267 @@ function ConcertSection({ schedule }) {
}; };
return ( return (
<div className="space-y-8"> <div className="space-y-6">
{/* 상단: 포스터 + 정보 카드 (가로 배치) */} {/* ========== 히어로 섹션 ========== */}
<div className={`flex gap-8 ${hasPoster ? '' : 'justify-center'}`}> <motion.section
{/* 포스터 이미지 */} initial={{ opacity: 0 }}
{hasPoster && ( animate={{ opacity: 1 }}
<motion.div className="relative rounded-3xl overflow-visible"
initial={{ opacity: 0, x: -20 }} >
animate={{ opacity: 1, x: 0 }} {/* 배경 레이어 - 포스터 확대 + 블러 */}
transition={{ delay: 0.1 }} <div className="absolute inset-0 rounded-3xl overflow-hidden">
className="flex-shrink-0" {hasPoster ? (
> <>
<div className="relative group">
<img <img
src={schedule.images[0]} src={displayData.posterUrl}
alt={schedule.title} alt=""
className="w-80 rounded-2xl shadow-lg shadow-black/5" className="w-full h-full object-cover scale-125 blur-xl"
/> />
<div className="absolute inset-0 bg-black/0 group-hover:bg-black/10 rounded-2xl transition-colors" /> <div className="absolute inset-0 bg-gradient-to-t from-black/70 via-black/50 to-black/30" />
</div> </>
</motion.div> ) : (
)} <div className="absolute inset-0 bg-gradient-to-br from-primary via-primary/90 to-primary/70" />
)}
</div>
{/* 정보 카드 */} {/* 메인 콘텐츠 */}
<motion.div <div className="relative z-10 p-10">
initial={{ opacity: 0, x: hasPoster ? 20 : 0, y: hasPoster ? 0 : 20 }} <div className="flex items-start gap-10">
animate={{ opacity: 1, x: 0, y: 0 }} {/* 포스터 */}
transition={{ delay: 0.2 }} {hasPoster && (
className={`flex-1 ${hasPoster ? '' : 'max-w-xl'}`} <motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5 }}
className="flex-shrink-0"
>
<img
src={displayData.posterUrl}
alt={displayData.title}
className="w-52 h-72 object-cover rounded-2xl shadow-2xl"
/>
</motion.div>
)}
{/* 제목 및 회차 선택 */}
<div className="flex-1 min-w-0 pt-4">
{/* 제목 */}
<motion.h1
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.1 }}
className="text-3xl font-bold text-white leading-tight mb-6"
>
{decodeHtmlEntities(displayData.title)}
</motion.h1>
{/* 회차 선택 드롭다운 */}
{hasMultipleDates && (
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.2 }}
ref={dropdownRef}
className="relative inline-block"
>
<button
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
className="group flex items-center gap-4 px-5 py-3.5 bg-white rounded-2xl shadow-lg hover:shadow-xl transition-all border border-gray-100"
>
{/* 회차 뱃지 */}
<div className="flex items-center gap-2">
<div className="w-8 h-8 bg-primary rounded-lg flex items-center justify-center">
<span className="text-xs font-bold text-white">{selectedDisplayIndex}</span>
</div>
<span className="text-xs font-medium text-gray-400">회차</span>
</div>
{/* 구분선 */}
<div className="w-px h-6 bg-gray-200" />
{/* 날짜 정보 */}
<div className="text-left">
<div className="text-sm font-semibold text-gray-800">
{formatShortDate(displayData.date, displayData.time)}
</div>
</div>
<ChevronDown
size={18}
className={`text-gray-400 transition-transform duration-200 ${isDropdownOpen ? 'rotate-180' : ''}`}
/>
</button>
<AnimatePresence>
{isDropdownOpen && (
<motion.div
initial={{ opacity: 0, y: -10, scale: 0.95 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: -10, scale: 0.95 }}
transition={{ duration: 0.2, ease: 'easeOut' }}
className="absolute top-full left-0 mt-3 bg-white rounded-2xl shadow-2xl z-[100] w-80 overflow-hidden border border-gray-100"
>
{/* 드롭다운 헤더 */}
<div className="px-4 py-3 bg-gray-50 border-b border-gray-100">
<span className="text-sm font-semibold text-gray-600">공연 일정 선택</span>
</div>
<div ref={dropdownListRef} className="py-2 max-h-72 overflow-y-auto">
{relatedDates.map((item, index) => {
const isSelected = item.id === selectedDateId;
return (
<button
key={item.id}
data-selected={isSelected}
onClick={() => handleSelectDate(item.id)}
className={`w-full flex items-center gap-4 px-4 py-3.5 transition-all ${
isSelected
? 'bg-primary/5'
: 'hover:bg-gray-50'
}`}
>
{/* 회차 번호 */}
<div className={`w-9 h-9 rounded-xl flex items-center justify-center text-sm font-bold transition-colors ${
isSelected
? 'bg-primary text-white'
: 'bg-gray-100 text-gray-500'
}`}>
{index + 1}
</div>
{/* 날짜 정보 */}
<div className="flex-1 text-left">
<div className={`font-medium ${
isSelected ? 'text-primary' : 'text-gray-800'
}`}>
{formatShortDate(item.date, item.time)}
</div>
</div>
{/* 체크 표시 */}
{isSelected && (
<div className="w-6 h-6 bg-primary rounded-full flex items-center justify-center">
<Check size={14} className="text-white" strokeWidth={3} />
</div>
)}
</button>
);
})}
</div>
</motion.div>
)}
</AnimatePresence>
</motion.div>
)}
</div>
</div>
</div>
</motion.section>
{/* ========== 장소 정보 카드 ========== */}
{displayData.locationName && (
<motion.section
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 }}
className="bg-white rounded-2xl shadow-sm ring-1 ring-gray-100 overflow-hidden"
> >
<div className="bg-white rounded-3xl shadow-lg shadow-black/5 overflow-hidden h-full flex flex-col"> {/* 헤더 */}
{/* 헤더 */} <div className="p-6 border-b border-gray-100">
<div className="bg-gradient-to-r from-primary to-primary/80 p-6 text-white"> <div className="flex items-center justify-between">
<h1 className="text-2xl font-bold leading-tight"> <div className="flex items-center gap-4">
{decodeHtmlEntities(schedule.title)} {/* 장소 아이콘 */}
</h1> <div className="w-12 h-12 bg-gray-100 rounded-xl flex items-center justify-center">
</div> <MapPin size={24} className="text-gray-600" />
{/* 정보 목록 */}
<div className="p-6 space-y-5 flex-1">
{/* 공연 일정 목록 */}
<div className="flex items-start gap-4">
<div className="w-12 h-12 rounded-2xl bg-primary/10 flex items-center justify-center flex-shrink-0">
<Calendar size={22} className="text-primary" />
</div> </div>
<div className="flex-1"> {/* 텍스트 */}
{hasMultipleDates ? ( <div>
<div className="space-y-2"> <h2 className="text-lg font-bold text-gray-900">{displayData.locationName}</h2>
{relatedDates.map((item, index) => { {displayData.locationAddress && (
const isCurrentDate = item.id === schedule.id; <p className="text-sm text-gray-500 mt-0.5">{displayData.locationAddress}</p>
return (
<Link
key={item.id}
to={`/schedule/${item.id}`}
className={`block px-4 py-2.5 rounded-xl transition-all ${
isCurrentDate
? 'bg-primary text-white shadow-lg shadow-primary/20'
: 'bg-gray-50 hover:bg-gray-100 text-gray-700'
}`}
>
<span className="text-sm opacity-60 mr-2">
{index + 1}회차
</span>
{formatSingleDate(item.date, item.time)}
</Link>
);
})}
</div>
) : (
<div>
<p className="text-gray-900 font-bold text-lg">
{formatSingleDate(schedule.date, schedule.time)}
</p>
</div>
)} )}
</div> </div>
</div> </div>
{/* 장소 */} {/* 길찾기 버튼 - 카카오맵(국내) / 구글맵(해외) */}
{schedule.location_name && ( <a
<div className="flex items-center gap-4"> href={hasLocation
<div className="w-12 h-12 rounded-2xl bg-rose-50 flex items-center justify-center flex-shrink-0"> ? `https://map.kakao.com/link/to/${encodeURIComponent(displayData.locationName)},${displayData.locationLat},${displayData.locationLng}`
<MapPin size={22} className="text-rose-500" /> : `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(displayData.locationAddress || displayData.locationName)}`
</div> }
<div className="flex-1 min-w-0"> target="_blank"
<p className="text-gray-900 font-bold text-lg truncate">{schedule.location_name}</p> rel="noopener noreferrer"
{schedule.location_address && ( className="flex items-center gap-2 px-4 py-2.5 text-white text-sm font-semibold rounded-lg transition-colors"
<p className="text-gray-500 text-sm truncate">{schedule.location_address}</p> style={{
)} backgroundColor: hasLocation ? '#0079f4' : '#4285F4'
</div> }}
</div> >
)} <Navigation size={16} />
길찾기
{/* 설명 */} </a>
{schedule.description && (
<div className="pt-4 border-t border-gray-100">
<p className="text-gray-600 text-sm leading-relaxed line-clamp-4">
{decodeHtmlEntities(schedule.description)}
</p>
</div>
)}
</div> </div>
</div>
{/* 버튼 영역 */} {/* 지도 - 높이 2배 */}
{schedule.source_url && ( <div className="h-[32rem]">
<div className="p-6 pt-0"> {hasLocation ? (
<a <KakaoMap
href={schedule.source_url} lat={parseFloat(displayData.locationLat)}
target="_blank" lng={parseFloat(displayData.locationLng)}
rel="noopener noreferrer" name={displayData.locationName}
className="w-full inline-flex items-center justify-center gap-2 px-6 py-3.5 bg-gray-900 hover:bg-black text-white rounded-2xl font-semibold transition-all hover:shadow-lg" />
> ) : (
<ExternalLink size={18} /> <iframe
상세 정보 보기 src={`https://maps.google.com/maps?q=${encodeURIComponent(displayData.locationAddress || displayData.locationName)}&output=embed&hl=ko`}
</a> className="h-full w-full border-0"
</div> loading="lazy"
referrerPolicy="no-referrer-when-downgrade"
title="Google Maps"
/>
)} )}
</div> </div>
</motion.div> </motion.section>
</div>
{/* 하단: 지도 */}
{schedule.location_name && hasLocation && (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 }}
className="bg-white rounded-3xl shadow-lg shadow-black/5 overflow-hidden"
>
<div className="p-5 border-b border-gray-100 flex items-center justify-between">
<div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-xl bg-blue-50 flex items-center justify-center">
<Navigation size={18} className="text-blue-500" />
</div>
<div>
<h3 className="font-bold text-gray-900">위치 안내</h3>
<p className="text-sm text-gray-500">{schedule.location_name}</p>
</div>
</div>
<a
href={`https://map.kakao.com/link/to/${encodeURIComponent(schedule.location_name)},${schedule.location_lat},${schedule.location_lng}`}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-500 hover:bg-blue-600 rounded-xl transition-colors"
>
<Navigation size={14} />
길찾기
</a>
</div>
<div className="p-5">
<KakaoMap
lat={parseFloat(schedule.location_lat)}
lng={parseFloat(schedule.location_lng)}
name={schedule.location_name}
/>
</div>
</motion.div>
)} )}
{/* 해외 공연 등 좌표 없는 경우 */} {/* ========== 공연 정보 카드 ========== */}
{schedule.location_name && !hasLocation && ( {hasDescription && (
<motion.section
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.4 }}
className="bg-white rounded-2xl shadow-sm ring-1 ring-gray-100 p-6"
>
<div className="flex items-center gap-3 mb-4">
<div className="w-10 h-10 rounded-xl bg-purple-50 flex items-center justify-center">
<svg className="w-5 h-5 text-purple-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
<h2 className="text-lg font-bold text-gray-900">공연 정보</h2>
</div>
<p className="text-gray-600 leading-relaxed whitespace-pre-wrap">
{decodeHtmlEntities(displayData.description)}
</p>
</motion.section>
)}
{/* ========== 외부 링크 버튼 ========== */}
{displayData.sourceUrl && (
<motion.div <motion.div
initial={{ opacity: 0, y: 20 }} initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 }} transition={{ delay: 0.5 }}
className="bg-gradient-to-br from-gray-50 to-gray-100 rounded-3xl p-8 text-center" className="flex justify-center"
> >
<div className="w-16 h-16 rounded-full bg-white shadow-lg shadow-black/5 mx-auto mb-4 flex items-center justify-center"> <a
<MapPin size={28} className="text-gray-400" /> href={displayData.sourceUrl}
</div> target="_blank"
<p className="text-xl font-bold text-gray-800 mb-1">{schedule.location_name}</p> rel="noopener noreferrer"
{schedule.location_address && ( className="inline-flex items-center gap-2 px-6 py-3 bg-gray-900 text-white rounded-xl font-semibold hover:bg-gray-800 transition-colors"
<p className="text-gray-500">{schedule.location_address}</p> >
)} <ExternalLink size={18} />
{schedule.location_detail && ( 티켓 예매 상세 정보
<p className="text-sm text-gray-400 mt-2">{schedule.location_detail}</p> </a>
)}
</motion.div> </motion.div>
)} )}
</div> </div>
@ -794,7 +969,7 @@ function ScheduleDetail() {
return ( return (
<div className="min-h-[calc(100vh-64px)] bg-gray-50"> <div className="min-h-[calc(100vh-64px)] bg-gray-50">
<div className={`${isYoutube || isConcert ? 'max-w-5xl' : 'max-w-3xl'} mx-auto px-6 py-8`}> <div className={`${isYoutube ? 'max-w-5xl' : isConcert ? 'max-w-4xl' : 'max-w-3xl'} mx-auto px-6 py-8`}>
{/* 브레드크럼 네비게이션 */} {/* 브레드크럼 네비게이션 */}
<motion.div <motion.div
initial={{ opacity: 0, y: -10 }} initial={{ opacity: 0, y: -10 }}