feat(solution): 발행 워커·버전 관리와 예약·미리보기 정리
상시 프리렌더와 중복 예약 안내를 없애고, 검수된 발행 버전을 보존한다. 미리보기는 실제 렌더 완료까지 스피너를 표시한다. 사이트 81건, 발행·롤백·서치콘솔 45건, 프로세스 수명 3건 통과. 빌더·사이트 빌드 및 compose 설정 검증 통과.
This commit is contained in:
1 parent
0f7d22750f
commit
f2087aad5e
207 files changed
+8424
-4429
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import {Phone} from 'lucide-react';
|
||||
import {selectPublishable} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {bookingActionLabel, bookingLinks, essentialRows} from '@site/lib/derive';
|
||||
import {factualSummary} from '@site/seo/meta';
|
||||
import {formatKoreanDate} from '@site/lib/format';
|
||||
import type {InfoRow} from '@site/lib/derive';
|
||||
import {Section} from '@site/lib/ui';
|
||||
@@ -8,7 +10,7 @@ import {Section} from '@site/lib/ui';
|
||||
/**
|
||||
* 이용 정보 표 전체.
|
||||
*
|
||||
* AnswerBlock 이 상위 6개만 보여준다면 여기는 확인된 것 전부를 낸다.
|
||||
* 예약 전 확인은 이 섹션 한 곳에서 확인된 항목 전체를 낸다.
|
||||
* ★ "확인 안 된 항목이 N개 있다"를 숨기지 않는다 — 없는 척하면
|
||||
* 손님이 다른 데서 틀린 값을 찾아 온다. 있다고 말하고 문의로 보낸다.
|
||||
*
|
||||
@@ -43,6 +45,8 @@ const RULE_LABELS = new Set([
|
||||
export function EssentialInfoSection() {
|
||||
const payload = useSite();
|
||||
const rows = essentialRows(payload);
|
||||
const intro = selectPublishable(payload.facts).find((fact) => fact.key === 'intro');
|
||||
const summary = intro?.summary?.trim() || payload.narrative.summary || factualSummary(payload);
|
||||
const guides = payload.links.filter((link) => link.confirmed &&
|
||||
[link.stayGuide?.policy, link.stayGuide?.service, link.stayGuide?.reservation].some((text) => text?.trim()));
|
||||
const structured = guides.flatMap((link) => link.stayGuide?.fields ?? []);
|
||||
@@ -104,6 +108,7 @@ export function EssentialInfoSection() {
|
||||
}
|
||||
>
|
||||
<div className="space-y-8">
|
||||
{summary && <p className="measure text-[length:var(--fs-body)] leading-relaxed">{summary}</p>}
|
||||
{ruleRows.length > 0 && <Rows title="예약 전 확인" rows={ruleRows} emphasis />}
|
||||
{otherRows.length > 0 && <Rows title="시설 · 편의" rows={otherRows} />}
|
||||
{guides.filter((link) => link.stayGuide?.reservation).map((link) => (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ArrowUpRight, BedDouble, CalendarCheck, Phone, ShieldCheck} from 'lucide-react';
|
||||
import {ArrowUpRight, BedDouble, CalendarCheck, Phone} from 'lucide-react';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {bookingCtaLabel, channelLabel, sectionName, stayBookingView} from '@site/lib/derive';
|
||||
import {StayBookingDemo} from './StayBookingDemo';
|
||||
@@ -31,7 +31,7 @@ export function StayBookingSection() {
|
||||
|
||||
if (!view) return null;
|
||||
|
||||
const {offers, notices, links, contacts, phone} = view;
|
||||
const {offers, links, contacts, phone} = view;
|
||||
|
||||
return (
|
||||
<section
|
||||
@@ -178,31 +178,6 @@ export function StayBookingSection() {
|
||||
{/* ── 날짜 · 시간 선택 (화면 안에서만 도는 목업) ────────── */}
|
||||
<StayBookingDemo />
|
||||
|
||||
{/* ── 예약 전 확인 ────────────────────────────────────── */}
|
||||
{notices.length > 0 && (
|
||||
<div
|
||||
className="mt-4 overflow-hidden rounded-2xl border border-black/8 lg:mt-6"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
<p className="flex items-center gap-2 border-b border-black/8 px-4 py-3 text-xs font-bold sm:px-5">
|
||||
<ShieldCheck className="size-3.5 opacity-50" />
|
||||
<span>예약 전 확인</span>
|
||||
</p>
|
||||
|
||||
{/* 확인된 fact 만 줄이 된다 — "확인 중" 이라는 빈 줄을 그리면 손님은 그걸 규정으로 읽는다. */}
|
||||
<dl className="grid grid-cols-1 divide-y divide-black/5 sm:grid-cols-2 sm:divide-y-0">
|
||||
{notices.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex flex-col gap-1 p-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4 sm:p-5"
|
||||
>
|
||||
<dt className="shrink-0 text-xs opacity-55">{row.label}</dt>
|
||||
<dd className="text-xs font-semibold sm:max-w-[60%] sm:text-right">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* ★ 갈래(문학·역사·…)로 묶어 세우지 않는다. 갈래는 카드 위 이름표로만 쓰고, 뽑기는
|
||||
* 갈래를 가리지 않는다 — 갈래마다 3~4개씩 뽑던 판은 한 번에 15~19개가 떴다.
|
||||
*/
|
||||
import {useEffect, useState} from 'react';
|
||||
import {useEffect, useMemo, useState} from 'react';
|
||||
import type {ReadingItem} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@site/lib/derive';
|
||||
@@ -35,13 +35,17 @@ function shuffled<T>(list: readonly T[]): T[] {
|
||||
|
||||
export function ReadingSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<ReadingItem>(payload, 'reading');
|
||||
// 파서가 매번 새 배열을 만들면 effect가 다시 추첨하며 무한 렌더링한다.
|
||||
const parsed = useMemo(() => sectionItems<ReadingItem>(payload, 'reading'), [payload]);
|
||||
const all = parsed.items;
|
||||
// 서버·첫 렌더가 같아야 한다. 섞기는 아래 useEffect 가 붙은 뒤에 한 번만.
|
||||
const [picked, setPicked] = useState<ReadingItem[]>(() => all.slice(0, MAX_PICK));
|
||||
|
||||
useEffect(() => {
|
||||
if (all.length <= MIN_PICK) return;
|
||||
if (all.length <= MIN_PICK) {
|
||||
setPicked(all);
|
||||
return;
|
||||
}
|
||||
const count = Math.random() < 0.5 ? MIN_PICK : MAX_PICK;
|
||||
setPicked(shuffled(all).slice(0, count));
|
||||
// 더미 전체가 바뀔 때만 다시 뽑는다(발행본에서는 한 번뿐이다).
|
||||
|
||||
@@ -106,6 +106,15 @@ describe('stayBookingView — 예약에 쓸 값을 고르는 자리', () => {
|
||||
});
|
||||
|
||||
describe('발행 HTML — 예약 섹션이 실제로 나가는가', () => {
|
||||
it('예약 전 확인은 이용안내 안에 한 번만 표시한다', () => {
|
||||
const baked = html();
|
||||
expect(baked.match(/예약 전 확인/g)).toHaveLength(1);
|
||||
expect(baked).not.toContain('id="summary"');
|
||||
const booking = baked.slice(baked.indexOf('id="booking"'));
|
||||
expect(booking).not.toContain('예약 전 확인');
|
||||
expect(baked).toContain('취소·환불 규정');
|
||||
expect(baked).toContain('체크인 시간');
|
||||
});
|
||||
it('요금 · 인원 · 취소 규정 · 예약 창구가 한자리에 있다', () => {
|
||||
const text = visibleText(html());
|
||||
expect(text).toContain('예약 창구');
|
||||
|
||||
Reference in new issue
Block a user