- 카드 전환 방식 변경
- 필터 조건 선택 가능하게 변경 등
This commit is contained in:
@@ -95,6 +95,8 @@ export function openModal(id) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 제품 상태(specs.condition): 값이 있을 때만 행 노출
|
||||
const conditionText = product.specs?.condition;
|
||||
const isVerified = product.specs?.isVerified;
|
||||
@@ -119,9 +121,30 @@ export function openModal(id) {
|
||||
}
|
||||
}
|
||||
|
||||
// 가격 표시 로직 수정
|
||||
const priceElement = document.getElementById('modal-price');
|
||||
if (priceElement) {
|
||||
if (product.status === '미판매') {
|
||||
// 미판매 상태일 때의 처리
|
||||
priceElement.textContent = 'NOT FOR SALE';
|
||||
priceElement.classList.add('text-gray-500'); // 시각적으로 구분되도록 스타일 추가 가능
|
||||
} else {
|
||||
// 정상 판매 중인 경우
|
||||
priceElement.textContent = `${product.currency}${product.price.toLocaleString()}`;
|
||||
priceElement.classList.remove('text-gray-500');
|
||||
}
|
||||
}
|
||||
|
||||
// (선택 사항) 미판매 상품일 때 상세 설명 부분에 대체 텍스트를 넣거나 숨기고 싶다면:
|
||||
const modalDesc = document.getElementById('modal-desc');
|
||||
if (modalDesc) {
|
||||
modalDesc.innerHTML = Array.isArray(product.fullDescription) ? product.fullDescription.join('<br>') : product.fullDescription || '';
|
||||
if (product.status === '미판매') {
|
||||
modalDesc.innerHTML = '<p class="text-gray-400 italic">판매중인 상품이 아니기에 정보가 제공되지 않습니다.</p>';
|
||||
} else {
|
||||
modalDesc.innerHTML = Array.isArray(product.fullDescription)
|
||||
? product.fullDescription.join('<br>')
|
||||
: product.fullDescription || '';
|
||||
}
|
||||
}
|
||||
|
||||
const copyBtn = document.getElementById('copy-link-btn');
|
||||
@@ -154,13 +177,28 @@ export function openModal(id) {
|
||||
}
|
||||
|
||||
export function closeModal() {
|
||||
document.getElementById('product-modal').classList.add('hidden');
|
||||
const modal = document.getElementById('product-modal');
|
||||
|
||||
// 1. 이미지 캐러셀 영역 초기화
|
||||
const carouselContainer = document.getElementById('modal-main-carousel-container');
|
||||
if (carouselContainer) {
|
||||
carouselContainer.scrollLeft = 0;
|
||||
}
|
||||
|
||||
// 2. 우측 상세 정보 스크롤 영역 초기화 (추가된 부분)
|
||||
const contentScroll = document.getElementById('modal-content-scroll');
|
||||
if (contentScroll) {
|
||||
contentScroll.scrollTo(0, 0); // 스크롤을 맨 위로!
|
||||
}
|
||||
|
||||
// 모달 닫기 로직
|
||||
modal.classList.add('hidden');
|
||||
document.body.classList.remove('modal-open');
|
||||
|
||||
// 히스토리 및 URL 정리
|
||||
if (window.history.state && window.history.state.modalOpen) {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
const cleanUrl = window.location.origin + window.location.pathname;
|
||||
window.history.replaceState(null, '', cleanUrl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user