인앱 미니 블로그(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에서 보정).
241 lines
8.5 KiB
TypeScript
241 lines
8.5 KiB
TypeScript
import type {ChannelLink} from '@o2o/shared';
|
|
import {useSite} from '@site/lib/site-context';
|
|
import {
|
|
bookingActionLabel,
|
|
bookingLinks,
|
|
sectionName,
|
|
unitSpec,
|
|
unitViews,
|
|
type UnitView,
|
|
} from '@site/lib/derive';
|
|
import {GRAIN, SectionHead} from './SectionHead';
|
|
|
|
/**
|
|
* 편집(잡지)형 객실 — 한 객실이 한 판이다.
|
|
*
|
|
* ★ 카드로 감싸지 않는다. 카드 격자는 '고르는 화면'이고, 잡지의 판은 '보여 주는 화면'이다.
|
|
* 판마다 배경을 밝은 면 ↔ 어두운 면으로 교차해 넘기는 리듬을 만든다.
|
|
* ★ `lib/ui/Section` 을 쓰지 않고 <section> 을 직접 그린다 — 판마다 배경이 갈려야 하는데
|
|
* Section 은 섹션 하나에 바탕 하나다.
|
|
* ★ 사진은 두 장을 위아래로 어긋나게 걸되, 세 번째부터는 아래 접지(contact sheet)로 남긴다.
|
|
* 장식을 위해 사진을 버리면 그 alt 문장이 HTML 에서 사라진다 — 인용될 자리가 준다.
|
|
*/
|
|
export function Rooms() {
|
|
const payload = useSite();
|
|
const units = unitViews(payload);
|
|
const spec = unitSpec(payload);
|
|
const booking = bookingLinks(payload)[0];
|
|
|
|
if (units.length === 0) return null;
|
|
|
|
return (
|
|
<section
|
|
id="units"
|
|
aria-labelledby="units-heading"
|
|
className="border-line w-full border-b"
|
|
style={{
|
|
backgroundColor: 'var(--tpl-surface)',
|
|
backgroundImage: GRAIN,
|
|
paddingBlock: 'var(--section-space)',
|
|
}}
|
|
>
|
|
<div className="shell">
|
|
{/* 섹션 id 는 업종마다 다르다(rooms · menu · programs) — spec.path 가 그 id 다. */}
|
|
<SectionHead
|
|
id="units"
|
|
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
|
|
/>
|
|
</div>
|
|
|
|
{units.map((unit, order) => (
|
|
<UnitSpread
|
|
key={unit.unitId}
|
|
unit={unit}
|
|
no={String(order + 1).padStart(2, '0')}
|
|
/* 홀수 번째 판을 어두운 면으로. 넘길 때마다 바탕이 뒤집힌다. */
|
|
dark={order % 2 === 1}
|
|
booking={booking}
|
|
phone={payload.place.phone}
|
|
/>
|
|
))}
|
|
</section>
|
|
);
|
|
}
|
|
|
|
function UnitSpread({
|
|
unit,
|
|
no,
|
|
dark,
|
|
booking,
|
|
phone,
|
|
}: {
|
|
unit: UnitView;
|
|
no: string;
|
|
dark: boolean;
|
|
booking?: ChannelLink;
|
|
phone?: string;
|
|
}) {
|
|
return (
|
|
<article
|
|
className="w-full"
|
|
style={
|
|
dark
|
|
? {backgroundColor: 'var(--tpl-inverse)', color: 'var(--tpl-bg)', backgroundImage: GRAIN}
|
|
: undefined
|
|
}
|
|
>
|
|
{/*
|
|
★ 가로 홈(gap-x-10)은 xl 부터다. 390px 에서 12칸 격자에 40px 홈을 주면
|
|
홈만 440px 이라 컨테이너(347px)를 넘고, 페이지 전체가 77px 가로로 밀린다(실측).
|
|
좁은 화면에서는 어차피 전부 col-span-12 라 홈이 할 일이 없다.
|
|
*/}
|
|
<div className="shell grid grid-cols-12 gap-y-6 py-10 xl:gap-x-10 xl:py-16">
|
|
{/*
|
|
왼쪽 절반 — 번호 · 이름 · 스펙. 읽는 값은 전부 종이 위에 있다.
|
|
★ pr-8 은 장식이 아니다. 오른쪽 사진이 격자의 홈을 통째로 먹으므로(-ml-10)
|
|
이 여백이 없으면 스펙 표의 값이 사진 모서리에 붙는다(실측: 간격 0px).
|
|
*/}
|
|
<div className="col-span-12 xl:col-span-5 xl:pr-8">
|
|
<div className="relative">
|
|
<span
|
|
aria-hidden
|
|
className="serif pointer-events-none absolute -top-1 left-0 select-none leading-none tabular-nums"
|
|
style={{fontSize: 'clamp(3rem, 8vw, 6rem)', fontWeight: 800, opacity: 0.1}}
|
|
>
|
|
{no}
|
|
</span>
|
|
<h3
|
|
className="serif relative pt-7 xl:pt-12"
|
|
style={{
|
|
fontSize: 'clamp(1.5rem, 3vw, 2.25rem)',
|
|
fontWeight: 800,
|
|
lineHeight: 1.1,
|
|
letterSpacing: '-0.02em',
|
|
}}
|
|
>
|
|
{unit.name}
|
|
</h3>
|
|
</div>
|
|
|
|
{unit.intro && (
|
|
<p className="measure mt-4 font-serif text-[length:var(--fs-body)] leading-relaxed opacity-100">
|
|
{unit.intro}
|
|
</p>
|
|
)}
|
|
|
|
{/*
|
|
★ 요금은 한 값이 아니라 비교하는 값이다. 주중 하나만 적어 두면 손님은
|
|
주말이 얼마인지 모른 채 전화를 걸거나 떠난다. 안 채워진 칸은 '문의' 로 온다.
|
|
*/}
|
|
|
|
{/* 요금은 객실 정보에서 내지 않는다 — 사유는 sections/UnitsSection.tsx 의 같은 자리 주석. */}
|
|
|
|
{unit.rows.length > 0 && (
|
|
<dl className="border-line mt-6 border-t">
|
|
{unit.rows.map((row) => (
|
|
<div
|
|
key={row.label}
|
|
className="border-line flex items-baseline justify-between gap-6 border-b py-2.5 text-[length:var(--fs-sm)]"
|
|
>
|
|
<dt className="text-muted shrink-0">{row.label}</dt>
|
|
<dd className="text-right font-semibold">{row.value}</dd>
|
|
</div>
|
|
))}
|
|
</dl>
|
|
)}
|
|
|
|
{(booking || phone) && (
|
|
<div className="mt-6 flex flex-wrap items-center gap-x-6 gap-y-1 text-[length:var(--fs-sm)] font-bold">
|
|
{booking && (
|
|
<a
|
|
href={booking.url}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="tap inline-flex items-center underline underline-offset-4"
|
|
>
|
|
{bookingActionLabel(booking)}
|
|
</a>
|
|
)}
|
|
{phone && (
|
|
<a
|
|
href={`tel:${phone}`}
|
|
className="tap inline-flex items-center underline underline-offset-4"
|
|
>
|
|
{phone}
|
|
</a>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/*
|
|
오른쪽 절반 — 사진 두 장을 어긋나게.
|
|
★ -ml-10 이 격자의 홈(gap-x-10)을 그대로 먹는다. 글이 있는 칸까지 넘기지는 않는다 —
|
|
겹침이 읽기를 방해하면 그건 장식이 아니라 고장이다.
|
|
★ 음수 여백은 xl 부터다. 390px 에서는 두 장이 그냥 위아래로 선다.
|
|
*/}
|
|
<div className="col-span-12 xl:col-span-7 xl:-ml-10">
|
|
{/*
|
|
★ 폭을 64%/50% 로 잡은 건 취향이 아니라 균형이다. 82% 로 뒀더니 오른쪽 칸이
|
|
1120px 이 되어 왼쪽 글 아래로 600px 짜리 빈 판이 생겼다(실측) —
|
|
어두운 판에서는 그 빈자리가 통째로 검은 구멍으로 보인다.
|
|
*/}
|
|
{unit.images[0] && (
|
|
<figure className="w-full xl:w-[64%]">
|
|
<img
|
|
src={unit.images[0].url}
|
|
alt={unit.images[0].alt}
|
|
loading="lazy"
|
|
decoding="async"
|
|
width={unit.images[0].width}
|
|
height={unit.images[0].height}
|
|
className="w-full object-cover"
|
|
style={{aspectRatio: '4 / 5'}}
|
|
/>
|
|
</figure>
|
|
)}
|
|
|
|
{unit.images[1] && (
|
|
<figure className="mt-3 w-full xl:-mt-24 xl:ml-auto xl:w-[50%]">
|
|
<img
|
|
src={unit.images[1].url}
|
|
alt={unit.images[1].alt}
|
|
loading="lazy"
|
|
decoding="async"
|
|
width={unit.images[1].width}
|
|
height={unit.images[1].height}
|
|
className="w-full object-cover"
|
|
style={{aspectRatio: '4 / 3'}}
|
|
/>
|
|
</figure>
|
|
)}
|
|
</div>
|
|
|
|
{/*
|
|
나머지 사진 — 판 아래를 가로지르는 접지(contact sheet).
|
|
★ 작게라도 남겨야 alt 가 HTML 에 남는다. 장식 때문에 사진을 버리면
|
|
그 문장이 인용될 자리도 같이 사라진다.
|
|
*/}
|
|
{unit.images.length > 2 && (
|
|
<ul className="col-span-12 grid grid-cols-3 gap-2 xl:grid-cols-6">
|
|
{unit.images.slice(2).map((image) => (
|
|
<li key={image.mediaId}>
|
|
<img
|
|
src={image.url}
|
|
alt={image.alt}
|
|
loading="lazy"
|
|
decoding="async"
|
|
width={image.width}
|
|
height={image.height}
|
|
className="w-full object-cover"
|
|
style={{aspectRatio: '3 / 2'}}
|
|
/>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
</div>
|
|
</article>
|
|
);
|
|
}
|