인앱 미니 블로그(AI 자동 포스트, 이메일 승인)·이용후기(즉시 게시)·예약 요청(메일 발송)을
새로 붙였고, 병행해서 /s/stay 목업과 발행 사이트 공통 렌더러(UnitsSection·FestivalSection·
LocalGuideSection·WeatherSection 등)의 UI 버그를 다수 고쳤다. 범위가 넓지만 한 주 분량
작업을 한 커밋으로 묶어 달라는 요청에 따라 하나로 묶는다.
- solution/backend: post/review/booking_request 라우터·서비스·CRUD 추가, 스케줄러에
블로그 초안 생성(새벽 4:10)·발송(아침 9:00) cron 등록, 마이그레이션 4건 추가
- solution/frontend, admin/frontend: 생성된 API 클라이언트 갱신, 리뷰 모더레이션·
블로그 글 관리 페이지 추가
- solution/site/src: 객실 상세+실시간예약(날짜선택·연락처 폼)을 모달로 통합, 축제·
주변안내 카드 클릭 시 모달 전환, 후기 목록 카드 UI, 공용 Modal 컴포넌트 신설,
날씨 문구 동기화 버그 수정(하늘줄·기온줄 한 타이머로), 시설·편의 가능/불가 아이콘
색상 하이라이트, 헤더 메뉴 순서를 실제 섹션 순서에 맞춤, 하단 탭바 아이콘 정렬 버그
(line-height) 수정, 추천일정 점선 연결+데스크톱 자동펼침/모바일 축소, 채널 라벨에
크롤링 원문("NOL")이 새던 것을 bookingLabel() 로 교체
- solution/site/scripts/mockup: /s/stay 패치 스크립트·주입 CSS·JS 다수 수정, stay4~6
빌드 스크립트 추가(다른 세션 작업)
테스트: solution/site `npx tsc --noEmit` 통과, `npx vitest run` 93 passed,
solution/backend `pytest tests/test_booking_request.py` 6 passed(로컬 DB 대상).
예약 요청 메일은 실제 발송까지 확인(place 66894a1b 소유자 이메일 누락을 DB에서 보정).
182 lines
8.0 KiB
TypeScript
182 lines
8.0 KiB
TypeScript
import {ChevronDown, Phone} from 'lucide-react';
|
|
import {useSite} from '@site/lib/site-context';
|
|
import {bookingActionLabel, bookingLinks, sectionName, unitSpec, unitViews} from '@site/lib/derive';
|
|
import {SectionHead} from './SectionHead';
|
|
|
|
/**
|
|
* 파스텔의 객실(·메뉴·프로그램) — 파스텔 카드 2열.
|
|
*
|
|
* ★ 공용 Section 을 쓰지 않고 <section> 을 직접 그린다. 이 안은 판마다 배경이 통째로
|
|
* 바뀌는 게 뼈대라, 배경·여백을 남이 정하면 뼈대가 안 선다. `data-pastel` 은
|
|
* Shell 이 까는 자동 색면을 건너뛰라는 표시다(두 색이 겹치면 판이 둘로 안 보인다).
|
|
* ★ 그림자를 쓰지 않는다 — 카드가 판보다 진한 파스텔이라 **색으로 떠 있다.**
|
|
* 그림자까지 얹으면 말랑한 형태가 무거워진다.
|
|
* ★ 사진은 카드 안쪽에 여백을 두고 넣는다. 카드 가장자리까지 채우면 큰 둥근 모서리가
|
|
* 사진에 잘려 이 안의 형태가 사라진다.
|
|
* ★ 사진은 한 장도 빠뜨리지 않는다. 나머지는 <details> 안에 둔다 — 조건부 렌더로 감추면
|
|
* HTML 에 아예 없어서, 구조화 데이터가 주장하는 image 가 화면에 없는 상태가 된다.
|
|
*/
|
|
export function Rooms() {
|
|
const payload = useSite();
|
|
const spec = unitSpec(payload);
|
|
const units = unitViews(payload);
|
|
const booking = bookingLinks(payload)[0];
|
|
|
|
if (units.length === 0) return null;
|
|
|
|
return (
|
|
<section
|
|
id="units"
|
|
aria-labelledby="units-heading"
|
|
data-pastel="own"
|
|
className="w-full"
|
|
style={{
|
|
backgroundColor: 'var(--tpl-surface, #fff)',
|
|
paddingBlock: 'var(--section-space)',
|
|
}}
|
|
>
|
|
<div className="shell">
|
|
<SectionHead
|
|
id="units"
|
|
/* 섹션 id 는 업종마다 다르다(rooms · menu · programs). 사장님이 이름을 바꿨으면 그 이름이 나간다. */
|
|
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
|
|
/>
|
|
|
|
<ul className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:gap-8">
|
|
{units.map((unit, index) => (
|
|
<li
|
|
key={unit.unitId}
|
|
className="flex flex-col overflow-hidden p-4 sm:p-5"
|
|
style={{
|
|
backgroundColor: index % 2 === 0 ? 'var(--pastel-1)' : 'var(--pastel-2)',
|
|
borderRadius: 'calc(var(--tpl-radius, 0.75rem) * 1.35)',
|
|
}}
|
|
>
|
|
{unit.images[0] && (
|
|
<div
|
|
className="relative aspect-16/10 overflow-hidden"
|
|
style={{borderRadius: 'var(--tpl-radius, 0.75rem)'}}
|
|
>
|
|
<img
|
|
src={unit.images[0].url}
|
|
alt={unit.images[0].alt}
|
|
loading="lazy"
|
|
decoding="async"
|
|
className="size-full object-cover"
|
|
/>
|
|
</div>
|
|
)}
|
|
|
|
<div className="flex flex-1 flex-col gap-3 px-1 pt-4">
|
|
<div className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1">
|
|
<h3 className="h3" style={{fontWeight: 800}}>
|
|
{unit.name}
|
|
</h3>
|
|
</div>
|
|
|
|
{/*
|
|
★ 요금은 한 값이 아니라 비교하는 값이다. 주중만 적어 두면 손님은 주말이
|
|
얼마인지 모른 채 떠난다. 안 채워진 칸은 derive 가 '문의' 로 준다.
|
|
*/}
|
|
|
|
{unit.chips.length > 0 && (
|
|
<ul className="flex flex-wrap items-center gap-1.5">
|
|
{unit.chips.map((chip) => (
|
|
<li
|
|
key={chip.label}
|
|
className="inline-flex items-center gap-1 rounded-full px-3 py-1 text-[length:var(--fs-xs)]"
|
|
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 70%, transparent)'}}
|
|
>
|
|
<span className="opacity-100">{chip.label}</span>
|
|
<span className="font-bold">{chip.value}</span>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
|
|
{unit.intro && (
|
|
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
|
{unit.intro}
|
|
</p>
|
|
)}
|
|
</div>
|
|
|
|
{/* ★ 예약·문의는 접힌 곳에 두지 않는다. 손님이 못 보는 버튼은 없는 버튼이다. */}
|
|
{(booking || payload.place.phone) && (
|
|
<div className="mt-4 flex gap-2 px-1">
|
|
{booking && (
|
|
<a
|
|
href={booking.url}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="tap flex flex-1 items-center justify-center rounded-full text-[length:var(--fs-sm)] font-extrabold transition-opacity hover:opacity-100"
|
|
style={{backgroundColor: 'var(--pastel-ink)', color: 'var(--tpl-bg, #fff)'}}
|
|
>
|
|
{bookingActionLabel(booking)}
|
|
</a>
|
|
)}
|
|
{payload.place.phone && (
|
|
<a
|
|
href={`tel:${payload.place.phone}`}
|
|
className="tap flex items-center justify-center gap-1.5 rounded-full px-5 text-[length:var(--fs-sm)] font-bold"
|
|
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 75%, transparent)'}}
|
|
>
|
|
<Phone className="size-4" />
|
|
<span>전화</span>
|
|
</a>
|
|
)}
|
|
</div>
|
|
)}
|
|
|
|
{(unit.rows.length > 0 || unit.images.length > 1) && (
|
|
<details className="group mt-3 px-1">
|
|
<summary className="tap flex cursor-pointer list-none items-center justify-between gap-2 text-[length:var(--fs-sm)] font-bold marker:content-none [&::-webkit-details-marker]:hidden">
|
|
<span>{unit.name} 자세히</span>
|
|
<ChevronDown className="size-4 shrink-0 transition-transform group-open:rotate-180" />
|
|
</summary>
|
|
|
|
<div className="space-y-4 pb-1">
|
|
{unit.rows.length > 0 && (
|
|
<dl className="divide-line divide-y">
|
|
{unit.rows.map((row) => (
|
|
<div
|
|
key={row.label}
|
|
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
|
|
>
|
|
<dt className="shrink-0 opacity-100">{row.label}</dt>
|
|
<dd className="text-right font-bold">{row.value}</dd>
|
|
</div>
|
|
))}
|
|
</dl>
|
|
)}
|
|
|
|
{unit.images.length > 1 && (
|
|
<ul className="grid grid-cols-2 gap-2">
|
|
{unit.images.slice(1).map((image) => (
|
|
<li
|
|
key={image.mediaId}
|
|
className="relative aspect-4/3 overflow-hidden"
|
|
style={{borderRadius: 'calc(var(--tpl-radius, 0.75rem) * 0.7)'}}
|
|
>
|
|
<img
|
|
src={image.url}
|
|
alt={image.alt}
|
|
loading="lazy"
|
|
decoding="async"
|
|
className="size-full object-cover"
|
|
/>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
</div>
|
|
</details>
|
|
)}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|