import type { Metadata } from 'next'; import { notFound } from 'next/navigation'; import Link from 'next/link'; import { createAdminClient } from '@/lib/supabase/admin'; import { getProductById, type ProductRow } from '@/lib/supabase/product-files'; import BuySection from './BuySection'; // 완성 소프트웨어 상세 (서버 컴포넌트). // 비노출/비활성/존재하지 않음/DB 예외 → notFound() 로 일관 처리해 500을 내지 않는다. export const dynamic = 'force-dynamic'; const KOR_TIGHT = { letterSpacing: '-0.02em' } as const; const KOR_BODY = { letterSpacing: '-0.01em' } as const; interface Props { params: Promise<{ id: string }>; } async function loadProduct(id: string): Promise { try { return await getProductById(createAdminClient(), id); } catch (err) { // DB 장애·마이그레이션 미적용 등 — 상세 페이지는 404로 폴백 console.error('[ProductDetail] getProductById failed:', err); return null; } } export async function generateMetadata({ params }: Props): Promise { const { id } = await params; const product = await loadProduct(id); if (!product || !product.is_listed || !product.is_active) { return { title: '완성 소프트웨어' }; } return { title: product.name, description: product.description ?? `${product.name} — 쟁승메이드가 직접 운영하며 검증한 완성 소프트웨어. 입금 확인 후 마이페이지에서 즉시 다운로드.`, }; } function CheckMark() { return ( ); } export default async function ProductDetailPage({ params }: Props) { const { id } = await params; const product = await loadProduct(id); if (!product || !product.is_listed || !product.is_active) { notFound(); } const features = product.features ?? []; const longText = product.description_long ?? product.description ?? ''; return (
{/* 브레드크럼 */} {/* 제품명 · 가격 */}

{product.name}

₩{product.price.toLocaleString('ko-KR')}

{/* 상세 설명 */} {longText && (

{longText}

)} {/* 기능 리스트 */} {features.length > 0 && (

주요 기능

    {features.map((f) => (
  • {f}
  • ))}
)} {/* 구매 안내 + CTA */}

구매 후 마이페이지에서 즉시 다운로드 (입금 확인 후).

구매 전{' '} 환불 정책 을 확인해 주세요.

); }