[feat] solution: 미니 블로그·이용후기·예약요청 추가, /s/stay 목업·발행 사이트 UI 다수 수정
인앱 미니 블로그(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에서 보정).
This commit is contained in:
1 parent
29af37f158
commit
872d00f3c4
338 files changed
+74988
-9283
No files matched your search
@@ -78,6 +78,16 @@ export interface UnitView {
|
||||
/** 객실 정보에서 내지 않는 fact. 요금은 요금 섹션 한 곳에서만 말한다. */
|
||||
const UNIT_PRICE_FACT_KEYS = new Set(['weekday_price', 'weekend_price', 'peak_price', 'price_range']);
|
||||
|
||||
function dedupeRows(rows: InfoRow[]): InfoRow[] {
|
||||
const seen = new Set<string>();
|
||||
return rows.filter((row) => {
|
||||
const key = row.value.trim();
|
||||
if (seen.has(key)) return false;
|
||||
seen.add(key);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
export function unitViews(payload: SitePayload): UnitView[] {
|
||||
const spec = UNIT_SPEC[payload.place.category];
|
||||
const mediaById = new Map(payload.media.map((m) => [m.mediaId, m]));
|
||||
@@ -109,10 +119,14 @@ export function unitViews(payload: SitePayload): UnitView[] {
|
||||
* 지시가 반만 먹었다. 객실 정보에서 값은 **한 군데도** 나오지 않는다.
|
||||
* `prices`·`priceText` 는 그대로 둔다 — 요금 섹션과 예약 안내가 계속 쓴다.
|
||||
*/
|
||||
rows: unit.facts
|
||||
.filter((fact) => !UNIT_PRICE_FACT_KEYS.has(fact.key))
|
||||
.map((fact) => ({label: displayFactLabel(fact), value: displayValue(fact, unit.facts)}))
|
||||
.filter((row) => row.value !== ''),
|
||||
rows: dedupeRows(
|
||||
unit.facts
|
||||
.filter((fact) => !UNIT_PRICE_FACT_KEYS.has(fact.key))
|
||||
.filter((fact) => !chipKeys.includes(fact.key))
|
||||
.filter((fact) => fact.key !== 'room_intro' && fact.key !== 'description')
|
||||
.map((fact) => ({label: displayFactLabel(fact), value: displayValue(fact, unit.facts)}))
|
||||
.filter((row) => row.value !== '' && row.value.trim() !== (intro ?? '').trim()),
|
||||
),
|
||||
images: unit.mediaIds
|
||||
.map((id) => mediaById.get(id))
|
||||
.filter((m): m is MediaItem => Boolean(m?.alt?.trim())),
|
||||
|
||||
@@ -239,15 +239,15 @@ export function Carousel({
|
||||
aria-controls={id}
|
||||
className={`h-1.5 rounded-full transition-all ${
|
||||
index === selected
|
||||
? 'w-6 bg-current opacity-70'
|
||||
: 'w-1.5 bg-current opacity-20 hover:opacity-45'
|
||||
? 'w-6 bg-current opacity-100'
|
||||
: 'w-1.5 bg-current opacity-20 hover:opacity-100'
|
||||
}`}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
<span className="text-current/55 text-[length:var(--fs-xs)] tabular-nums">
|
||||
<span className="text-current/80 text-[length:var(--fs-xs)] tabular-nums">
|
||||
{selected + 1} / {snaps.length}
|
||||
</span>
|
||||
</div>
|
||||
@@ -289,7 +289,7 @@ function NavButton({
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
aria-label={`${label} ${dir === 'prev' ? '이전' : '다음'}`}
|
||||
className="tap border-line flex items-center justify-center rounded-full border transition-opacity hover:opacity-70 disabled:opacity-25"
|
||||
className="tap border-line flex items-center justify-center rounded-full border transition-opacity hover:opacity-100 disabled:opacity-25"
|
||||
>
|
||||
<Icon className="size-5" />
|
||||
</button>
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import {useEffect} from 'react';
|
||||
import type {ReactNode} from 'react';
|
||||
import {X} from 'lucide-react';
|
||||
|
||||
/**
|
||||
* 바텀시트(모바일) · 가운데 카드(데스크톱) 모달 한 장.
|
||||
*
|
||||
* ReviewSection 이 먼저 이 모양(배경 버튼 · Escape · 스크롤 잠금)을 만들었다 —
|
||||
* 후기 쓰기 하나뿐일 때는 그 파일 안에 있었지만, 객실 상세·축제·맛집도 같은 모양을
|
||||
* 쓰게 되면서 여기로 뺐다.
|
||||
*/
|
||||
export function Modal({
|
||||
open,
|
||||
onClose,
|
||||
label,
|
||||
children,
|
||||
wide,
|
||||
}: {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
label: string;
|
||||
children: ReactNode;
|
||||
/** 안이 2열(정보+예약)로 갈리는 경우처럼 lg 폭이 필요할 때. */
|
||||
wide?: boolean;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') onClose();
|
||||
};
|
||||
const previous = document.body.style.overflow;
|
||||
document.body.style.overflow = 'hidden';
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => {
|
||||
document.body.style.overflow = previous;
|
||||
window.removeEventListener('keydown', onKey);
|
||||
};
|
||||
}, [open, onClose]);
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-[60]">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="닫기"
|
||||
onClick={onClose}
|
||||
className="absolute inset-0 bg-black/55"
|
||||
/>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={label}
|
||||
className={`absolute inset-x-0 bottom-0 max-h-[88svh] overflow-auto rounded-t-2xl px-5 pb-8 pt-14 sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:max-h-[85vh] sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl ${
|
||||
wide ? 'sm:max-w-3xl' : 'sm:max-w-lg'
|
||||
}`}
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
aria-label="닫기"
|
||||
className="tap absolute right-3 top-3 z-10 flex size-10 items-center justify-center rounded-full shadow-md"
|
||||
style={{
|
||||
backgroundColor: 'var(--color-surface)',
|
||||
boxShadow: '0 1px 2px rgba(0,0,0,.18), 0 0 0 1px color-mix(in oklab, currentColor 12%, transparent)',
|
||||
}}
|
||||
>
|
||||
<X className="size-5" />
|
||||
</button>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import {useState, type ReactNode} from 'react';
|
||||
|
||||
/**
|
||||
* 앞의 몇 개만 보이고 나머지는 접힌다.
|
||||
*
|
||||
* ★ **잘라내지 않고 감춘다.** `hidden` 은 DOM 에 남으므로 크롤러·AI 는 전부 읽는다 —
|
||||
* 이 사이트가 존재하는 이유가 그 읽힘이라, 화면을 줄이자고 문서를 줄이면 안 된다.
|
||||
* ★ 한 번 펼치면 접는 버튼을 두지 않는다. 읽던 자리가 화면 밖으로 튀어 오른다.
|
||||
*/
|
||||
export function ShowMore({
|
||||
children,
|
||||
initial = 3,
|
||||
label,
|
||||
}: {
|
||||
children: ReactNode[];
|
||||
initial?: number;
|
||||
label?: (rest: number) => string;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const rest = Math.max(0, children.length - initial);
|
||||
|
||||
return (
|
||||
<>
|
||||
{children.map((child, index) => (
|
||||
/* ★ `hidden` 만 쓰면 안 된다 — 이 상자는 `display: contents` 라 레이아웃에 투명한데,
|
||||
인라인 display 가 `[hidden]` 의 기본 `display:none` 을 이긴다. display 로 가른다. */
|
||||
<div key={index} style={{display: open || index < initial ? 'contents' : 'none'}}>
|
||||
{child}
|
||||
</div>
|
||||
))}
|
||||
{!open && rest > 0 && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(true)}
|
||||
className="tap border-line tpl-border mt-3 w-full rounded-lg border text-[length:var(--fs-sm)] font-bold"
|
||||
>
|
||||
{label ? label(rest) : `${rest}개 더 보기`}
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
import {ArrowUpRight, X} from 'lucide-react';
|
||||
|
||||
export interface Spot {
|
||||
name: string;
|
||||
imageUrl?: string;
|
||||
badge?: string;
|
||||
line?: string;
|
||||
description?: string;
|
||||
href: string;
|
||||
linkLabel?: string;
|
||||
}
|
||||
|
||||
export function SpotCard({spot, onOpen}: {spot: Spot; onOpen: () => void}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpen}
|
||||
className="panel group flex h-full w-full flex-col overflow-hidden text-left"
|
||||
>
|
||||
<span className="relative block aspect-4/3 overflow-hidden">
|
||||
{spot.imageUrl ? (
|
||||
<img
|
||||
src={spot.imageUrl}
|
||||
alt={`${spot.name} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
) : (
|
||||
<span
|
||||
className="serif grid size-full place-items-center px-3 text-center text-[length:var(--fs-lead)] leading-tight"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 9%, transparent)'}}
|
||||
aria-hidden
|
||||
>
|
||||
{spot.name}
|
||||
</span>
|
||||
)}
|
||||
{spot.badge && (
|
||||
<span
|
||||
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
|
||||
style={{
|
||||
backgroundColor: 'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
}}
|
||||
>
|
||||
{spot.badge}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
<span className="flex min-w-0 flex-1 flex-col gap-1 p-3">
|
||||
<span className="text-[length:var(--fs-sm)] font-bold">{spot.name}</span>
|
||||
{spot.line && (
|
||||
<span className="text-muted text-[length:var(--fs-xs)] break-words">{spot.line}</span>
|
||||
)}
|
||||
{spot.description && (
|
||||
<span className="text-muted line-clamp-2 text-[length:var(--fs-xs)] leading-relaxed">
|
||||
{spot.description}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-muted mt-auto pt-1 text-[length:var(--fs-xs)]">더 보기</span>
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export function SpotSheet({spot, onClose}: {spot: Spot | null; onClose: () => void}) {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
|
||||
useEffect(() => setMounted(true), []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!spot) return;
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') onClose();
|
||||
};
|
||||
const previous = document.body.style.overflow;
|
||||
document.body.style.overflow = 'hidden';
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => {
|
||||
document.body.style.overflow = previous;
|
||||
window.removeEventListener('keydown', onKey);
|
||||
};
|
||||
}, [spot, onClose]);
|
||||
|
||||
if (!mounted || !spot) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50">
|
||||
<button type="button" aria-label="닫기" onClick={onClose} className="absolute inset-0 bg-black/55" />
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={spot.name}
|
||||
className="absolute inset-x-0 bottom-0 max-h-[88svh] overflow-auto rounded-t-2xl"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
{spot.imageUrl && (
|
||||
<img
|
||||
src={spot.imageUrl}
|
||||
alt={`${spot.name} 사진`}
|
||||
className="aspect-4/3 w-full object-cover"
|
||||
/>
|
||||
)}
|
||||
<div className="flex flex-col gap-2 p-5 pb-8">
|
||||
<div className="flex items-start gap-3">
|
||||
<h3 className="h3 min-w-0 flex-1">{spot.name}</h3>
|
||||
<button type="button" onClick={onClose} aria-label="닫기" className="tap -mt-1 shrink-0 px-1">
|
||||
<X className="size-5" />
|
||||
</button>
|
||||
</div>
|
||||
{(spot.badge || spot.line) && (
|
||||
<p className="text-muted text-[length:var(--fs-sm)]">
|
||||
{[spot.badge, spot.line].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
)}
|
||||
{spot.description && (
|
||||
<p className="measure whitespace-pre-line break-keep text-[length:var(--fs-body)] leading-relaxed">
|
||||
{spot.description}
|
||||
</p>
|
||||
)}
|
||||
<a
|
||||
href={spot.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="tap border-line tpl-border mt-2 flex items-center justify-center gap-1.5 rounded-lg border text-[length:var(--fs-sm)] font-bold"
|
||||
>
|
||||
<span>{spot.linkLabel ?? '지도에서 보기'}</span>
|
||||
<ArrowUpRight className="size-4" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
export {Section, type SectionTone} from './Section';
|
||||
export {Carousel, CarouselSlide} from './Carousel';
|
||||
export {Card, Chip, Field, ActionLink} from './primitives';
|
||||
export {ShowMore} from './ShowMore';
|
||||
export {Modal} from './Modal';
|
||||
@@ -67,7 +67,7 @@ export function ActionLink({
|
||||
<a
|
||||
href={href}
|
||||
{...(external ? {target: '_blank', rel: 'noopener noreferrer'} : {})}
|
||||
className={`tap inline-flex items-center justify-center gap-2 rounded-lg px-4 text-[length:var(--fs-sm)] font-semibold transition-opacity hover:opacity-85 ${
|
||||
className={`tap inline-flex items-center justify-center gap-2 rounded-lg px-4 text-[length:var(--fs-sm)] font-semibold transition-opacity hover:opacity-100 ${
|
||||
solid ? '' : 'border-line tpl-border border bg-current/5'
|
||||
}`}
|
||||
style={solid ? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'} : undefined}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
import {useEffect, useRef, type RefObject} from 'react';
|
||||
|
||||
/** 자동 넘김 기본 간격. 카드 한 장을 읽고 사진을 보는 데 드는 시간이다. */
|
||||
export const AUTOPLAY_MS = 4500;
|
||||
export const AUTOPLAY_MS = 4000;
|
||||
|
||||
export interface RailAutoplay {
|
||||
/**
|
||||
|
||||
@@ -7,9 +7,14 @@ export interface LiveWeather extends WeatherSnapshot {
|
||||
|
||||
function condition(code: number): string {
|
||||
if (code === 0) return '맑음';
|
||||
if (code >= 1 && code <= 3) return '구름많음';
|
||||
if (code >= 50 && code <= 69) return '비';
|
||||
if (code >= 70 && code <= 79) return '눈';
|
||||
if (code >= 1 && code <= 2) return '구름많음';
|
||||
if (code === 3) return '흐림';
|
||||
if (code === 45 || code === 48) return '안개';
|
||||
if (code >= 51 && code <= 57) return '이슬비';
|
||||
if (code >= 61 && code <= 67) return '비';
|
||||
if ((code >= 71 && code <= 77) || code === 85 || code === 86) return '눈';
|
||||
if (code >= 80 && code <= 82) return '소나기';
|
||||
if (code >= 95 && code <= 99) return '뇌우';
|
||||
return '흐림';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,52 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
|
||||
/** 첫 렌더는 고정해 SSR과 맞추고, 이후에는 한 바퀴 안에서 중복 없이 돌린다. */
|
||||
export function useWeatherNote(lines: string[] | undefined, fallback?: string) {
|
||||
const [selection, setSelection] = useState<{lines: string[]; index: number}>();
|
||||
function nextPicker(lines: string[]) {
|
||||
let remaining: number[] = [];
|
||||
let previous = -1;
|
||||
return () => {
|
||||
if (!remaining.length) remaining = lines.map((_, index) => index);
|
||||
const choices = remaining.filter((index) => index !== previous);
|
||||
const available = choices.length ? choices : remaining;
|
||||
const index = available[Math.floor(Math.random() * available.length)];
|
||||
remaining = remaining.filter((value) => value !== index);
|
||||
previous = index;
|
||||
return lines[index];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 하늘 문구·기온 문구를 **한 타이머**로 같이 돌린다.
|
||||
*
|
||||
* ★ 왜 하나로 묶나 (대표: "타이틀이랑 소문구 같이 안 나옴, 타이밍 안 맞음")
|
||||
* 전에는 `useWeatherNote` 를 두 번 불러 각자 자기 `setInterval` 을 가졌다. 둘 다 20초
|
||||
* 간격이라도 첫 타이머가 언제 걸렸는지가 살짝씩 갈려 시간이 지날수록 두 줄이 서로
|
||||
* 다른 시점에 바뀌었다 — 손님 눈에는 한 카드 안에서 문장 둘이 따로 노는 것으로 보인다.
|
||||
* 타이머 하나가 두 줄을 같이 뽑으면 항상 같은 순간에 같이 바뀐다.
|
||||
* ★ 첫 렌더는 고정해 SSR 과 맞추고, 붙은 뒤 첫 타이머에서 무작위 문구로 전환한다.
|
||||
*/
|
||||
export function useWeatherNotes(
|
||||
skyLines: string[] | undefined,
|
||||
skyFallback: string | undefined,
|
||||
tempLines: string[] | undefined,
|
||||
tempFallback: string | undefined,
|
||||
): [string | undefined, string | undefined] {
|
||||
const [picked, setPicked] = useState<{sky?: string; temp?: string}>({});
|
||||
|
||||
useEffect(() => {
|
||||
if (!lines?.length) return;
|
||||
let remaining: number[] = [];
|
||||
let previous = -1;
|
||||
const next = () => {
|
||||
if (!remaining.length) remaining = lines.map((_, index) => index);
|
||||
const choices = remaining.filter((index) => index !== previous);
|
||||
const available = choices.length ? choices : remaining;
|
||||
const index = available[Math.floor(Math.random() * available.length)];
|
||||
remaining = remaining.filter((value) => value !== index);
|
||||
previous = index;
|
||||
setSelection({lines, index});
|
||||
};
|
||||
// effect 안의 동기 setState 대신 첫 타이머에서 무작위 문구로 전환한다.
|
||||
if (!skyLines?.length && !tempLines?.length) return;
|
||||
const pickSky = skyLines?.length ? nextPicker(skyLines) : undefined;
|
||||
const pickTemp = tempLines?.length ? nextPicker(tempLines) : undefined;
|
||||
const next = () => setPicked({sky: pickSky?.(), temp: pickTemp?.()});
|
||||
const first = window.setTimeout(next, 0);
|
||||
const timer = window.setInterval(next, 20_000);
|
||||
return () => {
|
||||
window.clearTimeout(first);
|
||||
window.clearInterval(timer);
|
||||
};
|
||||
}, [lines]);
|
||||
return lines?.[selection?.lines === lines ? selection.index : 0] ?? fallback;
|
||||
}, [skyLines, tempLines]);
|
||||
|
||||
return [
|
||||
picked.sky ?? skyLines?.[0] ?? skyFallback,
|
||||
picked.temp ?? tempLines?.[0] ?? tempFallback,
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user