/** * 예약 · 카드 — **발행본의 예약 안내를 그대로 미리 보여준다.** * * ★ 왜 갈아엎었나 (2026-09-09) * 이 카드는 "네이버 실시간 온라인 예약 / 캘린더에서 바로 확정 예약" 을 그리고 있었다. * 우리는 실시간 예약을 하지 않는다(PRODUCT.md 6절 — 재고도 결제도 갖지 않는다). * 게다가 발행본은 날짜·시간을 고르는 화면인데 캔버스만 다른 문구를 보여줘서, * 사장님이 편집 화면에서 본 것과 발행된 사이트가 서로 다른 물건이었다. * **에디터가 보여주는 것이 곧 발행될 것**이어야 한다. * * ★ 여기서는 **누르지 않는다.** 캔버스의 클릭은 "이 섹션을 고른다" 는 뜻이라 * 상태를 가진 위젯을 넣으면 선택과 싸운다. 첫 칸이 골라진 모습으로 고정해 두고, * 실제 동작은 발행본(`solution/site` StayBookingDemo)이 한다. * * ★ 시간 칸은 **체크인 fact 가 있을 때만** 그린다. 발행본과 같은 규칙이다 — * 체크인이 16:00 인데 미리보기가 14:00 을 보여주면 사장님은 그 선택지가 생긴 줄 안다. */ import {CalendarDays, Clock, Minus, Phone, Plus} from 'lucide-react'; import type {InfoField} from '@o2o/shared'; import {SectionBody, SectionFrame, SectionHeading} from '../../primitives'; import type {SectionRenderProps} from '../../types'; const WEEKDAY_LABEL = ['일', '월', '화', '수', '목', '금', '토'] as const; /** 오늘부터 7칸. 캔버스는 브라우저에서만 도므로 날짜를 그대로 그려도 된다 * (발행본은 정적 HTML 이라 날짜를 굽지 않는다 — StayBookingDemo 머리주석). */ function nextDays(count: number) { const today = new Date(); return Array.from({length: count}, (_, index) => { const date = new Date(today.getFullYear(), today.getMonth(), today.getDate() + index); return {day: date.getDate(), weekday: WEEKDAY_LABEL[date.getDay()]}; }); } /** 확인된 값만 읽는다 — 캔버스도 발행본과 같은 규칙이다. */ function verified(fields: InfoField[], id: string): string | undefined { const field = fields.find((f) => f.id === id); if (!field || field.requiresVerification || !field.value?.trim()) return undefined; return field.value.trim(); } function arrivalSlots(checkIn?: string): string[] { const match = /(\d{1,2})\s*:\s*(\d{2})/.exec(checkIn ?? ''); if (!match) return []; const start = Number(match[1]); if (!Number.isFinite(start)) return []; return Array.from({length: 4}, (_, i) => start + i) .filter((hour) => hour <= 23) .map((hour) => `${String(hour).padStart(2, '0')}:${match[2]}`); } export function BookingCard(props: SectionRenderProps) { const {section, isSelected, onSelect, template, infoFields} = props; const days = nextDays(7); const checkIn = verified(infoFields, 'check_in_time'); const slots = arrivalSlots(checkIn); const phone = verified(infoFields, 'phone'); const accent = template.colors.primary; return (

날짜 · 시간 선택

날짜

    {days.map((day, index) => (
  • {day.weekday} {day.day}
  • ))}
{slots.length > 0 && (

도착 예정 시간 (체크인 {checkIn} 이후)

    {slots.map((time, index) => (
  • {time}
  • ))}
)}

인원

2명
예약 요청 확인하기
{/* ★ 실제 예약이 되는 창구. 발행본과 같은 순서다 — 데모 다음에 진짜 창구가 온다. */} {phone && (

전화 예약 {phone}

)}
); }