[feat] solution: 템플릿 정의를 templates.json 한 파일로 — 업종 없는 id · 레이아웃 basic/paper 정리
템플릿 정보가 빌더·렌더러·백엔드에 따로 적혀 어긋나 있었다 — 백엔드 기본값이 없는 id 를 가리켰고, 음식점 강조색 오타, 섹션 간격이 빌더와 서버에서 달랐다. - shared/src/data/templates.json: 템플릿 4개(simple·magazine·retro·paper)와 업종별 허용·기본 - shared/lib/catalog.ts · backend/common/template_catalog.py: 같은 JSON 을 읽는다, 모르는 id 는 에러 - 저장·미리보기·발행에서 모르는 id 를 거절한다(site_service · site.py 422 · build_service 실패) - site: 레이아웃 등록표(basic·paper) + LayoutProvider, Shell→Frame, HomePage→SectionList - 연결 안 된 레이아웃 5개, 배치 고르기(variant), 서체 선택, 빌더 canvas/DevShowcase 삭제 - 빌더: 템플릿을 바꾸면 이전 템플릿이 켠 섹션을 끄고 안내 문구를 띄운다 - postgres-init/migrations/0023: stay-retro → retro, 병원 허용 밖은 NULL(운영 미적용) - Dockerfile·worker: 백엔드 이미지에 shared/src/data 복사 - docs: TEMPLATES.md 신설(세 폴더 역할·템플릿 추가·렌더링 순서), DATA_MODEL·ARCHITECTURE 등 갱신 shared·site·frontend tsc 통과, site vitest 통과, 백엔드 DB 없는 테스트 41 passed(DB 테스트 미실행) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
46b74b310b
commit
c6908629f3
183 files changed
+1824
-15243
No files matched your search
@@ -73,8 +73,6 @@ export function CanvasView() {
|
||||
<div className="relative flex h-full min-w-0 flex-1 flex-col overflow-hidden bg-muted">
|
||||
{!isPreviewMode && (
|
||||
<div className="z-10 flex h-10 min-w-0 select-none items-center justify-between gap-2 border-b border-border bg-card px-4 text-xs">
|
||||
{/* ★ min-w-0 — 이 줄이 안 줄어들면 캔버스 칸 전체의 최소 너비가 올라가고,
|
||||
그 여파로 오른쪽 패널이 화면 밖으로 밀린다(EditorLayout 주석 참조). */}
|
||||
<div className="flex min-w-0 items-center gap-1.5">
|
||||
<span className="hidden shrink-0 font-semibold md:inline">미리보기 해상도:</span>
|
||||
<div className="flex shrink-0 items-center gap-0.5 rounded border border-border bg-muted p-0.5">
|
||||
@@ -106,9 +104,6 @@ export function CanvasView() {
|
||||
)}
|
||||
|
||||
<div className="flex flex-1 items-start justify-center overflow-y-auto bg-muted/70 p-2 sm:p-6">
|
||||
{/* ★ 이 껍데기는 토큰도 폭도 정하지 않는다(2026-09-09).
|
||||
안쪽 iframe 이 **자기 뷰포트**를 만들고 색·서체는 payload 가 준다.
|
||||
바깥이 한 번 더 얹으면 두 겹이 돼 바깥 값이 안쪽을 덧칠한다 — 실제로 그랬다. */}
|
||||
<div className="my-auto w-full min-w-0 transition-all duration-300">
|
||||
{viewport !== 'pc' && (
|
||||
<div className="flex items-center justify-between bg-foreground px-4 py-2 font-mono text-[11px] text-background">
|
||||
@@ -123,13 +118,6 @@ export function CanvasView() {
|
||||
<span className="text-[10px] opacity-70">{viewport.toUpperCase()}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ★ 편집 모드도 **발행본 렌더러**가 그린다(2026-09-09).
|
||||
캔버스 전용 컴포넌트를 따로 두는 동안 두 화면이 아예 다른 트리였다 — 실측:
|
||||
발행본 15섹션 · 에디터 12섹션, 겹치는 건 4개뿐이고 이름도 달랐다
|
||||
(gallery↔photos · location↔map · guide↔local). 사장님이 편집한 화면과
|
||||
발행된 화면이 서로 다른 물건이었다.
|
||||
고르는 일은 iframe 안 섹션을 눌러서 한다 — SitePreview 가 배선한다. */}
|
||||
<SitePreview
|
||||
placeId={placeId}
|
||||
viewport={viewport}
|
||||
@@ -140,13 +128,6 @@ export function CanvasView() {
|
||||
setRightTab('content');
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* ★ 푸터도 모바일 하단 탭바도 여기서 그리지 않는다
|
||||
(2026-09-15 대표: "에디터에서 이 부분 필요없음 / 이 부분 자체가 필요없음")
|
||||
발행본이 iframe 안에서 **둘 다 이미 그린다** — 푸터는 `site/sections/SiteFooter.tsx`,
|
||||
탭바는 `site/sections/MobileTabBar.tsx`(App 과 레이아웃 Shell 다섯이 모두 세운다).
|
||||
바깥에 한 벌 더 그리면 상호·주소·저작권·탭이 두 번 서고, 두 벌의 값이 어긋날 수도
|
||||
있다 — 이 캔버스가 "발행되는 그 화면"이어야 한다는 원칙(SitePreview 주석)에 어긋난다. */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,26 +1,10 @@
|
||||
/**
|
||||
* 붙여넣기 아이템의 **직접 입력** 폼.
|
||||
*
|
||||
* ★ 왜 만들었나
|
||||
* 입구가 JSON 붙여넣기 하나뿐이었다. 한 글자만 고치려 해도 사장님이 중괄호와 쉼표를
|
||||
* 헤집어야 했고, 쉼표 하나 잘못 지우면 섹션이 통째로 사라졌다. ChatGPT 를 안 쓰는
|
||||
* 사장님은 아예 채울 수가 없었다.
|
||||
*
|
||||
* ★ 폼과 JSON 은 한 값의 두 얼굴이다
|
||||
* 진실은 `section.data` **문자열 하나**뿐이고 이 폼은 그걸 비춘다. 그래서
|
||||
* JSON 을 붙여넣으면 폼이 따라 바뀌고, 폼을 고치면 JSON 이 다시 쓰인다 —
|
||||
* 어느 쪽이 최신인지 물을 일이 없다. 폼 상태를 따로 들고 있으면 그 순간
|
||||
* "화면은 새 값, 저장은 옛 값"이 생긴다.
|
||||
*
|
||||
* ★ 깨진 JSON 은 폼으로 못 편다. 그때는 폼을 감추고 오류만 남긴다 —
|
||||
* 반쯤 읽힌 값으로 폼을 그리면 사장님이 쓴 걸 덮어쓴다.
|
||||
*/
|
||||
/** 붙여넣기 아이템의 **직접 입력** 폼. */
|
||||
import {Plus, Trash2} from 'lucide-react';
|
||||
import {parseSectionData} from '@o2o/shared';
|
||||
import {Button} from '@/components/ui/button';
|
||||
import {Input} from '@/components/ui/input';
|
||||
import {cn} from '@/lib/utils';
|
||||
import type {ItemField, SectionDataSpec} from './canvas/dataSpec';
|
||||
import type {ItemField, SectionDataSpec} from './sections/dataSpec';
|
||||
|
||||
type Row = Record<string, unknown>;
|
||||
|
||||
|
||||
@@ -27,12 +27,11 @@ import {INDUSTRY_CONFIGS} from '@/data/industryData';
|
||||
import {FaqPanel} from './FaqPanel';
|
||||
import {ItemFormEditor} from './ItemFormEditor';
|
||||
import {SectionDesignPanel} from './SectionDesignPanel';
|
||||
import {resolveVariant} from './canvas/registry';
|
||||
import {
|
||||
buildPrompt,
|
||||
dataSpecFor,
|
||||
SECTION_DATA_MAX_CHARS,
|
||||
} from './canvas/dataSpec';
|
||||
} from './sections/dataSpec';
|
||||
|
||||
const TABS: {id: RightTab; label: string; icon: typeof Info}[] = [
|
||||
{id: 'content', label: '콘텐츠', icon: FileText},
|
||||
@@ -86,7 +85,6 @@ export function RightTabsPanel() {
|
||||
}
|
||||
|
||||
function ContentTab() {
|
||||
const industry = useBuilderStore((s) => s.industry);
|
||||
const sections = useBuilderStore((s) => s.sections);
|
||||
const selectedSectionId = useBuilderStore((s) => s.selectedSectionId);
|
||||
const updateSectionContent = useBuilderStore((s) => s.updateSectionContent);
|
||||
@@ -110,17 +108,9 @@ function ContentTab() {
|
||||
description: patch.description ?? section.description,
|
||||
body: patch.body ?? section.body,
|
||||
});
|
||||
const variantId = resolveVariant(section, industry)?.id ?? '';
|
||||
const supportsTitle = section.type !== 'local';
|
||||
const supportsDescription = !(
|
||||
variantId.startsWith('rooms.') || variantId.startsWith('rules.') ||
|
||||
variantId.startsWith('local.') || variantId === 'menu.price-table' ||
|
||||
variantId === 'space.list' || variantId === 'programs.table' ||
|
||||
variantId === 'exhibition.notice'
|
||||
);
|
||||
const supportsBody =
|
||||
variantId.startsWith('intro.') || variantId.startsWith('booking.') ||
|
||||
variantId === 'inquiry.cta' || variantId === 'exhibition.notice';
|
||||
const supportsDescription = !['rooms', 'rules', 'local'].includes(section.type);
|
||||
const supportsBody = ['intro', 'booking', 'inquiry'].includes(section.type);
|
||||
|
||||
return (
|
||||
<div className="flex-1 space-y-4 overflow-y-auto p-3.5">
|
||||
@@ -171,12 +161,7 @@ function ContentTab() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 붙여넣기 아이템의 JSON 입력.
|
||||
*
|
||||
* ★ 원문을 그대로 저장한다. 깨진 JSON 도 담아 두고, 왜 깨졌는지만 아래에 말한다 —
|
||||
* 저장을 막으면 사장님은 고칠 기회 없이 쓰던 걸 잃는다.
|
||||
*/
|
||||
/** 붙여넣기 아이템의 JSON 입력. */
|
||||
function SectionDataPanel({sectionId, sectionType}: {sectionId: string; sectionType: string}) {
|
||||
const spec = dataSpecFor(sectionType);
|
||||
const sections = useBuilderStore((s) => s.sections);
|
||||
@@ -187,12 +172,7 @@ function SectionDataPanel({sectionId, sectionType}: {sectionId: string; sectionT
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [showPrompt, setShowPrompt] = useState(false);
|
||||
|
||||
/**
|
||||
* 직접 입력 ↔ JSON.
|
||||
*
|
||||
* ★ 둘은 같은 값(`section.data`)의 두 얼굴이라 어느 쪽으로 고쳐도 다른 쪽이 따라온다.
|
||||
* 기본은 **직접 입력**이다 — JSON 을 먼저 보여 주면 대부분의 사장님이 거기서 멈춘다.
|
||||
*/
|
||||
/** 직접 입력 ↔ JSON. */
|
||||
const [mode, setMode] = useState<'form' | 'json'>('form');
|
||||
const section = sections.find((item) => item.id === sectionId);
|
||||
if (!spec || !section) return null;
|
||||
@@ -201,7 +181,7 @@ function SectionDataPanel({sectionId, sectionType}: {sectionId: string; sectionT
|
||||
const parsed = parseSectionData(sectionType, raw);
|
||||
const tooLong = raw.length > SECTION_DATA_MAX_CHARS;
|
||||
|
||||
// 상호·주소가 이미 박혀 있는 프롬프트. 사장님이 빈칸을 채울 일이 없어야 한다.
|
||||
// 상호·주소가 이미 박혀 있는 프롬프트.
|
||||
const promptText = buildPrompt(spec, {
|
||||
storeName,
|
||||
location,
|
||||
@@ -435,8 +415,7 @@ function InfoTab() {
|
||||
const [newLabel, setNewLabel] = useState('');
|
||||
const [newValue, setNewValue] = useState('');
|
||||
const placeId = useBuilderStore((s) => s.placeId);
|
||||
// ★ 셀렉터 안에서 새 배열을 만들지 않는다(스토어 상단 주의사항) — state 의 배열을 그대로 받아
|
||||
// 여기서 includes 로 좁힌다. 셀렉터가 매번 새 배열을 돌려주면 무한 렌더로 죽는다.
|
||||
// 셀렉터 안에서 새 배열을 만들지 않는다(스토어 상단 주의사항) — state 의 배열을 그대로 받아 여기서 includes 로 좁힌다.
|
||||
const savingFieldIds = useBuilderStore((s) => s.savingFieldIds);
|
||||
|
||||
return (
|
||||
@@ -521,9 +500,7 @@ function InfoTab() {
|
||||
기록되어, 이후 자동 수집이 덮어쓰지 않습니다.
|
||||
</p>
|
||||
|
||||
{/* ★ 재수집을 [정보] 탭 아래에 둔다. 에디터에서 "이 값이 옛날 값인데"를 깨닫는 자리가
|
||||
바로 여기라, 다시 가져오는 버튼도 같은 자리에 있어야 찾는다.
|
||||
데모(placeId 없음)에서는 패널이 스스로 사라진다. */}
|
||||
{/* 재수집을 [정보] 탭 아래에 둔다. */}
|
||||
<RecollectPanel placeId={placeId} />
|
||||
<PasteFactsPanel placeId={placeId} />
|
||||
</div>
|
||||
|
||||
@@ -1,50 +1,25 @@
|
||||
/**
|
||||
* [디자인] 탭 — 고른 섹션의 레이아웃 배리에이션을 바꾸는 자리.
|
||||
*
|
||||
* 사장님은 코드 이름이 아니라 모양으로 고른다. 그래서 카드마다 와이어프레임을 붙이고,
|
||||
* "언제 이걸 고르면 좋은지"를 한 줄로 적는다.
|
||||
*/
|
||||
import {
|
||||
Check,
|
||||
ChevronDown,
|
||||
LayoutTemplate,
|
||||
MousePointerClick,
|
||||
Palette,
|
||||
RotateCcw,
|
||||
Shapes,
|
||||
} from 'lucide-react';
|
||||
import {Check, ChevronDown, LayoutTemplate, Palette} from 'lucide-react';
|
||||
import {INDUSTRY_CONFIGS} from '@/data/industryData';
|
||||
import {queueSiteTemplateSave} from '@/features/publish/siteTemplate';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {useBuilderStore} from '@/stores/builder';
|
||||
import {COLOR_PALETTE_PRESETS} from './colorPalettes';
|
||||
import {TemplatePreview} from './TemplatePreview';
|
||||
import {resolveVariant, variantsFor} from './canvas/registry';
|
||||
import {VariantThumb} from './canvas/thumbs';
|
||||
|
||||
/**
|
||||
* 접히는 묶음.
|
||||
*
|
||||
* ★ [디자인] 탭은 290px 한 칸이다. 여기에 템플릿 미리보기 셋 + 팔레트 열두 칸 +
|
||||
* 이 섹션의 배리에이션이 세로로 쌓이면 스크롤이 세 화면을 넘고, 정작 방금 고른 섹션의
|
||||
* 배리에이션이 맨 아래로 밀린다. 큰 것(템플릿·색)은 접어 두고 필요할 때 편다.
|
||||
* ★ `<details>` 다 — 상태를 리액트로 들면 탭을 오갈 때마다 접힘이 초기화된다.
|
||||
*/
|
||||
// <details>라 탭을 오가도 접힘 상태가 남는다.
|
||||
function Group({
|
||||
title,
|
||||
icon: Icon,
|
||||
count,
|
||||
open,
|
||||
children,
|
||||
}: {
|
||||
title: string;
|
||||
icon: typeof Palette;
|
||||
count?: string;
|
||||
open?: boolean;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<details open={open} className="group border-b border-border pb-3">
|
||||
<details open className="group border-b border-border pb-3">
|
||||
<summary className="flex cursor-pointer list-none items-center gap-1.5 py-1 text-xs font-bold marker:content-none [&::-webkit-details-marker]:hidden">
|
||||
<Icon className="size-3.5" />
|
||||
<span>{title}</span>
|
||||
@@ -56,41 +31,27 @@ function Group({
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 고르기.
|
||||
*
|
||||
* ★ 이 자리가 없었다. 템플릿은 온보딩 4단계에서 한 번 고르면 끝이었고, 에디터의 [디자인] 탭에는
|
||||
* 팔레트와 섹션 배리에이션만 있었다 — 사장님은 **디자인을 바꾸러 들어와서 디자인을 못 바꿨다.**
|
||||
* 스토어의 `selectTemplate` 과 서버 저장(`queueSiteTemplateSave`)은 처음부터 있었고 UI 만 없었다.
|
||||
* ★ 미리보기는 위저드와 **같은 컴포넌트**다(TemplatePreview). 두 벌로 그리면 고를 때 본 것과
|
||||
* 에디터에서 본 것이 갈린다.
|
||||
*/
|
||||
function TemplatePicker({open}: {open?: boolean}) {
|
||||
function TemplatePicker() {
|
||||
const industry = useBuilderStore((s) => s.industry);
|
||||
const templateId = useBuilderStore((s) => s.templateId);
|
||||
const placeId = useBuilderStore((s) => s.placeId);
|
||||
const selectTemplate = useBuilderStore((s) => s.selectTemplate);
|
||||
const templates = INDUSTRY_CONFIGS[industry].templates;
|
||||
/**
|
||||
* ★ 저장된 templateId 가 지금 목록에 **없을 수 있다.** 실제로 있었다 —
|
||||
* `stay-warm-wood` 처럼 예전 이름이 sites.template_id 에 남아 있으면
|
||||
* `resolveTemplate` 은 말없이 첫 템플릿으로 떨어지는데, 이 목록에서는 아무것도
|
||||
* 선택돼 보이지 않아 "고를 수 없는 화면"이 된다. 떨어지는 자리를 여기서도 같게 본다.
|
||||
*/
|
||||
const activeId = templates.some((t) => t.id === templateId) ? templateId : templates[0].id;
|
||||
|
||||
return (
|
||||
<Group title="템플릿" icon={LayoutTemplate} count={`${templates.length}종`} open={open}>
|
||||
<Group title="템플릿" icon={LayoutTemplate} count={`${templates.length}종`}>
|
||||
<p className="rounded-md bg-muted/60 px-2 py-1.5 text-[10px] leading-relaxed text-muted-foreground">
|
||||
템플릿을 바꾸면 이전 템플릿이 켜 둔 섹션이 꺼질 수 있습니다. 내용은 지워지지 않고, 섹션 목록에서 다시 켤 수 있습니다.
|
||||
</p>
|
||||
<div className="space-y-2">
|
||||
{templates.map((template) => {
|
||||
const isActive = activeId === template.id;
|
||||
const isActive = templateId === template.id;
|
||||
return (
|
||||
<button
|
||||
key={template.id}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
selectTemplate(template.id);
|
||||
// 고른 순간 서버에도 남긴다 — 저장 안 하면 새로고침 한 번에 되돌아간다.
|
||||
queueSiteTemplateSave(placeId, template.id);
|
||||
}}
|
||||
aria-pressed={isActive}
|
||||
@@ -103,12 +64,9 @@ function TemplatePicker({open}: {open?: boolean}) {
|
||||
>
|
||||
<span className="flex items-center gap-1.5">
|
||||
<span className="text-[11px] font-bold">{template.name}</span>
|
||||
<span className="truncate text-[10px] text-muted-foreground">
|
||||
{template.toneLabel} · {template.fontStyle}
|
||||
</span>
|
||||
<span className="truncate text-[10px] text-muted-foreground">{template.tag}</span>
|
||||
{isActive && <Check className="ml-auto size-3 shrink-0 text-primary" />}
|
||||
</span>
|
||||
{/* 미리보기는 그 템플릿의 서체·모서리·그림자로 실제로 그린다 — 색 동그라미로는 뭘 고르는지 모른다. */}
|
||||
<TemplatePreview template={template} />
|
||||
</button>
|
||||
);
|
||||
@@ -118,14 +76,14 @@ function TemplatePicker({open}: {open?: boolean}) {
|
||||
);
|
||||
}
|
||||
|
||||
function ColorPalettePicker({open}: {open?: boolean}) {
|
||||
function ColorPalettePicker() {
|
||||
const industry = useBuilderStore((s) => s.industry);
|
||||
const selectedId = useBuilderStore((s) => s.colorPaletteId);
|
||||
const selectColorPalette = useBuilderStore((s) => s.selectColorPalette);
|
||||
const palettes = COLOR_PALETTE_PRESETS.filter((palette) => palette.industry === industry);
|
||||
|
||||
return (
|
||||
<Group title="컬러 시스템" icon={Palette} count={`${palettes.length}종`} open={open}>
|
||||
<Group title="컬러 시스템" icon={Palette} count={`${palettes.length}종`}>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{palettes.map((palette) => {
|
||||
const isActive = selectedId === palette.id;
|
||||
@@ -167,114 +125,10 @@ function ColorPalettePicker({open}: {open?: boolean}) {
|
||||
}
|
||||
|
||||
export function SectionDesignPanel() {
|
||||
const industry = useBuilderStore((s) => s.industry);
|
||||
const sections = useBuilderStore((s) => s.sections);
|
||||
const selectedSectionId = useBuilderStore((s) => s.selectedSectionId);
|
||||
const setSectionVariant = useBuilderStore((s) => s.setSectionVariant);
|
||||
const resetSectionVariants = useBuilderStore((s) => s.resetSectionVariants);
|
||||
|
||||
const section = sections.find((s) => s.id === selectedSectionId);
|
||||
const variants = section ? variantsFor(section.type, industry) : [];
|
||||
const current = section ? resolveVariant(section, industry) : undefined;
|
||||
|
||||
if (!section) {
|
||||
return (
|
||||
<div className="flex-1 space-y-4 overflow-y-auto p-3.5">
|
||||
<TemplatePicker open />
|
||||
<ColorPalettePicker open />
|
||||
<div className="flex flex-col items-center justify-center gap-2 py-8 text-center">
|
||||
<span className="flex size-9 items-center justify-center rounded-full bg-muted text-muted-foreground">
|
||||
<MousePointerClick className="size-4" />
|
||||
</span>
|
||||
<p className="text-xs font-semibold">섹션을 먼저 고르세요</p>
|
||||
<p className="text-[11px] leading-relaxed text-muted-foreground">
|
||||
왼쪽 목록이나 미리보기에서 섹션을 누르면
|
||||
<br />그 섹션의 레이아웃을 바꿀 수 있습니다.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex-1 space-y-3 overflow-y-auto p-3.5">
|
||||
{/* 큰 것부터 좁혀 간다 — 템플릿(전체) → 팔레트(색) → 이 섹션의 레이아웃. */}
|
||||
<div className="flex-1 space-y-4 overflow-y-auto p-3.5">
|
||||
<TemplatePicker />
|
||||
<ColorPalettePicker />
|
||||
<div className="flex items-center justify-between border-b border-border pb-2">
|
||||
<span className="flex min-w-0 items-center gap-1.5 text-xs font-bold">
|
||||
<Shapes className="size-3.5 shrink-0" />
|
||||
<span className="truncate">{section.name}</span>
|
||||
</span>
|
||||
<span className="shrink-0 font-mono text-[10px] text-muted-foreground">
|
||||
{variants.length}종
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{variants.length === 0 ? (
|
||||
<p className="rounded-md border border-dashed border-border bg-muted/40 p-3 text-center text-[11px] leading-relaxed text-muted-foreground">
|
||||
이 섹션은 아직 고를 수 있는 레이아웃이 하나뿐입니다.
|
||||
</p>
|
||||
) : (
|
||||
<ul className="space-y-2">
|
||||
{variants.map((variant) => {
|
||||
const isActive = current?.id === variant.id;
|
||||
|
||||
return (
|
||||
<li key={variant.id}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setSectionVariant(section.id, variant.id)}
|
||||
aria-pressed={isActive}
|
||||
className={cn(
|
||||
'flex w-full cursor-pointer items-start gap-2.5 rounded-lg border p-2.5 text-left transition-all',
|
||||
isActive
|
||||
? 'border-primary bg-primary/8 ring-1 ring-primary'
|
||||
: 'border-border bg-card hover:bg-muted/60',
|
||||
)}
|
||||
>
|
||||
<VariantThumb
|
||||
thumb={variant.thumb}
|
||||
className="h-[38px] w-[54px] shrink-0 rounded border border-border bg-white"
|
||||
/>
|
||||
|
||||
<div className="min-w-0 flex-1 space-y-0.5">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="truncate text-xs font-bold">{variant.name}</span>
|
||||
{variant.isDefault && (
|
||||
<span className="shrink-0 rounded bg-muted px-1 py-px text-[9px] font-medium text-muted-foreground">
|
||||
기본
|
||||
</span>
|
||||
)}
|
||||
{isActive && <Check className="ml-auto size-3.5 shrink-0 text-primary" />}
|
||||
</div>
|
||||
<p className="text-[11px] leading-relaxed text-muted-foreground">
|
||||
{variant.description}
|
||||
</p>
|
||||
</div>
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
<div className="space-y-2 border-t border-border pt-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={resetSectionVariants}
|
||||
className="flex w-full cursor-pointer items-center justify-center gap-1.5 rounded-md border border-border py-2 text-[11px] font-semibold text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
||||
>
|
||||
<RotateCcw className="size-3" />
|
||||
<span>모든 섹션을 기본 레이아웃으로</span>
|
||||
</button>
|
||||
|
||||
<p className="text-[11px] leading-relaxed text-muted-foreground">
|
||||
레이아웃만 바뀝니다 —{' '}
|
||||
<strong className="text-foreground">입력한 내용과 사진, 섹션 순서는 그대로</strong>{' '}
|
||||
유지됩니다.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -8,13 +8,12 @@ import {
|
||||
import {CSS} from '@dnd-kit/utilities';
|
||||
import {useState} from 'react';
|
||||
import type {SectionItem} from '@o2o/shared';
|
||||
import {Check, GripVertical, Layers, Lock, Plus, Shapes, Trash2, X} from 'lucide-react';
|
||||
import {Check, GripVertical, Layers, Lock, Plus, Trash2, X} from 'lucide-react';
|
||||
import {Switch} from '@/components/ui/switch';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {useBuilderStore} from '@/stores/builder';
|
||||
import {ADDABLE_SECTIONS, addableSection} from './canvas/addable';
|
||||
import {resolveVariant} from './canvas/registry';
|
||||
import {VariantThumb} from './canvas/thumbs';
|
||||
import {ADDABLE_SECTIONS, addableSection} from './sections/addable';
|
||||
import {VariantThumb} from './sections/thumbs';
|
||||
|
||||
interface SectionListPanelProps {
|
||||
onAfterSelect?: () => void;
|
||||
@@ -26,13 +25,11 @@ interface SortableSectionProps extends SectionListPanelProps {
|
||||
}
|
||||
|
||||
function SortableSection({section, index, onAfterSelect}: SortableSectionProps) {
|
||||
const industry = useBuilderStore((s) => s.industry);
|
||||
const setRightTab = useBuilderStore((s) => s.setRightTab);
|
||||
const isSelected = useBuilderStore((s) => s.selectedSectionId === section.id);
|
||||
const selectSection = useBuilderStore((s) => s.selectSection);
|
||||
const toggleSection = useBuilderStore((s) => s.toggleSection);
|
||||
const removeSection = useBuilderStore((s) => s.removeSection);
|
||||
const variant = resolveVariant(section, industry);
|
||||
// 업종 기본 섹션은 스위치로 끄는 것이지 빼는 게 아니다 — 뺄 수 있는 건 나중에 넣은 것뿐이다.
|
||||
const canRemove = Boolean(addableSection(section.type));
|
||||
const {attributes, listeners, setNodeRef, transform, transition, isDragging} = useSortable({
|
||||
@@ -45,8 +42,7 @@ function SortableSection({section, index, onAfterSelect}: SortableSectionProps)
|
||||
onAfterSelect?.();
|
||||
if (!section.isEnabled) return;
|
||||
|
||||
// 좁은 화면에서는 onAfterSelect가 캔버스 탭을 먼저 연다. 다음 페인트가 끝난 뒤
|
||||
// 실제 섹션으로 이동해야 display:none 상태의 위치를 잘못 읽지 않는다.
|
||||
// 좁은 화면에서는 onAfterSelect가 캔버스 탭을 먼저 연다.
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
document
|
||||
@@ -102,32 +98,6 @@ function SortableSection({section, index, onAfterSelect}: SortableSectionProps)
|
||||
{section.name}
|
||||
</span>
|
||||
|
||||
{variant && (
|
||||
<span
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
title={`${variant.name} — 눌러서 레이아웃 바꾸기`}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
selectSection(section.id);
|
||||
setRightTab('design');
|
||||
onAfterSelect?.();
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== 'Enter' && event.key !== ' ') return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
selectSection(section.id);
|
||||
setRightTab('design');
|
||||
onAfterSelect?.();
|
||||
}}
|
||||
className="flex cursor-pointer items-center gap-0.5 truncate text-[9px] font-normal text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<Shapes className="size-2.5 shrink-0" />
|
||||
<span className="truncate">{variant.name}</span>
|
||||
</span>
|
||||
)}
|
||||
|
||||
{section.isLocked && (
|
||||
<span className="flex items-center gap-0.5 text-[9px] font-normal text-muted-foreground">
|
||||
<Lock className="size-2.5" /> 필수 고정
|
||||
|
||||
@@ -1,42 +1,21 @@
|
||||
/**
|
||||
* 미리보기 — 발행본을 **iframe 으로** 띄운다.
|
||||
* 미리보기 — 발행본을 iframe으로 띄운다. iframe이 여는 주소는 `/preview?placeId=…`
|
||||
* (site/scripts/prerender.writePreviewShell이 굽는 CSR 셸, 발행본 앱이 그 안에서 그대로 돈다).
|
||||
* 같은 오리진이라 토큰(localStorage)을 iframe이 그대로 읽는다.
|
||||
*
|
||||
* ★ 왜 iframe 인가 (2026-09-09)
|
||||
* 처음엔 발행본 컴포넌트를 빌더 안에 직접 그렸다. 렌더러도 payload 도 토큰도 같게 맞췄고
|
||||
* 섹션 15개의 계산 스타일(색·서체·여백)까지 동일해졌는데, **레이아웃 폭이 어긋났다.**
|
||||
* 미디어 쿼리는 창 폭을 보는데 미리보기의 실제 사이트 폭은 그 안의 프레임이기 때문이다.
|
||||
* 실측(1400px 창 · 1024px 프레임, Playwright):
|
||||
* festival 2560px → 6027px · guide 1168 → 2168 · location 586 → 1135
|
||||
* 내용(글자 수)은 완전히 같은데 그리드 컬럼 수만 달라 두 배씩 길어졌다. 전체 픽셀 차이 89%.
|
||||
* "같은 렌더러를 쓴다" 만으로는 안 되고 **뷰포트가 같아야** 한다.
|
||||
*
|
||||
* iframe 은 자체 뷰포트를 가진다 — 폭을 390/768/1024 로 주면 발행본이 그 폭에서 보는 것과
|
||||
* 같은 미디어 쿼리가 걸린다. 해상도 전환도 그제서야 진짜가 된다.
|
||||
*
|
||||
* ★ iframe 이 여는 것은 `/preview?placeId=…` — 프리렌더가 굽는 CSR 셸이다
|
||||
* (`site/scripts/prerender.writePreviewShell`). 그 안에서 발행본 앱이 그대로 돈다.
|
||||
* ★ 같은 오리진이라 토큰(localStorage)을 iframe 이 그대로 읽는다. 따로 넘기지 않는다.
|
||||
* iframe으로 띄우는 이유: 빌더 안에 직접 그렸을 때 렌더러·payload·토큰을 다 맞춰도
|
||||
* 레이아웃 폭이 어긋났다 — 미디어쿼리는 창 폭을 보는데 실제 사이트 폭은 프레임 폭이라서다.
|
||||
* iframe은 자체 뷰포트를 가지므로 폭을 390/768/1024로 주면 발행본과 같은 미디어쿼리가 걸린다.
|
||||
*/
|
||||
import {useCallback, useEffect, useRef, useState} from 'react';
|
||||
import type {ViewportMode} from '@o2o/shared';
|
||||
import {LoaderCircle} from 'lucide-react';
|
||||
import {onSiteThemeSaved} from '@/features/publish/siteTheme';
|
||||
|
||||
/**
|
||||
* 미리보기가 그려지기를 기다리는 상한. 넘으면 로딩 표시를 걷고 iframe 을 그대로 보여준다.
|
||||
*
|
||||
* ★ 영영 안 걷히는 로딩바는 안 띄우느니만 못하다 — 구 번들이 올라가 있어 `o2o:preview-painted`
|
||||
* 를 안 보내는 동안에도 편집은 돼야 한다(발행본 번들은 재발행 전까지 옛것일 수 있다).
|
||||
*/
|
||||
// 넘으면 로딩 표시를 걷고 iframe을 그대로 보여준다(구 번들이라 painted 신호가 안 올 수 있음).
|
||||
const PAINT_TIMEOUT_MS = 12000;
|
||||
|
||||
/**
|
||||
* 각 해상도에서 iframe 에 줄 **크기**. 발행본이 그 기기에서 보는 것과 같아야 한다.
|
||||
*
|
||||
* ★ 높이도 준다. 폭만 맞추면 `vh` 를 쓰는 자리가 어긋난다 — 히어로가
|
||||
* `clamp(24rem, 62vh, 36rem)` 이라(`HeroSection`), iframe 이 낮으면 하한 384px 에 걸린다.
|
||||
* 실측: 발행본 576px ↔ 미리보기 384px. 지연 로딩 이미지도 화면에 덜 들어와 적게 뜬다.
|
||||
*/
|
||||
// 해상도별 iframe 크기. 높이도 줘야 vh 쓰는 자리(히어로 등)가 발행본과 맞는다.
|
||||
const FRAME_SIZE: Record<ViewportMode, {w: number; h: number}> = {
|
||||
pc: {w: 1024, h: 800},
|
||||
tablet: {w: 768, h: 1024},
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
|
||||
/**
|
||||
* 템플릿 미리보기 — 그 템플릿의 서체·모서리·테두리·그림자로 **실제로** 그린다.
|
||||
*
|
||||
* ★ 예전에는 회색 막대 세 줄과 색 동그라미였다. 다섯 템플릿이 전부 같은 그림이라
|
||||
* 무엇을 고르는지 알 수 없었고, 그래서 아무거나 골랐다.
|
||||
*/
|
||||
/** 템플릿 미리보기 — 그 템플릿의 서체·모서리·테두리·그림자로 **실제로** 그린다. */
|
||||
export function TemplatePreview({template}: {template: TemplateItem}) {
|
||||
const {look, colors} = template;
|
||||
|
||||
@@ -39,7 +34,7 @@ export function TemplatePreview({template}: {template: TemplateItem}) {
|
||||
className="mt-1.5 text-[10px] leading-relaxed"
|
||||
style={{fontFamily: look.fontBody, color: colors.secondary}}
|
||||
>
|
||||
제목은 {template.fontStyle}, 본문은 이 서체로 나갑니다.
|
||||
제목과 본문이 이 서체로 나갑니다.
|
||||
</p>
|
||||
|
||||
<div
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
import React from 'react';
|
||||
|
||||
export interface SlateTextNode {
|
||||
text: string;
|
||||
bold?: boolean;
|
||||
italic?: boolean;
|
||||
underline?: boolean;
|
||||
code?: boolean;
|
||||
}
|
||||
|
||||
export interface SlateElementNode {
|
||||
type?: string;
|
||||
speaker?: string;
|
||||
role?: 'buyer' | 'seller' | 'host' | 'guest' | 'ai' | 'customer';
|
||||
time?: string;
|
||||
children: (SlateElementNode | SlateTextNode)[];
|
||||
}
|
||||
|
||||
interface SlateScriptRendererProps {
|
||||
nodes?: (SlateElementNode | SlateTextNode)[];
|
||||
primaryColor?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const SlateScriptRenderer: React.FC<SlateScriptRendererProps> = ({
|
||||
nodes,
|
||||
primaryColor = '#18181b',
|
||||
className = '',
|
||||
}) => {
|
||||
if (!nodes || nodes.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const renderTextNode = (node: SlateTextNode, idx: number) => {
|
||||
let content: React.ReactNode = node.text;
|
||||
if (node.bold) content = <strong key={idx}>{content}</strong>;
|
||||
if (node.italic) content = <em key={idx}>{content}</em>;
|
||||
if (node.underline) content = <u key={idx}>{content}</u>;
|
||||
if (node.code) {
|
||||
content = (
|
||||
<code key={idx} className="bg-slate-100 px-1 py-0.5 rounded text-[11px] font-mono">
|
||||
{content}
|
||||
</code>
|
||||
);
|
||||
}
|
||||
return <React.Fragment key={idx}>{content}</React.Fragment>;
|
||||
};
|
||||
|
||||
const renderElement = (node: SlateElementNode, idx: number) => {
|
||||
switch (node.type) {
|
||||
case 'chat-dialog':
|
||||
case 'dialog':
|
||||
case 'negotiation': {
|
||||
const isHost = node.role === 'seller' || node.role === 'host' || node.role === 'ai';
|
||||
return (
|
||||
<div
|
||||
key={idx}
|
||||
className={`flex items-start gap-3 my-2.5 ${isHost ? 'flex-row-reverse' : 'flex-row'}`}
|
||||
>
|
||||
{/* Avatar */}
|
||||
<div
|
||||
className={`w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0 shadow-2xs ${
|
||||
isHost ? 'bg-slate-900 text-white' : 'bg-slate-200 text-slate-700'
|
||||
}`}
|
||||
>
|
||||
{node.speaker ? node.speaker.slice(0, 1) : isHost ? '호' : '손'}
|
||||
</div>
|
||||
|
||||
{/* Bubble */}
|
||||
<div className={`max-w-[75%] space-y-1 ${isHost ? 'text-right' : 'text-left'}`}>
|
||||
<div className="flex items-center gap-1.5 text-[11px] text-slate-400">
|
||||
<span className="font-semibold text-slate-700">{node.speaker || (isHost ? '호스트' : '게스트')}</span>
|
||||
{node.time && <span>· {node.time}</span>}
|
||||
</div>
|
||||
<div
|
||||
className={`px-3.5 py-2.5 rounded-2xl text-xs leading-relaxed inline-block text-left ${
|
||||
isHost
|
||||
? 'bg-slate-900 text-white rounded-tr-xs shadow-2xs'
|
||||
: 'bg-slate-100 text-slate-800 rounded-tl-xs'
|
||||
}`}
|
||||
>
|
||||
{node.children.map((child, cIdx) =>
|
||||
'text' in child ? renderTextNode(child, cIdx) : renderElement(child, cIdx)
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
case 'heading-two':
|
||||
case 'h2':
|
||||
return (
|
||||
<h3 key={idx} className="text-base font-bold text-slate-900 mt-4 mb-2">
|
||||
{node.children.map((child, cIdx) =>
|
||||
'text' in child ? renderTextNode(child, cIdx) : renderElement(child, cIdx)
|
||||
)}
|
||||
</h3>
|
||||
);
|
||||
|
||||
case 'quote':
|
||||
case 'blockquote':
|
||||
return (
|
||||
<blockquote
|
||||
key={idx}
|
||||
className="border-l-2 pl-3 my-3 text-xs italic text-slate-600 border-slate-400"
|
||||
>
|
||||
{node.children.map((child, cIdx) =>
|
||||
'text' in child ? renderTextNode(child, cIdx) : renderElement(child, cIdx)
|
||||
)}
|
||||
</blockquote>
|
||||
);
|
||||
|
||||
case 'callout':
|
||||
case 'info-box':
|
||||
return (
|
||||
<div
|
||||
key={idx}
|
||||
className="p-3.5 my-3 bg-slate-50 border border-slate-200 rounded-xl text-xs text-slate-700 leading-relaxed"
|
||||
>
|
||||
{node.children.map((child, cIdx) =>
|
||||
'text' in child ? renderTextNode(child, cIdx) : renderElement(child, cIdx)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
default:
|
||||
return (
|
||||
<p key={idx} className="text-xs text-slate-600 leading-relaxed my-1.5">
|
||||
{node.children.map((child, cIdx) =>
|
||||
'text' in child ? renderTextNode(child, cIdx) : renderElement(child, cIdx)
|
||||
)}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`slate-editor-script space-y-1 ${className}`}>
|
||||
{nodes.map((node, idx) =>
|
||||
'text' in node ? renderTextNode(node, idx) : renderElement(node, idx)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* 나중에 넣을 수 있는 섹션 — [+ 섹션 추가] 가 고르는 목록.
|
||||
*
|
||||
* 업종 시드(industryData)는 "처음부터 있는 것"이고 여기는 "필요하면 넣는 것"이다.
|
||||
* 붙여넣기 아이템은 내용이 없으면 빈 섹션이라, 시드에 박아 두면 아무도 안 쓰는 칸이 늘 붙어 있다.
|
||||
*/
|
||||
import type {SectionItem} from '@o2o/shared';
|
||||
import {SECTION_DATA_SPEC} from './dataSpec';
|
||||
import {defaultVariant} from './registry';
|
||||
import type {ThumbKey} from './types';
|
||||
|
||||
export interface AddableSection {
|
||||
type: string;
|
||||
name: string;
|
||||
description: string;
|
||||
thumb: ThumbKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 추가할 수 있는 섹션 목록.
|
||||
*
|
||||
* ★ dataSpec 이 단일 출처다 — 아이템을 하나 더 만들면 여기에도 자동으로 나타난다.
|
||||
* 목록을 따로 들면 아이템을 추가하고 이 표를 잊어 "만들었는데 고를 수가 없는" 상태가 된다.
|
||||
*/
|
||||
export const ADDABLE_SECTIONS: AddableSection[] = Object.values(SECTION_DATA_SPEC).map((spec) => {
|
||||
const variant = defaultVariant(spec.kind);
|
||||
return {
|
||||
type: spec.kind,
|
||||
name: spec.label,
|
||||
description: variant?.description ?? '',
|
||||
thumb: variant?.thumb ?? 'cards',
|
||||
};
|
||||
});
|
||||
|
||||
export function addableSection(type: string): AddableSection | undefined {
|
||||
return ADDABLE_SECTIONS.find((item) => item.type === type);
|
||||
}
|
||||
|
||||
/** 목록에 새로 넣을 섹션 한 줄. id 는 타입과 같다 — 같은 아이템을 두 번 넣지 않는다. */
|
||||
export function newSectionOf(type: string): SectionItem | undefined {
|
||||
const addable = addableSection(type);
|
||||
if (!addable) return undefined;
|
||||
return {
|
||||
id: type,
|
||||
type,
|
||||
name: addable.name,
|
||||
description: addable.description,
|
||||
isLocked: false,
|
||||
isEnabled: true,
|
||||
};
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
import {useState} from 'react';
|
||||
import {Check, Copy} from 'lucide-react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
/**
|
||||
* 주소 + 복사 + 지도 앱 링크.
|
||||
*
|
||||
* "오시는 길" 배리에이션들이 공통으로 쓰는 덩어리. 복사 성공 표시까지 여기 들어 있어서
|
||||
* 레이아웃을 바꿔도 사장님이 확인하는 동작은 똑같이 남는다.
|
||||
*/
|
||||
export function AddressCard({
|
||||
address,
|
||||
searchName,
|
||||
variant = 'card',
|
||||
colors,
|
||||
className,
|
||||
}: {
|
||||
address: string;
|
||||
/** 네이버 지도에서 찾을 이름. 보통 상호. */
|
||||
searchName: string;
|
||||
variant?: 'card' | 'bar';
|
||||
/**
|
||||
* 템플릿 색 토큰. 주소 글자만 text 를 따른다.
|
||||
*
|
||||
* ★ 지도 버튼의 초록·노랑은 네이버/카카오의 색이라 토큰으로 바꾸지 않는다 —
|
||||
* 손님이 "그 버튼"으로 알아보는 색이다.
|
||||
*/
|
||||
colors?: TemplateItem['colors'];
|
||||
className?: string;
|
||||
}) {
|
||||
const [copied, setCopied] = useState(false);
|
||||
const addressStyle = colors ? {color: colors.text} : undefined;
|
||||
|
||||
const handleCopy = (e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
navigator.clipboard.writeText(address);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
};
|
||||
|
||||
const links = (
|
||||
<div className="flex items-center gap-2">
|
||||
<a
|
||||
href={`https://map.naver.com/v5/search/${encodeURIComponent(searchName)}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="rounded-lg bg-emerald-600 px-3.5 py-2 text-xs font-semibold text-white shadow-2xs transition-colors hover:bg-emerald-700"
|
||||
>
|
||||
네이버 지도 길찾기
|
||||
</a>
|
||||
<a
|
||||
href={`https://map.kakao.com/link/search/${encodeURIComponent(address)}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="rounded-lg bg-amber-400 px-3.5 py-2 text-xs font-semibold text-stone-950 shadow-2xs transition-colors hover:bg-amber-500"
|
||||
>
|
||||
카카오맵
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (variant === 'bar') {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col items-start justify-between gap-3 rounded-xl border border-stone-200/80 bg-white px-4 py-3 sm:flex-row sm:items-center',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<span className="text-xs font-bold text-stone-900 sm:text-sm" style={addressStyle}>
|
||||
{address}
|
||||
</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleCopy}
|
||||
className="inline-flex cursor-pointer items-center gap-1 rounded border border-stone-200 bg-white px-2.5 py-1 text-xs font-medium text-stone-700 shadow-2xs hover:bg-stone-100"
|
||||
>
|
||||
{copied ? <Check className="size-3.5 text-emerald-600" /> : <Copy className="size-3.5" />}
|
||||
<span>{copied ? '복사완료' : '복사'}</span>
|
||||
</button>
|
||||
{links}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col justify-between gap-4 rounded-xl border border-stone-200/80 bg-stone-50/70 p-5 md:flex-row md:items-center',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className="space-y-1">
|
||||
<span className="text-[11px] font-bold uppercase text-stone-400">도로명 주소</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<strong className="text-sm font-bold text-stone-900 sm:text-base" style={addressStyle}>
|
||||
{address}
|
||||
</strong>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleCopy}
|
||||
className="inline-flex cursor-pointer items-center gap-1 rounded border border-stone-200 bg-white px-2.5 py-1 text-xs font-medium text-stone-700 shadow-2xs hover:bg-stone-100"
|
||||
>
|
||||
{copied ? <Check className="size-3.5 text-emerald-600" /> : <Copy className="size-3.5" />}
|
||||
<span>{copied ? '복사완료' : '복사'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{links}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/**
|
||||
* 캔버스 안의 행동 유도 링크.
|
||||
*
|
||||
* 캔버스는 클릭이 곧 "섹션 선택"이라, 링크는 반드시 stopPropagation 을 해야 한다.
|
||||
* 그 한 줄을 배리에이션마다 손으로 쓰면 언젠가 빠진다 — 여기 한 곳에 가둔다.
|
||||
*/
|
||||
import type {ReactNode} from 'react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
export type CtaStyle = 'solid' | 'outline' | 'pill' | 'ghost' | 'brand';
|
||||
|
||||
interface CtaLinkProps {
|
||||
href: string;
|
||||
children: ReactNode;
|
||||
variant?: CtaStyle;
|
||||
size?: 'sm' | 'md';
|
||||
/** 템플릿 색 토큰. 넘기면 버튼이 브랜드 색을 따른다. */
|
||||
colors?: TemplateItem['colors'];
|
||||
block?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const BASE =
|
||||
'inline-flex items-center justify-center gap-1.5 font-semibold transition-all cursor-pointer';
|
||||
|
||||
const SIZE = {
|
||||
sm: 'px-3 py-1.5 text-[11px]',
|
||||
md: 'px-5 py-2.5 text-xs',
|
||||
};
|
||||
|
||||
/**
|
||||
* variant 마다 토큰이 닿는 자리가 다르다 — 채운 버튼은 배경, 흰 버튼은 글자색.
|
||||
*
|
||||
* ★ primary 는 이 서비스에서 "흰 글자를 얹는 어두운 색"이라는 계약이다.
|
||||
* 그래서 배경으로 쓸 때는 primary 만 쓴다 — accent 를 배경에 깔면 흰 글자가 뜬다.
|
||||
*/
|
||||
function tokenStyle(variant: CtaStyle, colors?: TemplateItem['colors']) {
|
||||
if (!colors) return undefined;
|
||||
if (variant === 'brand' || variant === 'solid') return {backgroundColor: colors.primary};
|
||||
if (variant === 'pill' || variant === 'outline') return {color: colors.primary};
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function CtaLink({
|
||||
href,
|
||||
children,
|
||||
variant = 'solid',
|
||||
size = 'md',
|
||||
colors,
|
||||
block,
|
||||
className,
|
||||
}: CtaLinkProps) {
|
||||
return (
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
style={tokenStyle(variant, colors)}
|
||||
className={cn(
|
||||
BASE,
|
||||
SIZE[size],
|
||||
block && 'w-full',
|
||||
variant === 'solid' && 'rounded-xl bg-stone-900 text-white shadow-xs hover:bg-stone-800',
|
||||
variant === 'brand' && 'rounded-xl text-white shadow-xs hover:opacity-90',
|
||||
variant === 'outline' &&
|
||||
'rounded-xl border border-stone-300 bg-white text-stone-800 hover:bg-stone-100',
|
||||
variant === 'pill' &&
|
||||
'rounded-full bg-white text-stone-900 shadow-md hover:bg-stone-100',
|
||||
variant === 'ghost' && 'rounded-lg text-stone-500 hover:bg-stone-100 hover:text-stone-900',
|
||||
// 배경을 인라인 스타일로 덮으면 hover 배경 클래스가 안 먹는다 — 투명도로 대신 반응시킨다.
|
||||
variant === 'solid' && colors && 'hover:opacity-90',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import type {ReactNode} from 'react';
|
||||
import {Clock3} from 'lucide-react';
|
||||
|
||||
/**
|
||||
* "아직 준비 중" 한 줄.
|
||||
*
|
||||
* 실사업장은 객실·주변정보·영상 같은 목록이 아직 비어 있다(백엔드에 조회 창구가
|
||||
* 없는 것도 있다). 목록만 조용히 비우면 에디터에서는 섹션이 통째로 사라진 것처럼 보여
|
||||
* 사장님이 "내가 뭘 지웠나" 하고 되돌리려 든다 — 자리는 지키고 비었다는 사실만 말한다.
|
||||
*
|
||||
* 톤은 HiddenFieldsNotice 와 맞춘다: 사장님에게 하는 담백한 상태 보고지 손님용 카피가 아니다.
|
||||
* (다만 저쪽은 "가리는 중"이라 경고색, 이쪽은 "아직 없음"이라 중립색이다.)
|
||||
*/
|
||||
export function EmptyStateNotice({children}: {children: ReactNode}) {
|
||||
return (
|
||||
<div className="flex items-center justify-center gap-2 rounded-xl border border-dashed border-stone-300/80 bg-stone-50/60 px-4 py-6 text-center text-xs text-stone-500">
|
||||
<Clock3 className="size-3.5 shrink-0 text-stone-400" />
|
||||
<span>{children}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import type {LucideIcon} from 'lucide-react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
/**
|
||||
* 아이콘 + 제목 + 한 줄 설명. 주차/충전기/편의시설처럼 "있다/없다"를 알리는 칸.
|
||||
*/
|
||||
export function FeatureCard({
|
||||
icon: Icon,
|
||||
title,
|
||||
description,
|
||||
iconClassName,
|
||||
colors,
|
||||
className,
|
||||
}: {
|
||||
icon: LucideIcon;
|
||||
title: string;
|
||||
description?: string;
|
||||
iconClassName?: string;
|
||||
/** 템플릿 색 토큰. 제목과 아이콘이 브랜드 색을 따른다. */
|
||||
colors?: TemplateItem['colors'];
|
||||
className?: string;
|
||||
}) {
|
||||
// ★ iconClassName 은 "전기차 충전기는 초록" 처럼 뜻이 정해진 색을 넣는 자리다.
|
||||
// 그 위에 토큰을 덮으면 의미가 사라지므로, 지정이 없을 때만 primary 를 쓴다.
|
||||
const iconStyle = colors && !iconClassName ? {color: colors.primary} : undefined;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex items-start gap-3 rounded-xl border border-stone-200/80 bg-stone-50/70 p-4',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<Icon className={cn('size-5 shrink-0 text-stone-800', iconClassName)} style={iconStyle} />
|
||||
<div>
|
||||
<strong
|
||||
className="block text-xs font-bold text-stone-900"
|
||||
style={colors ? {color: colors.text} : undefined}
|
||||
>
|
||||
{title}
|
||||
</strong>
|
||||
{description && <p className="mt-0.5 text-[11px] text-stone-600">{description}</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
import {AlertCircle} from 'lucide-react';
|
||||
|
||||
/**
|
||||
* "미확인 항목 N개 숨김 중" 배지.
|
||||
*
|
||||
* 미검증 값은 캔버스에서 아예 빼되, 빠졌다는 사실은 반드시 보여준다 —
|
||||
* 조용히 사라지면 사장님은 "이미 나가고 있다"고 오해한다.
|
||||
*/
|
||||
export function HiddenFieldsNotice({count}: {count: number}) {
|
||||
if (count <= 0) return null;
|
||||
|
||||
return (
|
||||
<span className="flex items-center gap-1.5 rounded-lg border border-amber-200 bg-amber-50 px-2.5 py-1 text-[11px] text-amber-700">
|
||||
<AlertCircle className="size-3.5 text-amber-600" />
|
||||
<span>미확인 항목 {count}개 숨김 중</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* 기본 정보 한 줄 — 라벨/값 한 쌍을 어떤 모양으로 낼지가 통째로 배리에이션이다.
|
||||
* (표의 한 행 · 카드 한 장 · 문장 속 인라인)
|
||||
*/
|
||||
import {cn} from '@/lib/utils';
|
||||
import type {InfoField, TemplateItem} from '@o2o/shared';
|
||||
|
||||
export type InfoRowStyle = 'row' | 'card' | 'inline';
|
||||
|
||||
export function InfoRow({
|
||||
field,
|
||||
variant = 'row',
|
||||
colors,
|
||||
className,
|
||||
}: {
|
||||
field: InfoField;
|
||||
variant?: InfoRowStyle;
|
||||
/** 템플릿 색 토큰. 값(굵은 글씨)만 text 를 따르고 라벨은 중립 회색으로 남는다. */
|
||||
colors?: TemplateItem['colors'];
|
||||
className?: string;
|
||||
}) {
|
||||
const valueStyle = colors ? {color: colors.text} : undefined;
|
||||
|
||||
if (variant === 'card') {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'space-y-1 rounded-xl border border-stone-200/80 bg-white p-4 shadow-2xs',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<span className="block text-[11px] font-semibold uppercase tracking-wide text-stone-400">
|
||||
{field.label}
|
||||
</span>
|
||||
<span
|
||||
className="block text-xs font-bold leading-relaxed text-stone-900 sm:text-sm"
|
||||
style={valueStyle}
|
||||
>
|
||||
{field.value}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (variant === 'inline') {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
'inline-flex flex-wrap items-baseline gap-1.5 text-xs leading-relaxed',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<span className="font-semibold text-stone-400">{field.label}</span>
|
||||
<span className="font-bold text-stone-900" style={valueStyle}>
|
||||
{field.value}
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col justify-between gap-1 p-4 transition-colors hover:bg-stone-100/50 sm:flex-row sm:items-center sm:gap-4',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<span className="text-xs font-semibold text-stone-500 sm:w-1/3">{field.label}</span>
|
||||
<span
|
||||
className="text-xs font-bold text-stone-900 sm:w-2/3 sm:text-right sm:text-sm"
|
||||
style={valueStyle}
|
||||
>
|
||||
{field.value}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
import {X, ChevronLeft, ChevronRight} from 'lucide-react';
|
||||
import type {TilePhoto} from './PhotoTile';
|
||||
|
||||
/**
|
||||
* 사진 확대 보기. 갤러리 배리에이션 세 개가 전부 이걸 그대로 쓴다 —
|
||||
* 확대 동작까지 배리에이션마다 다르면 사장님이 레이아웃을 바꿀 때마다 조작법을 다시 배운다.
|
||||
*/
|
||||
export function Lightbox({
|
||||
photos,
|
||||
index,
|
||||
onClose,
|
||||
onMove,
|
||||
}: {
|
||||
photos: TilePhoto[];
|
||||
index: number | null;
|
||||
onClose: () => void;
|
||||
onMove?: (next: number) => void;
|
||||
}) {
|
||||
if (index === null || !photos[index]) return null;
|
||||
|
||||
const photo = photos[index];
|
||||
const step = (delta: number) => onMove?.((index + delta + photos.length) % photos.length);
|
||||
|
||||
return (
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onClose();
|
||||
}}
|
||||
className="fixed inset-0 z-50 flex items-center justify-center bg-black/90 p-4 backdrop-blur-md"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
aria-label="닫기"
|
||||
className="absolute right-4 top-4 z-10 cursor-pointer rounded-full bg-white/10 p-2 text-white"
|
||||
>
|
||||
<X className="size-6" />
|
||||
</button>
|
||||
|
||||
{onMove && photos.length > 1 && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="이전 사진"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
step(-1);
|
||||
}}
|
||||
className="absolute left-3 z-10 cursor-pointer rounded-full bg-white/10 p-2 text-white hover:bg-white/20"
|
||||
>
|
||||
<ChevronLeft className="size-5" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="다음 사진"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
step(1);
|
||||
}}
|
||||
className="absolute right-3 z-10 cursor-pointer rounded-full bg-white/10 p-2 text-white hover:bg-white/20"
|
||||
>
|
||||
<ChevronRight className="size-5" />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="flex max-h-[85vh] max-w-3xl items-center"
|
||||
>
|
||||
<img
|
||||
src={photo.url}
|
||||
alt={photo.alt ?? photo.caption ?? ''}
|
||||
className="max-h-[70vh] max-w-full rounded-xl object-contain shadow-2xl"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
export interface TilePhoto {
|
||||
id: string;
|
||||
url: string;
|
||||
alt?: string;
|
||||
caption?: string;
|
||||
category?: string;
|
||||
}
|
||||
|
||||
type TileFit = 'square' | 'portrait' | 'landscape' | 'free';
|
||||
|
||||
const ASPECT: Record<TileFit, string> = {
|
||||
square: 'aspect-square',
|
||||
portrait: 'aspect-3/4',
|
||||
landscape: 'aspect-4/3',
|
||||
free: '',
|
||||
};
|
||||
|
||||
/**
|
||||
* 갤러리 한 칸. 격자든 벽돌쌓기든 슬라이드든 "칸 하나"의 모양은 같아야 한다 —
|
||||
* 배리에이션이 바꾸는 건 칸의 배치이지 칸 자체가 아니다.
|
||||
*/
|
||||
export function PhotoTile({
|
||||
photo,
|
||||
fit = 'square',
|
||||
onOpen,
|
||||
showMeta = false,
|
||||
className,
|
||||
}: {
|
||||
photo: TilePhoto;
|
||||
fit?: TileFit;
|
||||
onOpen?: () => void;
|
||||
showMeta?: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onOpen?.();
|
||||
}}
|
||||
className={cn(
|
||||
'group relative select-none overflow-hidden rounded-xl border border-stone-200/80 bg-stone-100',
|
||||
ASPECT[fit],
|
||||
onOpen && 'cursor-pointer',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<img
|
||||
src={photo.url}
|
||||
alt={photo.alt ?? photo.caption ?? ''}
|
||||
loading="lazy"
|
||||
className="size-full object-cover transition-transform duration-300 group-hover:scale-105"
|
||||
/>
|
||||
{showMeta && (photo.category || photo.caption) && (
|
||||
<div className="absolute inset-0 flex flex-col justify-between bg-black/40 p-2 text-white opacity-0 transition-opacity group-hover:opacity-100">
|
||||
{photo.category ? (
|
||||
<span className="self-start rounded bg-black/50 px-1.5 py-0.5 text-[10px] font-medium">
|
||||
{photo.category}
|
||||
</span>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
{photo.caption && (
|
||||
<span className="truncate text-[10px] font-light">{photo.caption}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import type {ReactNode} from 'react';
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
type PillTone = 'neutral' | 'accent' | 'warn' | 'good' | 'dark';
|
||||
|
||||
const TONE: Record<PillTone, string> = {
|
||||
neutral: 'bg-stone-100 text-stone-600 border-stone-200/70',
|
||||
accent: 'bg-amber-100/80 text-amber-900 border-amber-200/70',
|
||||
warn: 'bg-amber-50 text-amber-700 border-amber-200',
|
||||
good: 'bg-emerald-50 text-emerald-700 border-emerald-200/60',
|
||||
dark: 'bg-stone-900/85 text-white border-transparent',
|
||||
};
|
||||
|
||||
/** 작은 라벨 하나. 거리·태그·가격대·"대표축제" 처럼 값 옆에 붙는 부가 정보 전용. */
|
||||
export function Pill({
|
||||
children,
|
||||
tone = 'neutral',
|
||||
mono,
|
||||
className,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
tone?: PillTone;
|
||||
mono?: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
'inline-flex shrink-0 items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] font-medium',
|
||||
TONE[tone],
|
||||
mono && 'font-mono',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
import {useCallback, useEffect, useRef, useState, type ReactNode} from 'react';
|
||||
import {ArrowUpRight, ChevronLeft, ChevronRight} from 'lucide-react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
import type {GuideCard} from '../variants/local/types';
|
||||
import {walkMinutes} from '../variants/local/walking';
|
||||
|
||||
const naverSearch = (q: string) =>
|
||||
`https://search.naver.com/search.naver?query=${encodeURIComponent(q)}`;
|
||||
|
||||
/** 네이버지도 검색 — 맛집·명소 카드가 쓴다(실제 사이트 LocalGuideSection과 동일한 규칙). */
|
||||
export const naverMapSearch = (q: string) => `https://map.naver.com/p/search/${encodeURIComponent(q)}`;
|
||||
|
||||
/**
|
||||
* 가이드 카드 한 장 — 사진(좌하단 "도보 약 N분 850m" 배지) · 이름 · 설명 2줄 · "검색으로 열기".
|
||||
*
|
||||
* ★ 사진이 없으면 회색 판에 이름을 크게 쓴다(스크린샷의 '군산복집' 카드). 자리를 비우거나
|
||||
* 남의 사진을 채우지 않는다 — 카드 폭이 들쭉날쭉해지면 캐러셀이 흔들린다.
|
||||
* ★ 거리를 모르면 배지를 생략한다. "도보 N분"은 업장 기준 직선거리에서만 계산한다.
|
||||
*/
|
||||
function GuideCardView({
|
||||
card,
|
||||
colors,
|
||||
leading,
|
||||
linkUrl = naverSearch,
|
||||
}: {
|
||||
card: GuideCard;
|
||||
colors: TemplateItem['colors'];
|
||||
leading?: ReactNode;
|
||||
linkUrl?: (query: string) => string;
|
||||
}) {
|
||||
const minutes = card.distanceMeters !== undefined ? walkMinutes(card.distanceMeters) : undefined;
|
||||
return (
|
||||
<a
|
||||
href={linkUrl(card.searchQuery)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="group flex w-[240px] shrink-0 snap-start flex-col overflow-hidden rounded-lg border border-stone-200/80 bg-white shadow-2xs transition-shadow hover:shadow-md sm:w-[260px]"
|
||||
>
|
||||
<div className="relative aspect-[4/3] w-full overflow-hidden bg-stone-200/70">
|
||||
{card.imageUrl ? (
|
||||
<img
|
||||
src={card.imageUrl}
|
||||
alt={card.name}
|
||||
loading="lazy"
|
||||
className="size-full object-cover transition-transform duration-300 group-hover:scale-[1.03]"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex size-full items-center justify-center px-4 text-center">
|
||||
<span className="serif-title text-base font-bold text-stone-700">{card.name}</span>
|
||||
</div>
|
||||
)}
|
||||
{minutes !== undefined && (
|
||||
<span className="absolute bottom-2.5 left-2.5 inline-flex items-center gap-1.5 rounded bg-stone-900/80 px-2 py-1 text-[11px] font-semibold text-white backdrop-blur-sm">
|
||||
<span>도보 약 {minutes}분</span>
|
||||
{card.distanceText && <span className="font-mono font-normal text-white/75">{card.distanceText}</span>}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-1 flex-col gap-1.5 p-3.5">
|
||||
{leading}
|
||||
<h4 className="text-sm font-bold text-stone-900" style={{color: colors.text}}>
|
||||
{card.name}
|
||||
</h4>
|
||||
{card.description && (
|
||||
<p className="line-clamp-2 text-xs leading-relaxed text-stone-500">{card.description}</p>
|
||||
)}
|
||||
<span className="mt-auto flex items-center gap-0.5 pt-1 text-[11px] font-medium text-stone-400 group-hover:text-stone-900">
|
||||
검색으로 열기
|
||||
<ArrowUpRight className="size-3" />
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 카드 캐러셀 — 가로 스크롤(스냅) + 좌우 화살표 + 점 페이지네이션 + "1 / N".
|
||||
*
|
||||
* ★ 페이지 = 한 화면에 온전히 들어가는 카드 수. 미리보기 해상도(PC/태블릿/모바일)가 바뀌면
|
||||
* ResizeObserver 가 다시 센다 — 고정 4장으로 두면 모바일에서 점이 카드 수와 어긋난다.
|
||||
* ★ 화살표는 컨테이너 폭만큼 넘긴다(한 페이지). 한 장씩 넘기면 24장에 화살표 23번이다.
|
||||
*/
|
||||
export function PlaceCarousel({
|
||||
cards,
|
||||
colors,
|
||||
renderLeading,
|
||||
linkUrl,
|
||||
}: {
|
||||
cards: GuideCard[];
|
||||
colors: TemplateItem['colors'];
|
||||
/** 카드 이름 위에 얹을 배지(축제의 "10월" 등). */
|
||||
renderLeading?: (card: GuideCard) => ReactNode;
|
||||
/** 카드가 열 링크. 기본은 네이버 웹 검색이고, 맛집·명소는 네이버지도 검색(naverMapSearch)을 넘긴다. */
|
||||
linkUrl?: (query: string) => string;
|
||||
}) {
|
||||
const trackRef = useRef<HTMLDivElement>(null);
|
||||
const [perPage, setPerPage] = useState(1);
|
||||
const [page, setPage] = useState(0);
|
||||
|
||||
const pages = Math.max(1, Math.ceil(cards.length / perPage));
|
||||
|
||||
// 카드 한 장 폭(gap 포함)으로 한 화면에 몇 장 들어가는지 잰다.
|
||||
const measure = useCallback(() => {
|
||||
const track = trackRef.current;
|
||||
const first = track?.firstElementChild as HTMLElement | null;
|
||||
if (!track || !first) return;
|
||||
const gap = parseFloat(getComputedStyle(track).columnGap || '0') || 0;
|
||||
const step = first.offsetWidth + gap;
|
||||
const fit = Math.max(1, Math.floor((track.clientWidth + gap) / step));
|
||||
setPerPage(fit);
|
||||
setPage(Math.min(Math.round(track.scrollLeft / (step * fit)), Math.max(0, Math.ceil(cards.length / fit) - 1)));
|
||||
}, [cards.length]);
|
||||
|
||||
useEffect(() => {
|
||||
measure();
|
||||
const track = trackRef.current;
|
||||
if (!track) return;
|
||||
const ro = new ResizeObserver(measure);
|
||||
ro.observe(track);
|
||||
return () => ro.disconnect();
|
||||
}, [measure]);
|
||||
|
||||
// 필터가 바뀌어 카드가 줄면 첫 페이지로.
|
||||
useEffect(() => {
|
||||
trackRef.current?.scrollTo({left: 0});
|
||||
setPage(0);
|
||||
}, [cards]);
|
||||
|
||||
const scrollToPage = (next: number) => {
|
||||
const track = trackRef.current;
|
||||
if (!track) return;
|
||||
const clamped = Math.max(0, Math.min(pages - 1, next));
|
||||
track.scrollTo({left: clamped * track.clientWidth, behavior: 'smooth'});
|
||||
setPage(clamped);
|
||||
};
|
||||
|
||||
const onScroll = () => {
|
||||
const track = trackRef.current;
|
||||
if (!track || track.clientWidth === 0) return;
|
||||
setPage(Math.max(0, Math.min(pages - 1, Math.round(track.scrollLeft / track.clientWidth))));
|
||||
};
|
||||
|
||||
const arrow =
|
||||
'flex size-9 cursor-pointer items-center justify-center rounded-full border transition-colors disabled:cursor-default disabled:opacity-30';
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="이전"
|
||||
disabled={page === 0}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
scrollToPage(page - 1);
|
||||
}}
|
||||
className={cn(arrow, 'border-stone-300/70 bg-white/70 text-stone-500 hover:bg-white')}
|
||||
>
|
||||
<ChevronLeft className="size-4" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="다음"
|
||||
disabled={page >= pages - 1}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
scrollToPage(page + 1);
|
||||
}}
|
||||
style={{borderColor: colors.text, color: colors.text}}
|
||||
className={cn(arrow, 'bg-white hover:bg-stone-50')}
|
||||
>
|
||||
<ChevronRight className="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
ref={trackRef}
|
||||
onScroll={onScroll}
|
||||
className="scrollbar-none flex snap-x snap-mandatory gap-4 overflow-x-auto pb-1"
|
||||
>
|
||||
{cards.map((card) => (
|
||||
<GuideCardView
|
||||
key={`${card.name}-${card.distanceMeters ?? ''}`}
|
||||
card={card}
|
||||
colors={colors}
|
||||
leading={renderLeading?.(card)}
|
||||
linkUrl={linkUrl}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{pages > 1 && (
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<div className="flex items-center gap-1.5">
|
||||
{Array.from({length: pages}, (_, i) => (
|
||||
<button
|
||||
key={i}
|
||||
type="button"
|
||||
aria-label={`${i + 1}페이지`}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
scrollToPage(i);
|
||||
}}
|
||||
className={cn(
|
||||
'h-1.5 cursor-pointer rounded-full transition-all',
|
||||
i === page ? 'w-5' : 'w-1.5 bg-stone-300 hover:bg-stone-400',
|
||||
)}
|
||||
style={i === page ? {backgroundColor: colors.text} : undefined}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<span className="font-mono text-[11px] text-stone-400">
|
||||
{page + 1} / {pages}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
import {ArrowUpRight} from 'lucide-react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {Pill} from './Pill';
|
||||
|
||||
/**
|
||||
* "이름 · 거리 · 한 줄 설명 · 바로가기" 한 행.
|
||||
* 맛집 / 명소 / 축제가 전부 이 모양이라 하나로 묶는다.
|
||||
*/
|
||||
export function PlaceRow({
|
||||
name,
|
||||
meta,
|
||||
description,
|
||||
href,
|
||||
actionLabel = '길찾기',
|
||||
leading,
|
||||
colors,
|
||||
className,
|
||||
}: {
|
||||
name: string;
|
||||
meta?: string;
|
||||
description?: string;
|
||||
href?: string;
|
||||
actionLabel?: string;
|
||||
leading?: React.ReactNode;
|
||||
/** 템플릿 색 토큰. 상호명만 text 를 따른다 — 설명·바로가기는 중립 회색이어야 이름이 튄다. */
|
||||
colors?: TemplateItem['colors'];
|
||||
className?: string;
|
||||
}) {
|
||||
const body = (
|
||||
<>
|
||||
<div className="space-y-1 pr-3">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{leading}
|
||||
<span
|
||||
className="text-xs font-bold text-stone-900 group-hover:text-stone-700 sm:text-sm"
|
||||
style={colors ? {color: colors.text} : undefined}
|
||||
>
|
||||
{name}
|
||||
</span>
|
||||
{meta && <Pill mono>{meta}</Pill>}
|
||||
</div>
|
||||
{description && (
|
||||
<p className="text-xs leading-relaxed text-stone-500">{description}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{href && (
|
||||
<span className="flex shrink-0 items-center gap-0.5 text-xs font-medium text-stone-400 group-hover:text-stone-900">
|
||||
<span>{actionLabel}</span>
|
||||
<ArrowUpRight className="size-3.5" />
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
const shared = cn(
|
||||
'group flex items-center justify-between p-4 transition-colors hover:bg-stone-50/80',
|
||||
className,
|
||||
);
|
||||
|
||||
if (!href) return <div className={shared}>{body}</div>;
|
||||
|
||||
return (
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className={shared}
|
||||
>
|
||||
{body}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
/** 목록을 감싸는 카드. divide 로 행 사이 선을 긋는다. */
|
||||
export function ListCard({children, className}: {children: React.ReactNode; className?: string}) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'overflow-hidden rounded-xl border border-stone-200/80 bg-white shadow-2xs [&>*+*]:border-t [&>*+*]:border-stone-100',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {Pill} from './Pill';
|
||||
|
||||
export interface PricedItem {
|
||||
name: string;
|
||||
price?: string;
|
||||
desc?: string;
|
||||
tag?: string;
|
||||
/** 소요시간 · 대상 같은 부가 스펙. 프로그램/코스에서 쓴다. */
|
||||
meta?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* "이름 · 태그 · 설명 · 가격" 한 줄.
|
||||
* 메뉴 / 코스 / 체험 프로그램이 전부 같은 뼈대라 한 원자로 묶고, 배치만 배리에이션에 맡긴다.
|
||||
*/
|
||||
export function PriceRow({
|
||||
item,
|
||||
variant = 'row',
|
||||
colors,
|
||||
className,
|
||||
}: {
|
||||
item: PricedItem;
|
||||
variant?: 'row' | 'card';
|
||||
/** 템플릿 색 토큰. 품명은 text, 가격은 primary 를 따른다(가격이 이 원자의 주인공이다). */
|
||||
colors?: TemplateItem['colors'];
|
||||
className?: string;
|
||||
}) {
|
||||
const nameStyle = colors ? {color: colors.text} : undefined;
|
||||
const priceStyle = colors ? {color: colors.primary} : undefined;
|
||||
|
||||
const head = (
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-xs font-bold text-stone-900 sm:text-sm" style={nameStyle}>
|
||||
{item.name}
|
||||
</span>
|
||||
{item.tag && <Pill tone="accent">{item.tag}</Pill>}
|
||||
</div>
|
||||
);
|
||||
|
||||
const specs = item.meta?.length ? (
|
||||
<div className="flex flex-wrap gap-1.5 pt-0.5">
|
||||
{item.meta.map((m) => (
|
||||
<Pill key={m}>{m}</Pill>
|
||||
))}
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
if (variant === 'card') {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col justify-between gap-3 rounded-xl border border-stone-200/80 bg-white p-4 shadow-2xs',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className="space-y-1.5">
|
||||
{head}
|
||||
{item.desc && <p className="text-xs leading-relaxed text-stone-500">{item.desc}</p>}
|
||||
{specs}
|
||||
</div>
|
||||
{item.price && (
|
||||
<span className="font-mono text-sm font-extrabold text-stone-900" style={priceStyle}>
|
||||
{item.price}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={cn('flex items-start justify-between gap-4 p-4', className)}>
|
||||
<div className="min-w-0 space-y-1">
|
||||
{head}
|
||||
{item.desc && <p className="text-xs leading-relaxed text-stone-500">{item.desc}</p>}
|
||||
{specs}
|
||||
</div>
|
||||
{item.price && (
|
||||
<span
|
||||
className="shrink-0 font-mono text-xs font-extrabold text-stone-900 sm:text-sm"
|
||||
style={priceStyle}
|
||||
>
|
||||
{item.price}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
/**
|
||||
* 캔버스의 가로 슬라이더.
|
||||
*
|
||||
* ★ 왜 라이브러리인가 (2026-09-02)
|
||||
* 예전에는 `overflow-x: auto` 상자 + 화살표 버튼 두 개였다. 화살표는 `scrollBy` 를 불러
|
||||
* 한 화면의 80%씩 밀었는데, **카드를 잡아끄는 방법이 없었다** — 휠 마우스 사용자는
|
||||
* 화살표를 찾지 못하면 옆에 더 있다는 걸 몰랐고, 트랙패드에서만 자연스러웠다.
|
||||
* embla-carousel 은 의존성 0, 코어 ~5KB(gzip)이고 발행본(solution/site)이 쓰는 것과 같다 —
|
||||
* 미리보기와 발행본의 조작감이 갈리면 미리보기가 아니다.
|
||||
*
|
||||
* ★ 캔버스 전용 사정: 카드 안에 링크·버튼이 있다. 드래그를 시작한 뒤의 클릭은 삼킨다
|
||||
* (embla 의 `pointerUp` 뒤 click 은 막지 않으면 카드가 눌린 것으로 처리된다).
|
||||
*/
|
||||
import {useCallback, useEffect, useRef, useState, type ReactNode} from 'react';
|
||||
import useEmblaCarousel from 'embla-carousel-react';
|
||||
import {ChevronLeft, ChevronRight} from 'lucide-react';
|
||||
import {ITEM_BORDER, ITEM_CARD} from '../variants/items/common';
|
||||
|
||||
export function Rail({
|
||||
label,
|
||||
children,
|
||||
tone = 'light',
|
||||
gap = 1,
|
||||
className,
|
||||
nav = 'above',
|
||||
viewportClassName,
|
||||
trackClassName = 'items-start',
|
||||
}: {
|
||||
/** 스크린리더가 읽을 이름. 화살표의 aria-label 도 여기서 만든다. */
|
||||
label: string;
|
||||
children: ReactNode;
|
||||
tone?: 'light' | 'dark';
|
||||
/** 슬라이드 사이 간격(rem). */
|
||||
gap?: number;
|
||||
className?: string;
|
||||
/**
|
||||
* 화살표를 어디에 둘지. 슬라이더가 액자(필름·책장) 안에 들어가는 아이템은
|
||||
* 'below' 로 액자 밖에 세운다 — 액자 안에 넣으면 질감 위에 버튼이 떠서 물건처럼 안 보인다.
|
||||
*/
|
||||
nav?: 'above' | 'below' | 'overlay' | 'none';
|
||||
/** 창(viewport)에 붙일 클래스. 액자 안쪽 여백처럼 슬라이더 자체가 가져야 하는 값. */
|
||||
viewportClassName?: string;
|
||||
/** 트랙에 붙일 클래스. 세로 정렬(items-end 같은)이 아이템마다 다르다. */
|
||||
trackClassName?: string;
|
||||
}) {
|
||||
const [emblaRef, embla] = useEmblaCarousel({align: 'start', containScroll: 'trimSnaps'});
|
||||
const [snaps, setSnaps] = useState<number[]>([]);
|
||||
const [selected, setSelected] = useState(0);
|
||||
const [canPrev, setCanPrev] = useState(false);
|
||||
const [canNext, setCanNext] = useState(false);
|
||||
const viewport = useRef<HTMLDivElement | null>(null);
|
||||
const dragged = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!embla) return;
|
||||
const sync = () => {
|
||||
setSelected(embla.selectedScrollSnap());
|
||||
setCanPrev(embla.canScrollPrev());
|
||||
setCanNext(embla.canScrollNext());
|
||||
};
|
||||
const measure = () => {
|
||||
setSnaps(embla.scrollSnapList());
|
||||
sync();
|
||||
};
|
||||
measure();
|
||||
embla.on('select', sync);
|
||||
embla.on('reInit', measure);
|
||||
viewport.current?.setAttribute('data-slider', 'on');
|
||||
return () => {
|
||||
embla.off('select', sync);
|
||||
embla.off('reInit', measure);
|
||||
};
|
||||
}, [embla]);
|
||||
|
||||
// 끌고 나서 손을 떼면 그 자리의 카드가 클릭된 것으로 처리된다 — 한 번만 삼킨다.
|
||||
useEffect(() => {
|
||||
if (!embla) return;
|
||||
const down = () => {
|
||||
dragged.current = false;
|
||||
viewport.current?.setAttribute('data-dragging', 'true');
|
||||
};
|
||||
const move = () => {
|
||||
dragged.current = true;
|
||||
};
|
||||
const up = () => viewport.current?.removeAttribute('data-dragging');
|
||||
embla.on('pointerDown', down);
|
||||
embla.on('scroll', move);
|
||||
embla.on('pointerUp', up);
|
||||
return () => {
|
||||
embla.off('pointerDown', down);
|
||||
embla.off('scroll', move);
|
||||
embla.off('pointerUp', up);
|
||||
};
|
||||
}, [embla]);
|
||||
|
||||
const prev = useCallback(() => embla?.scrollPrev(), [embla]);
|
||||
const next = useCallback(() => embla?.scrollNext(), [embla]);
|
||||
|
||||
// 한 화면에 다 들어가면 조작부를 그리지 않는다 — 눌러도 안 움직이는 버튼은 고장으로 읽힌다.
|
||||
const movable = snaps.length > 1;
|
||||
|
||||
// 액자(필름·책장) 안에 든 슬라이더는 화살표를 창 위에 겹친다 — 액자 밖에 두면
|
||||
// 어느 줄을 미는 버튼인지 알 수 없고, 액자 안에 한 줄 더 두면 질감이 끊긴다.
|
||||
const overlay = movable && nav === 'overlay' && (
|
||||
<>
|
||||
<EdgeButton dir="prev" tone={tone} onClick={prev} disabled={!canPrev} label={label} />
|
||||
<EdgeButton dir="next" tone={tone} onClick={next} disabled={!canNext} label={label} />
|
||||
</>
|
||||
);
|
||||
|
||||
const controls = movable && (nav === 'above' || nav === 'below') && (
|
||||
<div className={`flex items-center justify-end gap-1.5 ${nav === 'above' ? 'mb-2' : 'mt-2'}`}>
|
||||
<span className="mr-auto text-[11px] tabular-nums opacity-50">
|
||||
{selected + 1} / {snaps.length}
|
||||
</span>
|
||||
<NavButton dir="prev" tone={tone} onClick={prev} disabled={!canPrev} label={label} />
|
||||
<NavButton dir="next" tone={tone} onClick={next} disabled={!canNext} label={label} />
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={`${nav === 'overlay' ? 'relative' : ''} ${className ?? ''}`}>
|
||||
{nav === 'above' && controls}
|
||||
|
||||
<div
|
||||
ref={(node) => {
|
||||
viewport.current = node;
|
||||
emblaRef(node);
|
||||
}}
|
||||
className={`w4-scroll ${viewportClassName ?? ''}`}
|
||||
role="group"
|
||||
aria-roledescription="캐러셀"
|
||||
aria-label={label}
|
||||
tabIndex={0}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'ArrowLeft') {
|
||||
event.preventDefault();
|
||||
prev();
|
||||
}
|
||||
if (event.key === 'ArrowRight') {
|
||||
event.preventDefault();
|
||||
next();
|
||||
}
|
||||
}}
|
||||
onClickCapture={(event) => {
|
||||
if (!dragged.current) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
dragged.current = false;
|
||||
}}
|
||||
>
|
||||
<div className={`flex ${trackClassName}`} style={{gap: `${gap}rem`}}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{nav === 'below' && controls}
|
||||
{overlay}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function EdgeButton({
|
||||
dir,
|
||||
onClick,
|
||||
disabled,
|
||||
tone,
|
||||
label,
|
||||
}: {
|
||||
dir: 'prev' | 'next';
|
||||
onClick: () => void;
|
||||
disabled: boolean;
|
||||
tone: 'light' | 'dark';
|
||||
label: string;
|
||||
}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
const dark = tone === 'dark';
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onClick();
|
||||
}}
|
||||
disabled={disabled}
|
||||
aria-label={`${label} ${dir === 'prev' ? '이전' : '다음'}`}
|
||||
className={`absolute top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full backdrop-blur transition-opacity hover:opacity-80 disabled:opacity-0 ${
|
||||
dir === 'prev' ? 'left-1.5' : 'right-1.5'
|
||||
}`}
|
||||
style={{
|
||||
backgroundColor: dark
|
||||
? 'color-mix(in oklab, currentColor 22%, transparent)'
|
||||
: 'color-mix(in oklab, currentColor 12%, transparent)',
|
||||
}}
|
||||
>
|
||||
<Icon className="size-4" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function NavButton({
|
||||
dir,
|
||||
onClick,
|
||||
disabled,
|
||||
tone,
|
||||
label,
|
||||
}: {
|
||||
dir: 'prev' | 'next';
|
||||
onClick: () => void;
|
||||
disabled: boolean;
|
||||
tone: 'light' | 'dark';
|
||||
label: string;
|
||||
}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
const dark = tone === 'dark';
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onClick();
|
||||
}}
|
||||
disabled={disabled}
|
||||
aria-label={`${label} ${dir === 'prev' ? '이전' : '다음'}`}
|
||||
className="flex size-8 items-center justify-center border transition-opacity hover:opacity-70 disabled:opacity-25"
|
||||
style={{
|
||||
borderColor: dark ? 'color-mix(in oklab, currentColor 35%, transparent)' : ITEM_BORDER,
|
||||
backgroundColor: dark ? 'transparent' : ITEM_CARD,
|
||||
}}
|
||||
>
|
||||
<Icon className="size-4" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
/**
|
||||
* 섹션 껍데기 — 배리에이션이 절대 다시 만들지 않는 부분.
|
||||
*
|
||||
* 앵커 id(모바일 탭이 스크롤하는 목표), 선택 링, "선택됨" 배지, 배경 톤이 여기 모여 있다.
|
||||
* 배리에이션은 안쪽 내용만 책임진다 — 껍데기가 제각각이면 레이아웃을 바꿀 때마다
|
||||
* 선택 표시가 사라지거나 앵커가 끊긴다.
|
||||
*/
|
||||
import type {ReactNode} from 'react';
|
||||
import type {SectionItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
import type {SectionTone} from '../types';
|
||||
|
||||
/**
|
||||
* 섹션 배경 톤 → 실제 색.
|
||||
*
|
||||
* 화면 면적의 대부분이 이 네 색이라, 여기가 하드코딩이면 팔레트를 바꿔도 인상이 안 바뀐다.
|
||||
* 그래서 템플릿 토큰(`--tpl-*`)을 읽고, 폴백으로 기존 색을 그대로 둔다 —
|
||||
* ★ 토큰을 안 내려보내는 화면(발행 사이트·썸네일 등)에서는 지금과 픽셀 단위로 동일하다.
|
||||
*/
|
||||
const TONE_BG: Record<SectionTone, string> = {
|
||||
paper: 'var(--tpl-surface, #faf7f2)',
|
||||
// ★ 진짜 흰색으로 남긴다 — surface/surfaceAlt 와 세 단계가 있어야 섹션이 서로 구분된다.
|
||||
white: 'var(--tpl-bg, #ffffff)',
|
||||
tint: 'var(--tpl-surface-alt, #f4f1ec)',
|
||||
dark: 'var(--tpl-inverse, #1c1917)',
|
||||
};
|
||||
|
||||
interface SectionFrameProps {
|
||||
section: SectionItem;
|
||||
isSelected: boolean;
|
||||
onSelect: () => void;
|
||||
/** 배경 톤. 위아래 섹션과 다른 톤을 주면 경계선 없이도 구분된다. */
|
||||
tone?: SectionTone;
|
||||
/** 히어로처럼 자기 여백을 직접 잡는 배리에이션은 false. */
|
||||
padded?: boolean;
|
||||
className?: string;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
export function SectionFrame({
|
||||
section,
|
||||
isSelected,
|
||||
onSelect,
|
||||
tone = 'white',
|
||||
padded = true,
|
||||
className,
|
||||
children,
|
||||
}: SectionFrameProps) {
|
||||
const isDark = tone === 'dark';
|
||||
|
||||
return (
|
||||
<section
|
||||
id={`canvas-section-${section.id}`}
|
||||
onClick={onSelect}
|
||||
className={cn(
|
||||
'relative cursor-pointer transition-all',
|
||||
padded && 'px-4 sm:px-6 md:px-8',
|
||||
isSelected
|
||||
? 'ring-2 ring-stone-900 ring-offset-2'
|
||||
: 'hover:outline-1 hover:outline-dashed hover:outline-stone-300',
|
||||
className,
|
||||
)}
|
||||
style={{
|
||||
backgroundColor: TONE_BG[tone],
|
||||
// 세로 여백은 템플릿이 정한다 — 이 값 하나로 페이지의 호흡이 바뀐다.
|
||||
// 폴백은 걷어낸 py-12/py-16 과 같은 값이라, 토큰이 없는 곳에서는 지금까지와 동일하다.
|
||||
...(padded ? {paddingBlock: 'var(--tpl-section-space, 3.5rem)'} : {}),
|
||||
}}
|
||||
>
|
||||
{isSelected && (
|
||||
<span
|
||||
className={cn(
|
||||
'z-30 rounded bg-stone-900 px-2 py-0.5 text-[10px] font-semibold text-white',
|
||||
padded ? 'mb-4 inline-block' : 'absolute left-3 top-3 shadow-xs',
|
||||
isDark && 'bg-white text-stone-900',
|
||||
)}
|
||||
>
|
||||
선택됨: {section.name}
|
||||
{section.isLocked && ' (필수)'}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/** 섹션 본문의 표준 폭. 배리에이션마다 폭이 다르면 스크롤할 때 글줄이 출렁인다. */
|
||||
export function SectionBody({
|
||||
children,
|
||||
width = 'default',
|
||||
className,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
width?: 'default' | 'wide' | 'narrow';
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'mx-auto space-y-6',
|
||||
width === 'wide' && 'max-w-[1120px]',
|
||||
width === 'default' && 'max-w-[880px]',
|
||||
width === 'narrow' && 'max-w-[640px]',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/**
|
||||
* 섹션 제목 — 그 자체로 배리에이션을 갖는 원자.
|
||||
*
|
||||
* 섹션 배리에이션을 바꿔도 제목 스타일은 따로 고를 수 있어야 한다
|
||||
* ("갤러리는 격자로, 제목은 가운데 정렬" 같은 조합이 실제로 나온다).
|
||||
*/
|
||||
import type {ReactNode} from 'react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
export type HeadingStyle = 'underline' | 'centered' | 'eyebrow' | 'minimal';
|
||||
|
||||
interface SectionHeadingProps {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
/** 제목 위에 얹는 작은 라벨. eyebrow · centered 스타일에서 쓴다. */
|
||||
eyebrow?: string;
|
||||
variant?: HeadingStyle;
|
||||
/** 제목 오른쪽에 붙는 것(경고 배지, 추가 버튼 등). */
|
||||
trailing?: ReactNode;
|
||||
/**
|
||||
* 템플릿 색 토큰. 넘기면 제목은 text, eyebrow 는 accent 를 따른다.
|
||||
*
|
||||
* ★ 부제·밑줄은 일부러 중립 회색으로 남긴다 — 여기까지 토큰을 먹이면
|
||||
* accent 가 밝은 템플릿에서 부제가 배경에 묻힌다.
|
||||
*/
|
||||
colors?: TemplateItem['colors'];
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function SectionHeading({
|
||||
title,
|
||||
subtitle,
|
||||
eyebrow,
|
||||
variant = 'underline',
|
||||
trailing,
|
||||
colors,
|
||||
className,
|
||||
}: SectionHeadingProps) {
|
||||
const titleStyle = colors ? {color: colors.text} : undefined;
|
||||
const eyebrowStyle = colors ? {color: colors.accent} : undefined;
|
||||
|
||||
if (variant === 'centered') {
|
||||
return (
|
||||
<div className={cn('space-y-2 text-center', className)}>
|
||||
{eyebrow && (
|
||||
<span
|
||||
className="text-[11px] font-semibold uppercase tracking-[0.2em] text-stone-400"
|
||||
style={eyebrowStyle}
|
||||
>
|
||||
{eyebrow}
|
||||
</span>
|
||||
)}
|
||||
<h2
|
||||
className="tpl-title serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
|
||||
style={titleStyle}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
{subtitle && <p className="text-xs text-stone-500 sm:text-sm">{subtitle}</p>}
|
||||
{trailing && <div className="flex justify-center pt-1">{trailing}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (variant === 'eyebrow') {
|
||||
return (
|
||||
<div className={cn('flex items-start justify-between gap-3', className)}>
|
||||
<div className="space-y-1">
|
||||
{eyebrow && (
|
||||
<span
|
||||
className="block text-[11px] font-bold uppercase tracking-wider text-amber-700"
|
||||
style={eyebrowStyle}
|
||||
>
|
||||
{eyebrow}
|
||||
</span>
|
||||
)}
|
||||
<h2
|
||||
className="tpl-title serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
|
||||
style={titleStyle}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
{subtitle && <p className="text-xs text-stone-500">{subtitle}</p>}
|
||||
</div>
|
||||
{trailing}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (variant === 'minimal') {
|
||||
// 여기서 제목은 사실상 작은 라벨이라 text 가 아니라 secondary 를 쓴다.
|
||||
return (
|
||||
<div className={cn('flex items-baseline justify-between gap-3', className)}>
|
||||
<h2
|
||||
className="tpl-title text-sm font-bold uppercase tracking-[0.18em] text-stone-500"
|
||||
style={colors ? {color: colors.secondary} : undefined}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
{trailing}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// underline — 기본. 아래 실선이 섹션의 시작을 확실히 끊어준다.
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col justify-between gap-2 border-b border-stone-200/80 pb-4 sm:flex-row sm:items-baseline',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div>
|
||||
<h2
|
||||
className="tpl-title serif-title text-xl font-bold tracking-tight text-stone-900 sm:text-2xl"
|
||||
style={titleStyle}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
{subtitle && <p className="mt-0.5 text-xs text-stone-500">{subtitle}</p>}
|
||||
</div>
|
||||
{trailing && <div className="self-start sm:self-auto">{trailing}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {
|
||||
WALK_FILTERS,
|
||||
matchesWalkFilter,
|
||||
type WalkFilterKey,
|
||||
} from '../variants/local/walking';
|
||||
|
||||
/**
|
||||
* 도보 시간 필터 탭 — "전체 24 · 걸어서 5분 이내 8 · 10분 이내 19 · 10분 이상 5".
|
||||
*
|
||||
* ★ 구간은 누적이다(walking.ts 주석). 그래서 숫자가 서로 더해져 전체가 되지 않는다 —
|
||||
* "5분 이내" ⊂ "10분 이내". 배타 구간으로 바꾸면 라벨("이내")과 숫자가 어긋난다.
|
||||
* ★ 상태는 부르는 쪽(카테고리 섹션)이 든다. 섹션마다 필터가 따로 움직여야 한다.
|
||||
*/
|
||||
export function WalkFilterTabs({
|
||||
distances,
|
||||
value,
|
||||
onChange,
|
||||
colors,
|
||||
}: {
|
||||
/** 항목별 거리(m). 모르는 항목은 undefined — '전체'에만 센다. */
|
||||
distances: (number | undefined)[];
|
||||
value: WalkFilterKey;
|
||||
onChange: (key: WalkFilterKey) => void;
|
||||
colors: TemplateItem['colors'];
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-2" role="tablist" aria-label="도보 시간 필터">
|
||||
{WALK_FILTERS.map(({key, label}) => {
|
||||
const count = distances.filter((m) => matchesWalkFilter(key, m)).length;
|
||||
const active = key === value;
|
||||
return (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={active}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onChange(key);
|
||||
}}
|
||||
style={active ? {backgroundColor: colors.text, borderColor: colors.text} : undefined}
|
||||
className={cn(
|
||||
'flex cursor-pointer items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-xs font-semibold transition-colors',
|
||||
active
|
||||
? 'text-white'
|
||||
: 'border-stone-300/80 bg-white/70 text-stone-700 hover:bg-white',
|
||||
)}
|
||||
>
|
||||
<span>{label}</span>
|
||||
<span className={cn('font-mono text-[11px]', active ? 'text-white/80' : 'text-stone-400')}>{count}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* 캔버스 원자 모음.
|
||||
*
|
||||
* 배리에이션은 여기 있는 것만 조립한다 — 원자를 늘리면 모든 배리에이션이 같이 좋아지고,
|
||||
* 배리에이션 안에서 직접 마크업을 쓰기 시작하면 레이아웃마다 디테일이 갈라진다.
|
||||
*/
|
||||
export {SectionFrame, SectionBody} from './SectionFrame';
|
||||
export {SectionHeading, type HeadingStyle} from './SectionHeading';
|
||||
export {InfoRow, type InfoRowStyle} from './InfoRow';
|
||||
export {HiddenFieldsNotice} from './HiddenFieldsNotice';
|
||||
export {EmptyStateNotice} from './EmptyStateNotice';
|
||||
export {PhotoTile, type TilePhoto} from './PhotoTile';
|
||||
export {Lightbox} from './Lightbox';
|
||||
export {PlaceRow, ListCard} from './PlaceRow';
|
||||
export {PriceRow, type PricedItem} from './PriceRow';
|
||||
export {AddressCard} from './AddressCard';
|
||||
export {FeatureCard} from './FeatureCard';
|
||||
export {Pill} from './Pill';
|
||||
export {CtaLink, type CtaStyle} from './CtaLink';
|
||||
export {Rail} from './Rail';
|
||||
/* 주변 정보(업장 좌표 기준) — 시안 이후 들어온 것이라 시안 쪽 index 에는 없다. */
|
||||
export {PlaceCarousel, naverMapSearch} from './PlaceCarousel';
|
||||
export {WalkFilterTabs} from './WalkFilterTabs';
|
||||
@@ -1,519 +0,0 @@
|
||||
/**
|
||||
* 배리에이션 레지스트리 — "이 섹션 타입에 어떤 레이아웃들이 있나"의 단일 출처.
|
||||
*
|
||||
* 캔버스 렌더러와 [디자인] 탭이 같은 표를 본다. 배리에이션을 하나 추가한다는 건
|
||||
* 여기 한 줄을 더한다는 뜻이고, 그 순간 캔버스와 고르는 UI가 동시에 늘어난다.
|
||||
*/
|
||||
import type {IndustryType, SectionItem} from '@o2o/shared';
|
||||
import {SocialCanvasSection} from '@/features/social/SocialCanvasSection';
|
||||
import type {SectionVariant} from './types';
|
||||
|
||||
import {HeroCover} from './variants/hero/HeroCover';
|
||||
import {HeroSplit} from './variants/hero/HeroSplit';
|
||||
|
||||
import {IntroStory} from './variants/intro/IntroStory';
|
||||
import {IntroCentered} from './variants/intro/IntroCentered';
|
||||
import {IntroSideBySide} from './variants/intro/IntroSideBySide';
|
||||
|
||||
import {InfoTable} from './variants/info/InfoTable';
|
||||
import {InfoCards} from './variants/info/InfoCards';
|
||||
import {InfoInline} from './variants/info/InfoInline';
|
||||
|
||||
import {PhotosGrid} from './variants/photos/PhotosGrid';
|
||||
import {PhotosMasonry} from './variants/photos/PhotosMasonry';
|
||||
import {PhotosCarousel} from './variants/photos/PhotosCarousel';
|
||||
import {PhotosWithVideos} from './variants/photos/PhotosWithVideos';
|
||||
|
||||
import {MapDetailed} from './variants/map/MapDetailed';
|
||||
import {MapCompact} from './variants/map/MapCompact';
|
||||
|
||||
import {ItineraryTickets} from './variants/itinerary/ItineraryTickets';
|
||||
import {VideoFrame} from './variants/video/VideoFrame';
|
||||
import {LocalGuide} from './variants/local/LocalGuide';
|
||||
import {WeatherSection} from './variants/weather/WeatherSection';
|
||||
|
||||
import {FaqAccordion} from './variants/faq/FaqAccordion';
|
||||
import {FaqOpenList} from './variants/faq/FaqOpenList';
|
||||
import {FaqTwoColumn} from './variants/faq/FaqTwoColumn';
|
||||
|
||||
import {RoomsCarousel} from './variants/rooms/RoomsCarousel';
|
||||
import {RoomsGrid} from './variants/rooms/RoomsGrid';
|
||||
import {RoomsList} from './variants/rooms/RoomsList';
|
||||
|
||||
|
||||
import {BookingCard} from './variants/booking/BookingCard';
|
||||
import {BookingBanner} from './variants/booking/BookingBanner';
|
||||
|
||||
import {MenuList} from './variants/menu/MenuList';
|
||||
import {MenuGrid} from './variants/menu/MenuGrid';
|
||||
import {MenuPriceTable} from './variants/menu/MenuPriceTable';
|
||||
|
||||
import {SpaceZones} from './variants/space/SpaceZones';
|
||||
import {SpaceList} from './variants/space/SpaceList';
|
||||
|
||||
import {InquiryCta} from './variants/inquiry/InquiryCta';
|
||||
import {InquiryForm} from './variants/inquiry/InquiryForm';
|
||||
|
||||
import {ProgramsCards} from './variants/programs/ProgramsCards';
|
||||
import {ProgramsTable} from './variants/programs/ProgramsTable';
|
||||
|
||||
import {ExhibitionGallery} from './variants/exhibition/ExhibitionGallery';
|
||||
import {ExhibitionNotice} from './variants/exhibition/ExhibitionNotice';
|
||||
|
||||
// 붙여넣기 아이템 — 데이터가 fact 가 아니라 사장님이 넣은 JSON 에서 온다(dataSpec.ts).
|
||||
import {SongsTurntable} from './variants/songs/SongsTurntable';
|
||||
import {DailyCalendar} from './variants/daily/DailyCalendar';
|
||||
import {PeopleFilmstrip} from './variants/people/PeopleFilmstrip';
|
||||
import {ChronicleRail} from './variants/chronicle/ChronicleRail';
|
||||
import {ReadingRail} from './variants/reading/ReadingRail';
|
||||
import {PostcardStack} from './variants/postcard/PostcardStack';
|
||||
import {QuizFlip} from './variants/quiz/QuizFlip';
|
||||
|
||||
export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
/*
|
||||
* 히어로.
|
||||
*
|
||||
* ★ 발행본이 실제로 해석하는 것과 **1:1 이어야 한다**(`site/src/sections/HeroSection.tsx`).
|
||||
* 예전에는 에디토리얼·풀스크린·타이포 셋을 더 보여줬는데 발행본에 짝이 없어서,
|
||||
* 무엇을 골라도 발행본은 기본(표지)으로 나왔다 — 고르는 의미가 없는 선택지였다.
|
||||
* 여기 늘릴 때는 발행본 쪽 분기도 같이 늘린다.
|
||||
*/
|
||||
hero: [
|
||||
{
|
||||
id: 'hero.cover',
|
||||
name: '표지',
|
||||
description: '사진 한 장 위, 상호는 좌하단. 사진의 피사체를 글자가 가리지 않는다.',
|
||||
thumb: 'fullbleed',
|
||||
Component: HeroCover,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'hero.split',
|
||||
name: '좌우 분할',
|
||||
description: '왼쪽 글 · 오른쪽 사진. 무엇을 파는 곳인지 글로 먼저 읽힌다.',
|
||||
thumb: 'split',
|
||||
Component: HeroSplit,
|
||||
},
|
||||
],
|
||||
|
||||
intro: [
|
||||
{
|
||||
id: 'intro.story',
|
||||
name: '스토리',
|
||||
description: '넓은 사진 아래로 문단이 흐르는 잡지식 구성.',
|
||||
thumb: 'stack',
|
||||
Component: IntroStory,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'intro.centered',
|
||||
name: '가운데 정렬',
|
||||
description: '짧은 문단 하나. 가장 조용하고 짧다.',
|
||||
thumb: 'centered',
|
||||
Component: IntroCentered,
|
||||
},
|
||||
{
|
||||
id: 'intro.side-by-side',
|
||||
name: '사진 옆 글',
|
||||
description: '세로 사진 옆에 문단과 특징 목록.',
|
||||
thumb: 'split',
|
||||
Component: IntroSideBySide,
|
||||
},
|
||||
],
|
||||
|
||||
info: [
|
||||
{
|
||||
id: 'info.table',
|
||||
name: '표',
|
||||
description: '라벨과 값을 선으로 나눈다. 항목이 많아도 안 흔들린다.',
|
||||
thumb: 'table',
|
||||
Component: InfoTable,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'info.cards',
|
||||
name: '카드',
|
||||
description: '항목마다 한 장. 모바일에서 훑기 좋다.',
|
||||
thumb: 'cards',
|
||||
Component: InfoCards,
|
||||
},
|
||||
{
|
||||
id: 'info.inline',
|
||||
name: '한 줄 요약',
|
||||
description: '값들을 이어 붙여 가장 좁게. 정보가 적을 때.',
|
||||
thumb: 'compact',
|
||||
Component: InfoInline,
|
||||
},
|
||||
],
|
||||
|
||||
photos: [
|
||||
{
|
||||
id: 'photos.grid',
|
||||
name: '정사각 격자',
|
||||
description: '같은 크기로 정렬. 장수가 많을수록 정돈돼 보인다.',
|
||||
thumb: 'grid',
|
||||
Component: PhotosGrid,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'photos.masonry',
|
||||
name: '벽돌쌓기',
|
||||
description: '원본 비율 그대로 어긋나게. 사진을 잘라내지 않는다.',
|
||||
thumb: 'masonry',
|
||||
Component: PhotosMasonry,
|
||||
},
|
||||
{
|
||||
id: 'photos.carousel',
|
||||
name: '가로 슬라이드',
|
||||
description: '큰 사진을 한 장씩. 장수가 적고 한 장이 좋을 때.',
|
||||
thumb: 'carousel',
|
||||
Component: PhotosCarousel,
|
||||
},
|
||||
{
|
||||
id: 'photos.with-videos',
|
||||
name: '사진 + 영상',
|
||||
description: '격자 갤러리 아래 YouTube 영상까지. 영상이 더 잘 팔릴 때.',
|
||||
thumb: 'stack',
|
||||
Component: PhotosWithVideos,
|
||||
},
|
||||
],
|
||||
|
||||
map: [
|
||||
{
|
||||
id: 'map.detailed',
|
||||
name: '상세 안내',
|
||||
description: '주소 + 거점별 소요시간 표 + 주차/충전. 차로 오는 손님이 많을 때.',
|
||||
thumb: 'table',
|
||||
Component: MapDetailed,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'map.compact',
|
||||
name: '주소만',
|
||||
description: '주소 한 줄과 길찾기 버튼. 도심처럼 찾기 쉬운 곳.',
|
||||
thumb: 'compact',
|
||||
Component: MapCompact,
|
||||
},
|
||||
],
|
||||
|
||||
// ★ 전체/탭/요약 세 개를 하나로 통일했다(2026-09-07). 저장된 옛 id(local.tabs·local.compact)는
|
||||
// resolveVariant 가 기본값으로 떨어뜨리므로 기존 사이트가 깨지지 않는다.
|
||||
local: [
|
||||
{
|
||||
id: 'local.guide',
|
||||
name: '가이드',
|
||||
description: '맛집 · 명소 · 축제를 도보 시간으로 걸러 카드로 넘겨 본다.',
|
||||
thumb: 'stack',
|
||||
Component: LocalGuide,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
weather: [
|
||||
{
|
||||
id: 'weather.card',
|
||||
name: '날씨 카드',
|
||||
description: '현재 기온과 날씨 상태, 추천 문구를 한 장에 보여준다.',
|
||||
thumb: 'compact',
|
||||
Component: WeatherSection,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
faq: [
|
||||
{
|
||||
id: 'faq.accordion',
|
||||
name: '아코디언',
|
||||
description: '질문만 보이고 누르면 답이 열린다. 화면이 짧다.',
|
||||
thumb: 'accordion',
|
||||
Component: FaqAccordion,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'faq.open-list',
|
||||
name: '펼친 목록',
|
||||
description: '답까지 전부 열어 둔다. 훑고 지나가게 하고 싶을 때.',
|
||||
thumb: 'list',
|
||||
Component: FaqOpenList,
|
||||
},
|
||||
{
|
||||
id: 'faq.two-column',
|
||||
name: '2단',
|
||||
description: '넓은 화면에서 두 줄씩. 세로 길이가 반으로 준다.',
|
||||
thumb: 'two-column',
|
||||
Component: FaqTwoColumn,
|
||||
},
|
||||
],
|
||||
|
||||
rooms: [
|
||||
{
|
||||
id: 'rooms.carousel',
|
||||
name: '가로 슬라이드',
|
||||
description: '모바일에서 한 칸씩 스와이프. 객실 2~4개일 때 자연스럽다.',
|
||||
thumb: 'carousel',
|
||||
Component: RoomsCarousel,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'rooms.grid',
|
||||
name: '격자',
|
||||
description: '전부 한눈에. 객실이 많고 비교해서 고르게 할 때.',
|
||||
thumb: 'cards',
|
||||
Component: RoomsGrid,
|
||||
},
|
||||
{
|
||||
id: 'rooms.list',
|
||||
name: '가로 목록',
|
||||
description: '사진 왼쪽 · 설명 오른쪽. 객실 설명이 길 때.',
|
||||
thumb: 'list',
|
||||
Component: RoomsList,
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
booking: [
|
||||
{
|
||||
id: 'booking.card',
|
||||
name: '안내 카드',
|
||||
description: '가운데 놓인 조용한 카드. 흐름을 끊지 않는다.',
|
||||
thumb: 'centered',
|
||||
Component: BookingCard,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'booking.banner',
|
||||
name: '띠배너',
|
||||
description: '브랜드 색으로 화면을 가로지르는 강한 유도.',
|
||||
thumb: 'banner',
|
||||
Component: BookingBanner,
|
||||
},
|
||||
],
|
||||
|
||||
menu: [
|
||||
{
|
||||
id: 'menu.list',
|
||||
name: '메뉴판',
|
||||
description: '이름과 가격을 한 줄씩. 종이 메뉴판처럼.',
|
||||
thumb: 'list',
|
||||
Component: MenuList,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'menu.grid',
|
||||
name: '카드 격자',
|
||||
description: '설명을 넉넉히. 시그니처가 몇 개뿐일 때.',
|
||||
thumb: 'cards',
|
||||
Component: MenuGrid,
|
||||
},
|
||||
{
|
||||
id: 'menu.price-table',
|
||||
name: '가격표',
|
||||
description: '점선으로 이름과 가격만. 품목이 많을 때.',
|
||||
thumb: 'table',
|
||||
Component: MenuPriceTable,
|
||||
},
|
||||
],
|
||||
|
||||
space: [
|
||||
{
|
||||
id: 'space.zones',
|
||||
name: '구역 카드',
|
||||
description: '사진과 함께 자리별로. 좌석 구성이 궁금한 곳에.',
|
||||
thumb: 'cards',
|
||||
Component: SpaceZones,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'space.list',
|
||||
name: '목록',
|
||||
description: '사진 없이 이름과 설명만. 사진이 부실할 때.',
|
||||
thumb: 'list',
|
||||
Component: SpaceList,
|
||||
},
|
||||
],
|
||||
|
||||
inquiry: [
|
||||
{
|
||||
id: 'inquiry.cta',
|
||||
name: '연락 카드',
|
||||
description: '전화 · 카카오로 바로. 폼을 받을 준비가 안 됐을 때.',
|
||||
thumb: 'centered',
|
||||
Component: InquiryCta,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'inquiry.form',
|
||||
name: '문의 양식',
|
||||
description: '인원 · 일정 · 연락처를 받는 신청서.',
|
||||
thumb: 'form',
|
||||
Component: InquiryForm,
|
||||
},
|
||||
],
|
||||
|
||||
programs: [
|
||||
{
|
||||
id: 'programs.cards',
|
||||
name: '카드',
|
||||
description: '소요시간 · 대상까지 한 장씩. 처음 오는 손님이 고르기 쉽다.',
|
||||
thumb: 'cards',
|
||||
Component: ProgramsCards,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'programs.table',
|
||||
name: '비교표',
|
||||
description: '시간 · 대상 · 가격을 열로. 조건을 견줘 고르는 곳에.',
|
||||
thumb: 'table',
|
||||
Component: ProgramsTable,
|
||||
},
|
||||
],
|
||||
|
||||
social: [{id: 'social.cards', name: '함께 발행한 소식', description: '승인해 SNS에 게재한 최신 소식. 홈페이지 맨 아래에 표시합니다.', thumb: 'cards', Component: SocialCanvasSection, isDefault: true}],
|
||||
songs: [
|
||||
{
|
||||
id: 'songs.turntable',
|
||||
name: '턴테이블',
|
||||
description: '도넛판을 눌러 얹으면 판이 돈다. 곡 3~8개일 때 가장 좋다.',
|
||||
thumb: 'carousel',
|
||||
Component: SongsTurntable,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
daily: [
|
||||
{
|
||||
id: 'daily.calendar',
|
||||
name: '일력',
|
||||
description: '오늘 날짜에 맞는 한 장이 자동으로 펼쳐진다. 매일 바뀌니 다시 올 이유가 된다.',
|
||||
thumb: 'compact',
|
||||
Component: DailyCalendar,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
|
||||
people: [
|
||||
{
|
||||
id: 'people.filmstrip',
|
||||
name: '필름 스트립',
|
||||
description: '프레임 하나가 인물 하나. 사진이 없으면 이름 활자가 대신 들어간다.',
|
||||
thumb: 'carousel',
|
||||
Component: PeopleFilmstrip,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
chronicle: [
|
||||
{
|
||||
id: 'chronicle.rail',
|
||||
name: '가로 연표',
|
||||
description: '연도가 큰 활자로 서고 사건이 붙는다. 붉은 점이 도시를 바꾼 해다.',
|
||||
thumb: 'timeline',
|
||||
Component: ChronicleRail,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
reading: [
|
||||
{
|
||||
id: 'reading.posts',
|
||||
name: '읽기 카드',
|
||||
description: '한 슬라이드에 한 꼭지. 발행본은 이 중 5~6개만 매번 무작위로 세운다.',
|
||||
thumb: 'carousel',
|
||||
Component: ReadingRail,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
postcard: [
|
||||
{
|
||||
id: 'postcard.stack',
|
||||
name: '엽서 뒷면',
|
||||
description: '우표 자리와 소인이 찍힌 뒷면 한 장. [복사] 로 손님이 그대로 퍼 간다.',
|
||||
thumb: 'carousel',
|
||||
Component: PostcardStack,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
quiz: [
|
||||
{
|
||||
id: 'quiz.flip',
|
||||
name: '시험지 플립',
|
||||
description: '앞면은 질문, 뒤집으면 힌트와 출처. 정답은 두지 않는다.',
|
||||
thumb: 'cards',
|
||||
Component: QuizFlip,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
exhibition: [
|
||||
{
|
||||
id: 'exhibition.gallery',
|
||||
name: '전시 갤러리',
|
||||
description: '전시 사진을 크게 깔고 관람 정보를 붙인다.',
|
||||
thumb: 'grid',
|
||||
Component: ExhibitionGallery,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'exhibition.notice',
|
||||
name: '관람 공지',
|
||||
description: '사진 없이 안내 문구만. 일정이 자주 바뀌는 곳에.',
|
||||
thumb: 'timeline',
|
||||
Component: ExhibitionNotice,
|
||||
},
|
||||
],
|
||||
|
||||
video: [
|
||||
{
|
||||
id: 'video.frame',
|
||||
name: '영상 한 편',
|
||||
description: '표지를 먼저 보여주고 누르면 재생한다. 세로 영상(쇼츠)은 세로 틀로 나간다.',
|
||||
thumb: 'fullbleed',
|
||||
Component: VideoFrame,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
itinerary: [
|
||||
{
|
||||
id: 'itinerary.tickets',
|
||||
name: '승차권',
|
||||
description: '절취선 뚫린 표가 줄줄이. 표 한 장이 정거장 하나이고 마지막에 완주 도장이 찍힌다.',
|
||||
thumb: 'carousel',
|
||||
Component: ItineraryTickets,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/** 그 업종에서 고를 수 있는 배리에이션. 업종 제한이 걸린 건 걸러낸다. */
|
||||
export function variantsFor(sectionType: string, industry: IndustryType): SectionVariant[] {
|
||||
const all = SECTION_VARIANTS[sectionType] ?? [];
|
||||
return all.filter((v) => !v.industries || v.industries.includes(industry));
|
||||
}
|
||||
|
||||
/** 그 타입의 기본 배리에이션. isDefault 가 없으면 첫 번째. */
|
||||
export function defaultVariant(sectionType: string): SectionVariant | undefined {
|
||||
const all = SECTION_VARIANTS[sectionType] ?? [];
|
||||
return all.find((v) => v.isDefault) ?? all[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 실제로 그릴 배리에이션.
|
||||
*
|
||||
* 저장된 variantId 가 지워졌거나(배리에이션을 뺐거나) 업종이 바뀌어 못 쓰게 됐어도
|
||||
* 기본값으로 떨어진다 — 빈 화면 대신 무언가는 반드시 그린다.
|
||||
*/
|
||||
export function resolveVariant(
|
||||
section: SectionItem,
|
||||
industry: IndustryType,
|
||||
): SectionVariant | undefined {
|
||||
const available = variantsFor(section.type, industry);
|
||||
const picked = available.find((v) => v.id === section.variantId);
|
||||
return picked ?? defaultVariant(section.type);
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/**
|
||||
* 캔버스 배리에이션 계약.
|
||||
*
|
||||
* 섹션 하나 = "무엇을 보여줄지"(데이터) + "어떻게 보여줄지"(배리에이션).
|
||||
* 데이터는 이 props 로 고정하고, 배리에이션만 갈아끼운다 —
|
||||
* 그래야 사장님이 레이아웃을 바꿔도 내용이 날아가지 않는다.
|
||||
*/
|
||||
import type {ComponentType, ReactNode} from 'react';
|
||||
import type {
|
||||
IndustryType,
|
||||
InfoField,
|
||||
PhotoItem,
|
||||
SectionItem,
|
||||
TemplateItem,
|
||||
} from '@o2o/shared';
|
||||
import type {WeatherLocation} from '@/stores/builder';
|
||||
|
||||
/** 모든 배리에이션이 동일하게 받는 입력. 배리에이션은 이 밖의 것을 요구하지 않는다. */
|
||||
export interface SectionRenderProps {
|
||||
/** 섹션 메타(id · type · name · variantId). 프레임의 앵커 id 와 배지 라벨이 여기서 나온다. */
|
||||
section: SectionItem;
|
||||
industryId: IndustryType;
|
||||
storeName: string;
|
||||
location: string;
|
||||
weatherLocation?: WeatherLocation;
|
||||
template: TemplateItem;
|
||||
infoFields: InfoField[];
|
||||
photos: PhotoItem[];
|
||||
/** 에디터에서 선택된 섹션인가(미리보기 모드면 항상 false). */
|
||||
isSelected: boolean;
|
||||
onSelect: () => void;
|
||||
}
|
||||
|
||||
export type SectionVariantComponent = ComponentType<SectionRenderProps>;
|
||||
|
||||
/** 디자인 탭이 카드로 그리는 배리에이션 한 칸. */
|
||||
export interface SectionVariant {
|
||||
/** 전역 유일. `<sectionType>.<slug>` 규칙 — 저장된 값이 어느 섹션 것인지 눈으로 읽힌다. */
|
||||
id: string;
|
||||
/** 사장님에게 보이는 이름. 개발 용어 말고 "왼쪽 사진 · 오른쪽 글" 같은 말로 쓴다. */
|
||||
name: string;
|
||||
/** 언제 이걸 고르면 좋은지 한 줄. */
|
||||
description: string;
|
||||
/** 와이어프레임 썸네일 키(`thumbs.tsx`). 글보다 그림이 빨리 읽힌다. */
|
||||
thumb: ThumbKey;
|
||||
Component: SectionVariantComponent;
|
||||
/** 특정 업종에서만 의미 있는 배리에이션이면 여기로 좁힌다. 비우면 전 업종 공통. */
|
||||
industries?: IndustryType[];
|
||||
/** '기본'으로 표시할 배리에이션. 타입당 하나. */
|
||||
isDefault?: boolean;
|
||||
}
|
||||
|
||||
export type ThumbKey =
|
||||
| 'fullbleed'
|
||||
| 'split'
|
||||
| 'stack'
|
||||
| 'centered'
|
||||
| 'grid'
|
||||
| 'masonry'
|
||||
| 'carousel'
|
||||
| 'list'
|
||||
| 'table'
|
||||
| 'cards'
|
||||
| 'accordion'
|
||||
| 'two-column'
|
||||
| 'banner'
|
||||
| 'form'
|
||||
| 'timeline'
|
||||
| 'compact';
|
||||
|
||||
/** 섹션 프레임의 배경 톤. 배리에이션마다 다른 톤을 골라 리듬을 만든다. */
|
||||
export type SectionTone = 'paper' | 'white' | 'tint' | 'dark';
|
||||
|
||||
export interface SectionFrameSlots {
|
||||
children: ReactNode;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* 예약 · 띠배너 — 브랜드 색으로 화면을 가로지르는 강한 전환 유도.
|
||||
* 예약이 유일한 목표인 사이트에 맞는다(대신 자주 쓰면 광고처럼 보인다).
|
||||
*
|
||||
* ★ 문구에서 "실시간 캘린더" 를 걷어냈다(2026-09-09). 우리는 실시간 재고를 갖지 않는다
|
||||
* (PRODUCT.md 6절). 발행본이 하는 일 그대로 — 날짜·시간을 고르고 예약 창구로 잇는다 —
|
||||
* 을 말한다. 에디터가 보여주는 것이 곧 발행될 것이어야 한다.
|
||||
*/
|
||||
import {Calendar} from 'lucide-react';
|
||||
import {CtaLink, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {bookingHref} from '../common';
|
||||
|
||||
export function BookingBanner(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, template} = props;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} padded={false}>
|
||||
<div className="px-4 py-10 sm:px-6 sm:py-14" style={{backgroundColor: template.colors.primary}}>
|
||||
<div className="mx-auto flex max-w-[880px] flex-col items-center justify-between gap-5 text-center sm:flex-row sm:text-left">
|
||||
<div className="space-y-1.5 text-white">
|
||||
<h3 className="serif-title text-lg font-bold sm:text-2xl">
|
||||
{section.name}
|
||||
</h3>
|
||||
<p className="text-xs opacity-90 sm:text-sm">
|
||||
{section.body || section.description || `${storeName} · 날짜와 시간을 고르고 예약 창구로 이어집니다`}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<CtaLink href={bookingHref(industryId, storeName)} variant="pill">
|
||||
<Calendar className="size-3.5" />
|
||||
<span>날짜 · 시간 고르기</span>
|
||||
</CtaLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
/**
|
||||
* 예약 · 카드 — **발행본의 예약 안내를 그대로 미리 보여준다.**
|
||||
*
|
||||
* ★ 왜 갈아엎었나 (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 (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading title={section.name} subtitle={section.description} colors={template.colors} />
|
||||
|
||||
<div className="mx-auto max-w-lg overflow-hidden rounded-xl border border-stone-200/80 bg-white shadow-2xs">
|
||||
<p className="flex items-center gap-2 border-b border-stone-200/80 px-4 py-3 text-xs font-bold text-stone-900">
|
||||
<CalendarDays className="size-3.5 text-stone-400" />
|
||||
<span>날짜 · 시간 선택</span>
|
||||
</p>
|
||||
|
||||
<div className="space-y-4 p-4">
|
||||
<div>
|
||||
<p className="mb-1.5 text-[11px] font-semibold text-stone-400">날짜</p>
|
||||
<ul className="flex gap-1.5 overflow-hidden">
|
||||
{days.map((day, index) => (
|
||||
<li
|
||||
key={day.day}
|
||||
className="flex w-11 shrink-0 flex-col items-center gap-0.5 rounded-lg border px-2 py-1.5 text-xs"
|
||||
style={
|
||||
index === 0
|
||||
? {borderColor: accent, backgroundColor: accent, color: '#fff'}
|
||||
: {borderColor: 'rgb(231 229 228)', backgroundColor: 'rgb(250 250 249)'}
|
||||
}
|
||||
>
|
||||
<span className="text-[10px] opacity-70">{day.weekday}</span>
|
||||
<span className="font-bold">{day.day}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{slots.length > 0 && (
|
||||
<div>
|
||||
<p className="mb-1.5 flex items-center gap-1 text-[11px] font-semibold text-stone-400">
|
||||
<Clock className="size-3" />
|
||||
<span>도착 예정 시간 (체크인 {checkIn} 이후)</span>
|
||||
</p>
|
||||
<ul className="flex flex-wrap gap-1.5">
|
||||
{slots.map((time, index) => (
|
||||
<li
|
||||
key={time}
|
||||
className="rounded-md border px-2.5 py-1 text-xs"
|
||||
style={
|
||||
index === 0
|
||||
? {borderColor: accent, backgroundColor: accent, color: '#fff'}
|
||||
: {borderColor: 'rgb(231 229 228)', backgroundColor: 'rgb(250 250 249)'}
|
||||
}
|
||||
>
|
||||
{time}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-[11px] font-semibold text-stone-400">인원</p>
|
||||
<div className="flex items-center gap-2 text-stone-500">
|
||||
<span className="flex size-6 items-center justify-center rounded-md border border-stone-200">
|
||||
<Minus className="size-3" />
|
||||
</span>
|
||||
<span className="w-9 text-center text-sm font-bold text-stone-900">2명</span>
|
||||
<span className="flex size-6 items-center justify-center rounded-md border border-stone-200">
|
||||
<Plus className="size-3" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="rounded-lg px-4 py-2.5 text-center text-xs font-bold text-white"
|
||||
style={{backgroundColor: accent}}
|
||||
>
|
||||
예약 요청 확인하기
|
||||
</div>
|
||||
|
||||
{/* ★ 실제 예약이 되는 창구. 발행본과 같은 순서다 — 데모 다음에 진짜 창구가 온다. */}
|
||||
{phone && (
|
||||
<p className="flex items-center justify-center gap-1.5 text-[11px] text-stone-500">
|
||||
<Phone className="size-3" />
|
||||
<span>전화 예약 {phone}</span>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
/**
|
||||
* 시간의 골목 — 가로 연표.
|
||||
*
|
||||
* 연도가 큰 활자로 서고 사건이 그 아래 붙는다. 레일 위의 **붉은 점은 도시의 성격이 바뀐 해**다 —
|
||||
* 점의 색이 장식이 아니라 정보라서, 범례를 한 줄 달아 그 약속을 밝힌다.
|
||||
* ★ 연도가 없는 항목은 지어내 끼우지 않고 레일 끝으로 민다. 연표에서 틀린 순서는 바로 들킨다.
|
||||
*/
|
||||
import {useMemo} from 'react';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type ChronicleItem} from '@o2o/shared';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ITEM_INK,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
function Milestone({item, isLast}: {item: ChronicleItem; isLast: boolean}) {
|
||||
const turning = item.turning === true;
|
||||
|
||||
return (
|
||||
<div className="w-[228px] shrink-0 snap-center">
|
||||
<p
|
||||
className="leading-none"
|
||||
style={{fontFamily: ITEM_HEADING, fontSize: 34, color: turning ? ITEM_ACCENT : ITEM_INK}}
|
||||
>
|
||||
{item.year ?? '연도 미상'}
|
||||
</p>
|
||||
|
||||
{/* 레일 — 점이 선 위에 놓여야 '흐르는 시간 위의 한 해'로 읽힌다 */}
|
||||
<div className="relative my-3 h-3">
|
||||
<i
|
||||
aria-hidden
|
||||
className="absolute top-1/2 left-0 border-t"
|
||||
// 마지막 해에서 선이 끊긴다 — 레일이 화면 밖으로 이어지는 것처럼 보이면 뒤가 더 있는 줄 안다.
|
||||
style={{borderColor: ITEM_BORDER, right: isLast ? 'calc(100% - 12px)' : 0}}
|
||||
/>
|
||||
<i
|
||||
aria-hidden
|
||||
className="absolute top-1/2 left-0 size-3 -translate-y-1/2 rounded-full border-2"
|
||||
style={{
|
||||
backgroundColor: turning ? ITEM_ACCENT : ITEM_CARD,
|
||||
borderColor: turning ? ITEM_ACCENT : ITEM_BORDER,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 pr-5">
|
||||
<h4 className="text-base font-bold" style={{fontFamily: ITEM_BODY}}>
|
||||
{item.title}
|
||||
</h4>
|
||||
{item.summary && (
|
||||
<p className="text-[13px] leading-relaxed opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{item.summary}
|
||||
</p>
|
||||
)}
|
||||
{item.place && <p className="text-[11px] opacity-60">지금 이 자리 · {item.place}</p>}
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ChronicleRail(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<ChronicleItem>(section.type, section.data);
|
||||
|
||||
// 연도가 있는 것부터 오름차순, 없는 것은 뒤로. 붙여넣은 순서를 믿지 않는다.
|
||||
const items = useMemo(
|
||||
() =>
|
||||
[...parsed.items].sort((a, b) => {
|
||||
if (a.year == null) return b.year == null ? 0 : 1;
|
||||
if (b.year == null) return -1;
|
||||
return a.year - b.year;
|
||||
}),
|
||||
[parsed.items],
|
||||
);
|
||||
|
||||
const turningCount = items.filter((item) => item.turning === true).length;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="wide">
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : items.length === 0 ? (
|
||||
<PasteHint label="시간의 골목" />
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<p className="flex items-center gap-1.5 text-[11px] opacity-60">
|
||||
<i
|
||||
aria-hidden
|
||||
className="size-2.5 rounded-full"
|
||||
style={{backgroundColor: ITEM_ACCENT}}
|
||||
/>
|
||||
도시의 성격이 바뀐 해 {turningCount}개 · 전체 {items.length}개
|
||||
</p>
|
||||
|
||||
<Rail label="연표" gap={0}>
|
||||
{items.map((item, index) => (
|
||||
<Milestone
|
||||
key={`${item.year ?? 'x'}-${item.title}-${index}`}
|
||||
item={item}
|
||||
isLast={index === items.length - 1}
|
||||
/>
|
||||
))}
|
||||
</Rail>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
/**
|
||||
* 배리에이션들이 공유하는 데이터 갈무리.
|
||||
*
|
||||
* "어떤 사진을 대표로 쓰나 / 예약 링크는 어디로 가나" 같은 판단은 레이아웃과 무관하다.
|
||||
* 배리에이션마다 따로 정하면 같은 섹션인데 배리에이션을 바꾼 순간 링크가 달라진다.
|
||||
*
|
||||
* ★ 시연용 폴백은 없다.
|
||||
* 한때 이 파일은 달빛스테이(숙박 시연 세트)와 업종 시드 문구를 폴백으로 들고 있었고,
|
||||
* `demoOnly()` 게이트가 "실사업장에서만" 그걸 껐다. 그 구조 자체를 걷어냈다 —
|
||||
* 게이트가 한 곳이라도 빠지면 남의 가게 사진·전화번호·메뉴가 사장님 화면에 뜨고,
|
||||
* 사장님은 그게 자기 가게 내용인 줄 알고 그대로 발행한다.
|
||||
* 값이 없으면 **아무것도 그리지 않는다.** 발행 사이트(solution/site)와 같은 규칙이다.
|
||||
*/
|
||||
import type {IndustryType, InfoField, PhotoItem} from '@o2o/shared';
|
||||
import {INDUSTRY_CONFIGS} from '@/data/industryData';
|
||||
import type {TilePhoto} from '../primitives';
|
||||
|
||||
/** 화면에 찍히는 "언제 기준" 표기. 발행 사이트에서는 payload 의 updatedAt 이 이 자리를 대신한다. */
|
||||
export const TODAY_KO = new Date().toLocaleDateString('ko-KR', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
});
|
||||
|
||||
/**
|
||||
* 업종 설정(섹션 목록 · 템플릿 · 채널).
|
||||
*
|
||||
* ★ 여기에는 **구조만** 남아 있다. 문구·메뉴·FAQ 같은 콘텐츠 시드는 전부 지웠다 —
|
||||
* 가공의 가게 이름이 박힌 문장("포레스트 힐은 산자락 아래…")이 실사업장 화면에
|
||||
* 자기 소개문처럼 떴기 때문이다. 콘텐츠는 서버(fact·unit·faq)만 소유한다.
|
||||
*/
|
||||
export function industryConfig(industryId: IndustryType) {
|
||||
return INDUSTRY_CONFIGS[industryId];
|
||||
}
|
||||
|
||||
/**
|
||||
* 소개 문구.
|
||||
*
|
||||
* 수집·생성된 `intro` fact 만 쓴다. 없으면 빈 값을 돌려주고, 부르는 쪽이
|
||||
* "아직 소개문이 없습니다"를 그린다 — 남의 문장으로 자리를 메우지 않는다.
|
||||
*/
|
||||
export function introParagraph(_industryId: IndustryType, infoFields: InfoField[]): string {
|
||||
const collected = infoFields.find((f) => f.id === 'intro' || f.id === 'room_intro');
|
||||
return collected?.value?.trim() ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 소개 문구 축약본. `intro`/`room_intro` fact 가 길 때만 백엔드가 채워 보낸다(요청·응답에만
|
||||
* 실리고 DB 에는 남지 않는다). 없으면 빈 값 — 부르는 쪽이 원문(introParagraph)으로 떨어진다.
|
||||
*/
|
||||
export function introSummary(_industryId: IndustryType, infoFields: InfoField[]): string {
|
||||
const collected = infoFields.find((f) => f.id === 'intro' || f.id === 'room_intro');
|
||||
return collected?.summary?.trim() ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 이용 규정으로 읽히는 fact 들. 순서가 곧 화면 순서다.
|
||||
*
|
||||
* ★ 스키마에 있는 key 만 적는다. 여기 없는 규정은 만들지 않는다 —
|
||||
* 예전에는 '체크인 16:00 / 체크아웃 11:00' 같은 가공의 규정이 상수로 박혀 있어
|
||||
* 모든 사업장 화면에 똑같이 떴다. 사장님은 그게 자기 규정인 줄 알고 발행했다.
|
||||
*/
|
||||
const RULE_FIELD_IDS = [
|
||||
'check_in_time',
|
||||
'check_out_time',
|
||||
'cancel_policy',
|
||||
'cooking_allowed',
|
||||
'pet_allowed',
|
||||
'smoking',
|
||||
'extra_person_fee',
|
||||
];
|
||||
|
||||
/** 확인된 fact 에서만 이용 규정 줄을 만든다. 없으면 빈 목록 — 부르는 쪽이 빈 상태를 그린다. */
|
||||
export function ruleItems(infoFields: InfoField[]): string[] {
|
||||
return RULE_FIELD_IDS.map((id) => infoFields.find((f) => f.id === id))
|
||||
.filter((f): f is InfoField => Boolean(f?.value?.trim()))
|
||||
.map((f) => `${f.label}: ${f.value.trim()}`);
|
||||
}
|
||||
|
||||
/** 대표 사진. 지정이 없으면 첫 장으로 떨어진다 — 히어로가 빈 채로 나가지 않게. */
|
||||
export function primaryPhoto(photos: PhotoItem[]) {
|
||||
return photos.find((p) => p.isPrimary) ?? photos[0];
|
||||
}
|
||||
|
||||
/** 수집된 사진(props)을 갤러리 타일 모양으로. 캡션은 사진 제목을 그대로 쓴다. */
|
||||
function toTiles(photos: PhotoItem[]): TilePhoto[] {
|
||||
return photos.map((p) => ({
|
||||
id: p.id,
|
||||
url: p.url,
|
||||
alt: p.title,
|
||||
caption: p.title,
|
||||
category: p.category,
|
||||
}));
|
||||
}
|
||||
|
||||
/** 갤러리에 깔 사진 — 수집된 것만. 없으면 빈 목록이고, 부르는 쪽이 빈 상태를 그린다. */
|
||||
export function galleryPhotos(_industryId: IndustryType, photos: PhotoItem[]): TilePhoto[] {
|
||||
return toTiles(photos.filter((photo) => photo.isVisible !== false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 예약 버튼이 향할 곳.
|
||||
*
|
||||
* ★ 실사업장의 예약 채널(place_links)은 SectionRenderProps 로 흘러오지 않는다.
|
||||
* 그래서 상호 검색으로 떨어뜨린다 — 시연용 예약 링크를 붙이는 것보다 안전하다.
|
||||
* (확정된 링크를 쓰려면 계약에 채널 URL 을 얹어야 한다.)
|
||||
*/
|
||||
export function bookingHref(_industryId: IndustryType, storeName: string) {
|
||||
return `https://search.naver.com/search.naver?query=${encodeURIComponent(storeName)}`;
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
/**
|
||||
* 오늘의 한 장 — 뜯어 넘기는 일력.
|
||||
*
|
||||
* 이 팩에서 유일하게 캐러셀이 아니다. '오늘'은 하나여야 하니까. 다만 어제·내일이 양옆에
|
||||
* 반쯤 걸쳐 있어 넘길 수 있다는 걸 눈으로 알려 준다.
|
||||
*/
|
||||
import {useMemo, useState} from 'react';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type DailyItem} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ITEM_SURFACE,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
const DOW = ['일', '월', '화', '수', '목', '금', '토'];
|
||||
|
||||
function todayMonthDay(): string {
|
||||
const now = new Date();
|
||||
return `${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
/** MM-DD 를 올해 날짜로 읽어 요일을 낸다. 형식이 아니면 undefined — 지어내지 않는다. */
|
||||
function dowOf(monthDay: string): string | undefined {
|
||||
const m = /^(\d{2})-(\d{2})$/.exec(monthDay.trim());
|
||||
if (!m) return undefined;
|
||||
const date = new Date(new Date().getFullYear(), Number(m[1]) - 1, Number(m[2]));
|
||||
if (Number.isNaN(date.getTime())) return undefined;
|
||||
return DOW[date.getDay()];
|
||||
}
|
||||
|
||||
function CalendarPage({item, muted}: {item: DailyItem; muted?: boolean}) {
|
||||
const [month, day] = item.monthDay.split('-');
|
||||
const dow = dowOf(item.monthDay);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`w4-paper relative w-[254px] shrink-0 border shadow-[5px_6px_0_rgba(27,26,21,.13)] transition-all ${
|
||||
muted ? 'scale-[.93] opacity-45' : ''
|
||||
}`}
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{/* 뜯어낸 자국 */}
|
||||
<div
|
||||
className="w4-perf h-3.5 border-b border-dashed"
|
||||
style={{['--tear' as string]: ITEM_SURFACE, borderColor: ITEM_BORDER}}
|
||||
/>
|
||||
<div className="absolute inset-x-0 top-0 flex justify-around px-10">
|
||||
{[0, 1, 2].map((i) => (
|
||||
<i
|
||||
key={i}
|
||||
className="-mt-1 size-2 rounded-full border"
|
||||
style={{backgroundColor: ITEM_SURFACE, borderColor: ITEM_BORDER}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="border-b px-5 pb-3 pt-6 text-center" style={{borderColor: ITEM_BORDER}}>
|
||||
<p className="text-[11px] tracking-[0.2em] opacity-60">{month}月</p>
|
||||
<p className="mt-1 leading-none" style={{fontFamily: ITEM_HEADING, fontSize: 72, color: ITEM_ACCENT}}>
|
||||
{String(Number(day) || day)}
|
||||
</p>
|
||||
{dow && <p className="mt-1.5 text-[11px] tracking-[0.3em] opacity-75">{dow}曜</p>}
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 px-5 pb-5 pt-4">
|
||||
{item.category && (
|
||||
<p className="text-[10px] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
|
||||
{item.category}
|
||||
</p>
|
||||
)}
|
||||
<h3 className="text-base font-bold leading-snug" style={{fontFamily: ITEM_BODY}}>
|
||||
{item.title}
|
||||
</h3>
|
||||
{item.body && (
|
||||
<p className="text-[13px] leading-relaxed opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{item.body}
|
||||
</p>
|
||||
)}
|
||||
{item.tags && item.tags.length > 0 && (
|
||||
<p className="text-[10px] opacity-60">{item.tags.join(' ')}</p>
|
||||
)}
|
||||
<div className="border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function DailyCalendar(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<DailyItem>(section.type, section.data);
|
||||
|
||||
const items = useMemo(
|
||||
() => [...parsed.items].sort((a, b) => a.monthDay.localeCompare(b.monthDay)),
|
||||
[parsed.items],
|
||||
);
|
||||
|
||||
// 오늘 날짜가 목록에 없으면 오늘 **이후 첫 장**을 편다 — 지난 날짜를 오늘로 내걸지 않는다.
|
||||
const startIndex = useMemo(() => {
|
||||
if (items.length === 0) return 0;
|
||||
const today = todayMonthDay();
|
||||
const exact = items.findIndex((item) => item.monthDay === today);
|
||||
if (exact >= 0) return exact;
|
||||
const upcoming = items.findIndex((item) => item.monthDay >= today);
|
||||
return upcoming >= 0 ? upcoming : 0;
|
||||
}, [items]);
|
||||
|
||||
const [offset, setOffset] = useState(0);
|
||||
const index = items.length > 0 ? (startIndex + offset + items.length * 100) % items.length : 0;
|
||||
const at = (delta: number) => items[(index + delta + items.length) % items.length];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="wide">
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : items.length === 0 ? (
|
||||
<PasteHint label="오늘의 한 장" />
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<div className="w4-scroll flex items-start justify-center gap-5 overflow-x-auto pb-3">
|
||||
{items.length > 1 && <CalendarPage item={at(-1)} muted />}
|
||||
<CalendarPage item={items[index]} />
|
||||
{items.length > 1 && <CalendarPage item={at(1)} muted />}
|
||||
</div>
|
||||
{items.length > 1 && (
|
||||
<CarouselNav
|
||||
onPrev={() => setOffset((v) => v - 1)}
|
||||
onNext={() => setOffset((v) => v + 1)}
|
||||
label="날짜"
|
||||
/>
|
||||
)}
|
||||
<p className="text-center text-[11px] opacity-60">
|
||||
오늘 날짜에 맞는 장이 자동으로 펼쳐집니다 · 총 {items.length}장
|
||||
{parsed.unverified > 0 && ` · 확인 필요 ${parsed.unverified}장`}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* 관람 안내 · 갤러리 — 전시 사진을 크게 깔고 관람 정보를 옆에 붙인다.
|
||||
*/
|
||||
import {Clock, Ticket} from 'lucide-react';
|
||||
import {
|
||||
FeatureCard,
|
||||
PhotoTile,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
|
||||
export function ExhibitionGallery(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos, infoFields} = props;
|
||||
const items = galleryPhotos(industryId, photos).slice(0, 4);
|
||||
const hours = infoFields.find((f) => f.id === 'operating_hours');
|
||||
const fee = infoFields.find((f) => f.id === 'admission' || f.id === 'price_range');
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-2 gap-2.5 sm:gap-3">
|
||||
{items.map((photo) => (
|
||||
<PhotoTile key={photo.id} photo={photo} fit="landscape" />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
{hours && (
|
||||
<FeatureCard
|
||||
icon={Clock}
|
||||
title="관람 시간"
|
||||
description={hours.value}
|
||||
colors={template.colors}
|
||||
/>
|
||||
)}
|
||||
{fee && (
|
||||
<FeatureCard
|
||||
icon={Ticket}
|
||||
title="관람료"
|
||||
description={fee.value}
|
||||
colors={template.colors}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* 관람 안내 · 공지 — 사진 없이 안내 문구만. 전시 일정이 자주 바뀌는 곳에 부담이 적다.
|
||||
*/
|
||||
import {Info} from 'lucide-react';
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
|
||||
export function ExhibitionNotice(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, storeName, template, infoFields} = props;
|
||||
const notices = infoFields
|
||||
.filter((f) => !f.requiresVerification || f.isVerified)
|
||||
.slice(0, 4);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading
|
||||
variant="eyebrow"
|
||||
eyebrow="NOTICE"
|
||||
title={section.name}
|
||||
trailing={<Info className="size-5 text-stone-400" />}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="space-y-3 rounded-2xl border border-stone-200/80 bg-white p-5 shadow-2xs">
|
||||
<p className="text-xs leading-relaxed text-stone-600">
|
||||
{section.body || `${storeName}의 상설 전시와 아트숍은 별도 예약 없이 관람하실 수 있습니다. 기획 전시 일정은 변경될 수 있으니 방문 전 확인해 주세요.`}
|
||||
</p>
|
||||
|
||||
<dl className="space-y-2 border-t border-stone-100 pt-3">
|
||||
{notices.map((field) => (
|
||||
<div key={field.id} className="flex gap-3 text-xs">
|
||||
<dt className="w-20 shrink-0 font-semibold text-stone-400">{field.label}</dt>
|
||||
<dd className="font-medium text-stone-800" style={{color: template.colors.text}}>
|
||||
{field.value}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/**
|
||||
* FAQ · 아코디언 — 질문만 보이고 누르면 답이 열린다. 항목이 많아도 화면이 짧다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {ChevronDown, ChevronUp} from 'lucide-react';
|
||||
import {ListCard, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {faqEntries} from './useFaqList';
|
||||
|
||||
export function FaqAccordion(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template} = props;
|
||||
const faqs = faqEntries(industryId);
|
||||
const [openIdx, setOpenIdx] = useState<number | null>(0);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<ListCard>
|
||||
{faqs.map((faq, idx) => {
|
||||
const isOpen = openIdx === idx;
|
||||
|
||||
return (
|
||||
<div key={faq.question}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setOpenIdx(isOpen ? null : idx);
|
||||
}}
|
||||
aria-expanded={isOpen}
|
||||
style={{color: template.colors.text}}
|
||||
className="flex w-full cursor-pointer items-center justify-between gap-3 p-4 text-left text-xs font-bold text-stone-900 hover:bg-stone-50 sm:text-sm"
|
||||
>
|
||||
<span className="flex items-center gap-2.5">
|
||||
<span
|
||||
className="serif-title font-normal text-stone-400"
|
||||
style={{color: template.colors.accent}}
|
||||
>
|
||||
Q.
|
||||
</span>
|
||||
<span>{faq.question}</span>
|
||||
</span>
|
||||
{isOpen ? (
|
||||
<ChevronUp className="size-4 shrink-0 text-stone-400" />
|
||||
) : (
|
||||
<ChevronDown className="size-4 shrink-0 text-stone-400" />
|
||||
)}
|
||||
</button>
|
||||
|
||||
{isOpen && (
|
||||
<div className="border-t border-stone-50 bg-stone-50/40 px-4 pb-4 pt-1 text-xs leading-relaxed text-stone-600 sm:text-sm">
|
||||
{faq.answer}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</ListCard>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* FAQ · 펼친 목록 — 질문과 답을 모두 열어 둔다.
|
||||
* 손님이 클릭 없이 훑고 지나가게 하고 싶을 때(검색 노출에도 유리하다).
|
||||
*/
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {faqEntries} from './useFaqList';
|
||||
|
||||
export function FaqOpenList(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template} = props;
|
||||
const faqs = faqEntries(industryId);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<dl className="space-y-4">
|
||||
{faqs.map((faq) => (
|
||||
<div
|
||||
key={faq.question}
|
||||
className="space-y-1.5 rounded-xl border border-stone-200/80 bg-white p-4 shadow-2xs"
|
||||
>
|
||||
<dt
|
||||
className="flex items-start gap-2 text-xs font-bold text-stone-900 sm:text-sm"
|
||||
style={{color: template.colors.text}}
|
||||
>
|
||||
<span
|
||||
className="serif-title font-normal text-stone-400"
|
||||
style={{color: template.colors.accent}}
|
||||
>
|
||||
Q.
|
||||
</span>
|
||||
<span>{faq.question}</span>
|
||||
</dt>
|
||||
<dd className="flex items-start gap-2 text-xs leading-relaxed text-stone-600 sm:text-sm">
|
||||
<span className="serif-title font-normal text-stone-300">A.</span>
|
||||
<span>{faq.answer}</span>
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* FAQ · 2단 — 넓은 화면에서 두 줄씩 나눠 세로 길이를 반으로 줄인다.
|
||||
*/
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {faqEntries} from './useFaqList';
|
||||
|
||||
export function FaqTwoColumn(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template} = props;
|
||||
const faqs = faqEntries(industryId);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody width="wide">
|
||||
<SectionHeading
|
||||
variant="centered"
|
||||
eyebrow="FAQ"
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<dl className="grid grid-cols-1 gap-x-8 gap-y-5 md:grid-cols-2">
|
||||
{faqs.map((faq) => (
|
||||
<div key={faq.question} className="space-y-1.5 border-t border-stone-200/80 pt-4">
|
||||
<dt
|
||||
className="text-xs font-bold text-stone-900 sm:text-sm"
|
||||
style={{color: template.colors.text}}
|
||||
>
|
||||
{faq.question}
|
||||
</dt>
|
||||
<dd className="text-xs leading-relaxed text-stone-600">{faq.answer}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import type {IndustryType} from '@o2o/shared';
|
||||
|
||||
export interface FaqEntry {
|
||||
question: string;
|
||||
answer: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* FAQ 원본.
|
||||
*
|
||||
* ★ 지금은 항상 빈 목록이다. 캔버스 계약(SectionRenderProps)에 FAQ 가 없기 때문이다 —
|
||||
* 에디터는 구조적으로 실제 FAQ 를 받을 창구가 없다.
|
||||
*
|
||||
* ★ 업종 시드 FAQ 를 폴백으로 쓰던 코드를 걷어냈다. 그 안에는 가공의 값이 가격까지 붙어 있었고
|
||||
* ("숯과 그릴 세트(25,000원)", "기준 2인 초과 시 1인당 30,000원"), 사장님이 팔지도 않는
|
||||
* 조건을 자기 사이트로 읽었다. 손님이 그 금액으로 오면 클레임이다.
|
||||
*
|
||||
* 진짜 FAQ 는 COPY 잡이 **확인된 fact 만 근거로** 만들고 사장님 승인을 거쳐
|
||||
* 서버(fact.faqs)에 들어간다 — 그게 유일한 출처다. 캔버스로 흘려보내려면
|
||||
* SectionRenderProps 에 faqs 를 얹어야 한다.
|
||||
*/
|
||||
export function faqEntries(_industryId: IndustryType): FaqEntry[] {
|
||||
return [];
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/**
|
||||
* 히어로 · 표지 — 사진 한 장 위, 글은 좌하단.
|
||||
*
|
||||
* ★ 왜 가운데가 아닌가
|
||||
* 사진이 주인공인 화면에서 글자를 한가운데 얹으면 피사체를 정확히 가린다. 숙소 사진은
|
||||
* 가운데에 방이나 사람이 오는데, 상호가 그 위에 앉으면 둘 다 못 읽는다. 아래로 내리고
|
||||
* 그쪽만 어둡게 덮으면 사진은 사진대로 남고 글자는 글자대로 읽힌다.
|
||||
*
|
||||
* ★ 버튼을 세우지 않는다
|
||||
* 첫 화면에서 물어볼 것은 "방을 보겠는가" 하나다. 예약 버튼은 아래 예약 섹션이 맡고,
|
||||
* 여기서는 다음 섹션으로 눈을 내려보내기만 한다.
|
||||
*
|
||||
* ★ 색을 직접 쓰지 않는다
|
||||
* `bg-stone-900` 같은 고정색을 두면 '옛 항구'(갱지)를 골라도 첫 화면만 검게 남는다.
|
||||
* 어두운 면은 `--tpl-inverse`, 그 위 글자는 `--tpl-bg` 다 — 팔레트가 바뀌면 같이 바뀐다.
|
||||
*/
|
||||
import {ChevronDown, MapPin} from 'lucide-react';
|
||||
import {SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {primaryPhoto} from '../common';
|
||||
|
||||
/** 사진 위 글자가 놓이는 아래쪽만 짙게. 위쪽은 사진을 그대로 보여준다. */
|
||||
const SCRIM =
|
||||
'linear-gradient(to top,' +
|
||||
' color-mix(in srgb, var(--tpl-inverse, #1c1917) 88%, transparent) 0%,' +
|
||||
' color-mix(in srgb, var(--tpl-inverse, #1c1917) 45%, transparent) 34%,' +
|
||||
' transparent 66%)';
|
||||
|
||||
export function HeroCover(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, storeName, location, photos} = props;
|
||||
|
||||
// 사진이 없으면 <img> 없이 어두운 판만 남긴다 — 시연용 사진으로 자리를 메우지 않는다.
|
||||
const cover = primaryPhoto(photos);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} padded={false}>
|
||||
<div
|
||||
className="relative flex w-full select-none items-end overflow-hidden"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-inverse, #1c1917)',
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
minHeight: 'clamp(24rem, 62vh, 36rem)',
|
||||
}}
|
||||
>
|
||||
{cover?.url && (
|
||||
<div className="absolute inset-0 z-0">
|
||||
<img src={cover.url} alt={storeName} className="size-full object-cover object-center" />
|
||||
<div className="absolute inset-0" style={{background: SCRIM}} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="shell relative z-10 pb-10 pt-24 sm:pb-12">
|
||||
{location && (
|
||||
<p className="mb-3 inline-flex items-center gap-1 text-[length:var(--fs-xs)] opacity-80">
|
||||
<MapPin className="size-3.5" aria-hidden />
|
||||
{location}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* ★ tpl-title — 굵기를 템플릿이 정한다. 간판체(Gugi)는 굵기가 한 벌뿐이라
|
||||
700 을 주면 브라우저가 가짜 볼드를 씌워 획이 뭉갠다. */}
|
||||
<h1
|
||||
className="tpl-title leading-[1.15]"
|
||||
style={{fontSize: 'var(--fs-display)'}}
|
||||
>
|
||||
{storeName}
|
||||
</h1>
|
||||
|
||||
{/*
|
||||
* ★ 여기에 `section.description` 을 쓰지 않는다.
|
||||
* 그 칸은 에디터의 섹션 설명("상단 메인 비주얼과 대표 문구")이라, 캔버스에 그리면
|
||||
* 사장님 화면에 우리 UI 안내문이 자기 소개문처럼 박힌다. 실제로 그렇게 나갔다.
|
||||
* 대표 문구는 수집·생성된 값이 생기기 전까지 **아무것도 그리지 않는다.**
|
||||
*/}
|
||||
|
||||
<p className="mt-6 inline-flex items-center gap-1 text-[length:var(--fs-sm)] opacity-80">
|
||||
객실 보기
|
||||
<ChevronDown className="size-4" aria-hidden />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* 히어로 · 좌우 분할 — 왼쪽 글, 오른쪽 사진.
|
||||
* 첫 화면에서 "무엇을 파는 곳인지"를 글로 먼저 읽혀야 하는 업종에 맞는다.
|
||||
*/
|
||||
import {SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {industryConfig, primaryPhoto} from '../common';
|
||||
|
||||
export function HeroSplit(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, location, template, photos} = props;
|
||||
const config = industryConfig(industryId);
|
||||
const cover = primaryPhoto(photos);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} padded={false}>
|
||||
<div className="p-6 sm:p-10" style={{backgroundColor: template.colors.bg}}>
|
||||
<div className="mx-auto grid max-w-4xl grid-cols-1 items-center gap-6 md:grid-cols-12">
|
||||
<div className="space-y-4 md:col-span-7">
|
||||
<span
|
||||
className="inline-flex items-center gap-2 rounded px-2.5 py-1 text-xs font-semibold"
|
||||
style={{
|
||||
backgroundColor: `${template.colors.primary}12`,
|
||||
color: template.colors.primary,
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className="size-1.5 rounded-full"
|
||||
style={{backgroundColor: template.colors.primary}}
|
||||
/>
|
||||
{section.description || `${config.name} · ${location}`}
|
||||
</span>
|
||||
|
||||
<h1
|
||||
className="text-2xl font-extrabold leading-tight tracking-tight sm:text-4xl"
|
||||
style={{color: template.colors.text}}
|
||||
>
|
||||
{storeName}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div className="md:col-span-5">
|
||||
<div className="relative aspect-4/3 overflow-hidden rounded-lg border border-slate-200/60 shadow-xs">
|
||||
<img src={cover?.url} alt={storeName} className="size-full object-cover" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* 기본 정보 · 카드 — 항목마다 한 장씩. 모바일에서 손가락으로 훑기 좋다.
|
||||
*/
|
||||
import {
|
||||
HiddenFieldsNotice,
|
||||
InfoRow,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {TODAY_KO} from '../common';
|
||||
|
||||
export function InfoCards(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template, infoFields} = props;
|
||||
const visible = infoFields.filter((f) => !f.requiresVerification || f.isVerified);
|
||||
const hidden = infoFields.filter((f) => f.requiresVerification && !f.isVerified).length;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
trailing={<HiddenFieldsNotice count={hidden} />}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2">
|
||||
{visible.map((field) => (
|
||||
<InfoRow key={field.id} field={field} variant="card" colors={template.colors} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="text-right">
|
||||
<span className="font-mono text-[11px] text-stone-400">* {TODAY_KO} 기준 정보입니다.</span>
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* 기본 정보 · 한 줄 요약 — 값들을 문장처럼 이어 붙인 가장 좁은 형태.
|
||||
* 정보가 적거나, 아래 섹션으로 빨리 넘기고 싶을 때.
|
||||
*/
|
||||
import {
|
||||
HiddenFieldsNotice,
|
||||
InfoRow,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {TODAY_KO} from '../common';
|
||||
|
||||
export function InfoInline(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template, infoFields} = props;
|
||||
const visible = infoFields.filter((f) => !f.requiresVerification || f.isVerified);
|
||||
const hidden = infoFields.filter((f) => f.requiresVerification && !f.isVerified).length;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading
|
||||
variant="minimal"
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
trailing={<HiddenFieldsNotice count={hidden} />}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="flex flex-wrap gap-x-5 gap-y-2.5 rounded-xl border border-stone-200/70 bg-stone-50/60 p-4">
|
||||
{visible.map((field) => (
|
||||
<InfoRow key={field.id} field={field} variant="inline" colors={template.colors} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<span className="block font-mono text-[11px] text-stone-400">* {TODAY_KO} 기준</span>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* 기본 정보 · 표 — 라벨과 값을 선으로 나눈 가장 읽기 쉬운 형태.
|
||||
* 항목이 많아도 눈이 안 흔들린다.
|
||||
*/
|
||||
import {
|
||||
HiddenFieldsNotice,
|
||||
InfoRow,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {TODAY_KO} from '../common';
|
||||
|
||||
export function InfoTable(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template, infoFields} = props;
|
||||
const visible = infoFields.filter((f) => !f.requiresVerification || f.isVerified);
|
||||
const hidden = infoFields.filter((f) => f.requiresVerification && !f.isVerified).length;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
trailing={<HiddenFieldsNotice count={hidden} />}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="overflow-hidden rounded-xl border border-stone-200/80 bg-stone-50/60 [&>*+*]:border-t [&>*+*]:border-stone-200/70">
|
||||
{visible.map((field) => (
|
||||
<InfoRow key={field.id} field={field} variant="row" colors={template.colors} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="text-right">
|
||||
<span className="font-mono text-[11px] text-stone-400">* {TODAY_KO} 기준 정보입니다.</span>
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* 문의 · 연락 카드 — 전화 / 카카오 / 인스타로 바로 보낸다.
|
||||
* 폼을 받을 준비가 안 된 사장님에게는 이쪽이 사고가 없다.
|
||||
*/
|
||||
import {Phone} from 'lucide-react';
|
||||
import {
|
||||
EmptyStateNotice,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
|
||||
export function InquiryCta(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, storeName, template} = props;
|
||||
// ★ 연락처(place_links)는 SectionRenderProps 로 흘러오지 않는다. 값이 생기기 전까지
|
||||
// 버튼째 숨긴다 — 시연용 번호를 붙이면 남의 가게로 전화가 간다.
|
||||
const phone = props.infoFields.find((f) => f.id === 'phone')?.value?.trim();
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading variant="centered" title={section.name} subtitle={section.description} />
|
||||
|
||||
<div className="flex flex-col items-center gap-3 rounded-2xl border border-stone-200/80 bg-stone-50/70 p-6 text-center">
|
||||
<p className="text-xs leading-relaxed text-stone-600">
|
||||
{section.body || `${storeName} 단체·대관 문의는 아래로 연락 주시면 담당자가 안내해 드립니다.`}
|
||||
</p>
|
||||
|
||||
{phone ? (
|
||||
<div className="flex flex-wrap items-center justify-center gap-2">
|
||||
<a
|
||||
href={`tel:${phone}`}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="inline-flex items-center gap-1.5 rounded-xl px-5 py-2.5 text-xs font-semibold text-white shadow-xs transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: template.colors.primary}}
|
||||
>
|
||||
<Phone className="size-3.5" />
|
||||
<span>{phone}</span>
|
||||
</a>
|
||||
</div>
|
||||
) : (
|
||||
<EmptyStateNotice>연락처는 아직 준비 중입니다.</EmptyStateNotice>
|
||||
)}
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/**
|
||||
* 문의 · 신청서 — 인원/일정/연락처를 받는 양식.
|
||||
*
|
||||
* ★ 캔버스는 미리보기다. 여기서 제출은 실제로 나가지 않는다 —
|
||||
* 그 사실을 화면에 적어 둬야 사장님이 "접수됐겠지" 하고 넘어가지 않는다.
|
||||
*/
|
||||
import {Send} from 'lucide-react';
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
|
||||
const FIELDS = [
|
||||
{id: 'name', label: '성함 / 단체명', placeholder: '홍길동 / ○○기업 총무팀'},
|
||||
{id: 'contact', label: '연락처', placeholder: '010-0000-0000'},
|
||||
{id: 'date', label: '희망 일자', placeholder: '2026-09-14'},
|
||||
{id: 'headcount', label: '예상 인원', placeholder: '20명'},
|
||||
];
|
||||
|
||||
export function InquiryForm(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template} = props;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading title={section.name} subtitle={section.description} />
|
||||
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
role="presentation"
|
||||
className="space-y-3 rounded-2xl border border-stone-200/80 bg-white p-5 shadow-2xs"
|
||||
>
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
{FIELDS.map((field) => (
|
||||
<label key={field.id} className="space-y-1">
|
||||
<span className="block text-[11px] font-semibold text-stone-500">
|
||||
{field.label}
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
placeholder={field.placeholder}
|
||||
className="w-full rounded-lg border border-stone-200 bg-stone-50 px-3 py-2 text-xs focus:bg-white focus:outline-none"
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<label className="block space-y-1">
|
||||
<span className="block text-[11px] font-semibold text-stone-500">문의 내용</span>
|
||||
<textarea
|
||||
rows={3}
|
||||
placeholder="행사 성격, 필요한 준비물, 예산 등을 적어 주세요."
|
||||
className="w-full resize-none rounded-lg border border-stone-200 bg-stone-50 px-3 py-2 text-xs focus:bg-white focus:outline-none"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex w-full cursor-not-allowed items-center justify-center gap-1.5 rounded-xl px-5 py-2.5 text-xs font-semibold text-white opacity-90"
|
||||
style={{backgroundColor: template.colors.primary}}
|
||||
>
|
||||
<Send className="size-3.5" />
|
||||
<span>문의 보내기</span>
|
||||
</button>
|
||||
|
||||
<p className="text-center text-[10px] text-stone-400">
|
||||
미리보기 화면입니다 — 실제 접수는 발행 후 동작합니다.
|
||||
</p>
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* 소개 · 가운데 정렬 — 짧은 문단 하나로 끝내는 가장 조용한 구성.
|
||||
*/
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {EmptyStateNotice} from '../../primitives';
|
||||
import {introParagraph} from '../common';
|
||||
|
||||
export function IntroCentered(props: SectionRenderProps) {
|
||||
const intro = props.section.body?.trim() || introParagraph(props.industryId, props.infoFields);
|
||||
const {section, isSelected, onSelect, storeName, template} = props;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading
|
||||
variant="centered"
|
||||
eyebrow="ABOUT US"
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
{intro ? (
|
||||
<p className="text-center text-xs leading-relaxed text-stone-600 sm:text-sm">
|
||||
{intro}
|
||||
</p>
|
||||
) : (
|
||||
<EmptyStateNotice>
|
||||
아직 소개문이 없습니다 — 확인된 정보만 근거로 씁니다.
|
||||
</EmptyStateNotice>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* 소개 · 사진 옆 글 — 왼쪽 세로 사진, 오른쪽 문단 + 특징 목록.
|
||||
* 사진과 설명을 같은 눈높이에서 함께 읽히고 싶을 때.
|
||||
*/
|
||||
import {EmptyStateNotice, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {primaryPhoto, introParagraph, introSummary} from '../common';
|
||||
|
||||
export function IntroSideBySide(props: SectionRenderProps) {
|
||||
const intro =
|
||||
props.section.body?.trim() ||
|
||||
introSummary(props.industryId, props.infoFields) ||
|
||||
introParagraph(props.industryId, props.infoFields);
|
||||
const {section, isSelected, onSelect, storeName, template, photos} = props;
|
||||
const shot = photos[1] ?? primaryPhoto(photos);
|
||||
// 사진이 없으면 회색 판만 남기고 <img> 는 렌더하지 않는다.
|
||||
const shotUrl = shot?.url;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
variant="eyebrow"
|
||||
eyebrow="ABOUT"
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-1 items-center gap-6 md:grid-cols-12">
|
||||
<div className="md:col-span-5">
|
||||
<div className="relative aspect-3/4 overflow-hidden rounded-2xl border border-stone-200/80 bg-stone-100">
|
||||
{shotUrl && (
|
||||
<img src={shotUrl} alt={`${storeName} 공간`} className="size-full object-cover" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4 md:col-span-7">
|
||||
{intro ? (
|
||||
<p className="text-xs leading-relaxed text-stone-700 sm:text-sm">{intro}</p>
|
||||
) : (
|
||||
<EmptyStateNotice>
|
||||
아직 소개문이 없습니다 — 확인된 정보만 근거로 씁니다.
|
||||
</EmptyStateNotice>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* 소개 · 스토리 — 넓은 사진 한 장 아래로 문단이 흐르는 잡지식 구성.
|
||||
*/
|
||||
import {EmptyStateNotice, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {introParagraph, introSummary} from '../common';
|
||||
|
||||
export function IntroStory(props: SectionRenderProps) {
|
||||
const intro =
|
||||
props.section.body?.trim() ||
|
||||
introSummary(props.industryId, props.infoFields) ||
|
||||
introParagraph(props.industryId, props.infoFields);
|
||||
const {section, isSelected, onSelect, storeName, template, photos} = props;
|
||||
const shotUrl = photos[1]?.url;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="relative aspect-16/9 overflow-hidden rounded-xl border border-stone-200/80 bg-stone-100 sm:aspect-21/9">
|
||||
{shotUrl && (
|
||||
<img src={shotUrl} alt={`${storeName} 공간`} className="size-full object-cover" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
{intro ? (
|
||||
<p className="font-sans text-xs leading-relaxed text-stone-700 sm:text-base">
|
||||
{intro}
|
||||
</p>
|
||||
) : (
|
||||
<EmptyStateNotice>
|
||||
아직 소개문이 없습니다 — 확인된 정보만 근거로 씁니다.
|
||||
</EmptyStateNotice>
|
||||
)}
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
/**
|
||||
* 붙여넣기 아이템이 공유하는 조각 — 색·서체 토큰, 출처 각주, 캐러셀 화살표.
|
||||
*
|
||||
* ★ 색과 서체를 여기에 박지 않는다. 전부 템플릿 토큰(`--tpl-*`)을 읽는다 —
|
||||
* 한때 이 파일은 갱지색·주(朱)잉크·간판체를 hex 와 폰트명으로 들고 있었고,
|
||||
* 그 바람에 사장님이 템플릿을 매거진으로 바꿔도 아이템만 레트로로 남았다.
|
||||
* 아이템은 '레트로 전용 부품'이 아니라 **어느 템플릿에나 들어가는 섹션**이다.
|
||||
* ★ 질감(도넛판 홈·톱니·펀치 구멍)은 남긴다 — 그건 색이 아니라 물건의 생김새다.
|
||||
* 질감의 색도 토큰을 따라가게 `items.css` 에서 var() 로 받는다.
|
||||
*/
|
||||
import {ChevronLeft, ChevronRight, MousePointerClick} from 'lucide-react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import type {DataSource, DataVerified} from '@o2o/shared';
|
||||
|
||||
/** 제목 서체. 템플릿이 정한다(심플=고딕 · 매거진=명조 · 레트로=간판체). */
|
||||
export const ITEM_HEADING = 'var(--tpl-font-heading, inherit)';
|
||||
/** 본문 서체. */
|
||||
export const ITEM_BODY = 'var(--tpl-font-body, inherit)';
|
||||
|
||||
/** 섹션 바탕. */
|
||||
export const ITEM_SURFACE = 'var(--tpl-surface, #faf7f2)';
|
||||
/** 카드·종이 면. 섹션 바탕보다 한 단계 앞이다. */
|
||||
export const ITEM_CARD = 'var(--tpl-card, #ffffff)';
|
||||
/** 글자색. */
|
||||
export const ITEM_INK = 'var(--tpl-text, #1c1917)';
|
||||
/** 선·테두리. */
|
||||
export const ITEM_BORDER = 'var(--tpl-border, #d6d3d1)';
|
||||
/**
|
||||
* 강조 — 연표의 전환점, 일력의 날짜, 소인 도장.
|
||||
*
|
||||
* ★ 템플릿 강조색을 **그대로 쓰지 않고 둘레 글자색을 섞는다.** 팔레트에 따라 accent 가
|
||||
* 바탕과 거의 같은 밝기일 수 있는데(연한 베이지·파스텔), 그러면 큰 날짜 숫자와 배지가
|
||||
* 화면에서 사라진다. 섞으면 색조는 남고 대비만 확보된다 —
|
||||
* currentColor 라서 어두운 면에서는 밝은 쪽으로, 밝은 면에서는 어두운 쪽으로 붙는다.
|
||||
*/
|
||||
export const ITEM_ACCENT = 'color-mix(in oklab, var(--tpl-accent, #bf2f1b) 70%, currentColor)';
|
||||
/** 어두운 면(필름·플립보드·턴테이블). */
|
||||
export const ITEM_INVERSE = 'var(--tpl-inverse, #1c1917)';
|
||||
/**
|
||||
* 어두운 면 위의 글자색.
|
||||
*
|
||||
* ★ 흰색을 박지 않는다. 템플릿 배경색을 글자색으로 쓰면 어떤 팔레트에서도 대비가 선다 —
|
||||
* 밝은 템플릿이면 밝은 글자, 어두운 템플릿이면 그 템플릿이 정한 밝은 면 색이다.
|
||||
*/
|
||||
export const ITEM_INVERSE_INK = 'var(--tpl-bg, #ffffff)';
|
||||
|
||||
/**
|
||||
* 출처 한 줄 + 확신 배지.
|
||||
*
|
||||
* ★ 확인되지 않은 값을 숨기지 않고 **드러낸다.** 숨기면 사장님이 그게 미검증인 줄 모르고 발행한다.
|
||||
* ★ 배지 색만은 토큰이 아니다 — '확인/확인필요'는 디자인이 아니라 신호다. 템플릿 색을 따라가면
|
||||
* 팔레트에 따라 경고가 안 보이는 색이 될 수 있다.
|
||||
*/
|
||||
export function SourceLine({
|
||||
source,
|
||||
verified,
|
||||
tone = 'light',
|
||||
}: {
|
||||
source?: DataSource;
|
||||
verified?: DataVerified;
|
||||
tone?: 'light' | 'dark';
|
||||
}) {
|
||||
if (!source && !verified) return null;
|
||||
|
||||
return (
|
||||
<p
|
||||
className={cn('flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px]', tone === 'dark' ? 'opacity-70' : 'opacity-65')}
|
||||
>
|
||||
{verified && (
|
||||
<span
|
||||
className="border px-1.5 py-px"
|
||||
// ★ 신호색(초록/호박)은 유지하되 둘레 글자색을 섞는다 — 어두운 면에서는 밝아지고
|
||||
// 밝은 면에서는 진해져, 어떤 팔레트에서도 배지가 읽힌다.
|
||||
style={{
|
||||
color: `color-mix(in oklab, ${verified === '확인' ? '#2a6053' : '#b07d10'} 62%, currentColor)`,
|
||||
borderColor: 'currentColor',
|
||||
}}
|
||||
>
|
||||
{verified}
|
||||
</span>
|
||||
)}
|
||||
{source?.name && (
|
||||
<span>
|
||||
출처 ·{' '}
|
||||
{source.url ? (
|
||||
<a
|
||||
href={source.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
className="underline underline-offset-2"
|
||||
>
|
||||
{source.name}
|
||||
</a>
|
||||
) : (
|
||||
source.name
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 앞뒤 버튼 한 쌍.
|
||||
*
|
||||
* ★ 가로 슬라이더에는 쓰지 않는다 — 그건 `Rail`(embla)이 자기 화살표를 갖는다.
|
||||
* 여기 남은 쓰임은 **스크롤이 아닌 이동**이다(일력: 장을 넘겨 오늘 자리를 바꾼다).
|
||||
*/
|
||||
export function CarouselNav({
|
||||
onPrev,
|
||||
onNext,
|
||||
tone = 'light',
|
||||
label,
|
||||
}: {
|
||||
onPrev: () => void;
|
||||
onNext: () => void;
|
||||
tone?: 'light' | 'dark';
|
||||
label: string;
|
||||
}) {
|
||||
const dark = tone === 'dark';
|
||||
const style = {
|
||||
borderColor: dark ? 'color-mix(in oklab, currentColor 35%, transparent)' : ITEM_BORDER,
|
||||
backgroundColor: dark ? 'transparent' : ITEM_CARD,
|
||||
color: 'inherit',
|
||||
};
|
||||
const stop = (fn: () => void) => (event: React.MouseEvent) => {
|
||||
event.stopPropagation();
|
||||
fn();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex justify-end gap-1.5">
|
||||
<button
|
||||
type="button"
|
||||
className="flex size-8 items-center justify-center border transition-opacity hover:opacity-70"
|
||||
style={style}
|
||||
onClick={stop(onPrev)}
|
||||
aria-label={`${label} 이전`}
|
||||
>
|
||||
<ChevronLeft className="size-4" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="flex size-8 items-center justify-center border transition-opacity hover:opacity-70"
|
||||
style={style}
|
||||
onClick={stop(onNext)}
|
||||
aria-label={`${label} 다음`}
|
||||
>
|
||||
<ChevronRight className="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 붙여넣을 JSON 이 아직 없을 때 — 어디로 가야 하는지 말해 준다.
|
||||
*
|
||||
* ★ 그냥 "준비 중"이라고 두면 사장님은 이 섹션이 자동으로 채워지는 줄 알고 기다린다.
|
||||
* ★ 이건 발행되지 않는 **에디터 안내**다. 그래서 템플릿 색이 아니라 관리자 색을 그대로 쓴다.
|
||||
*/
|
||||
export function PasteHint({label}: {label: string}) {
|
||||
return (
|
||||
<div className="flex flex-col items-center gap-2 border border-dashed border-stone-400/70 bg-white/50 px-4 py-8 text-center">
|
||||
<MousePointerClick className="size-4 text-stone-400" />
|
||||
<p className="text-xs font-semibold text-stone-600">{label} 내용이 아직 없습니다</p>
|
||||
<p className="max-w-[34ch] text-[11px] leading-relaxed text-stone-500">
|
||||
오른쪽 [콘텐츠] 탭에서 프롬프트를 복사해 ChatGPT 에 넣고, 받은 JSON 을 붙여넣으면 바로 여기에 그려집니다.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** 파싱이 깨졌을 때. 캔버스를 비우지 않고 왜 안 그려지는지 그 자리에 말한다(에디터 안내라 관리자 색). */
|
||||
export function ParseError({message}: {message: string}) {
|
||||
return (
|
||||
<div className="border border-dashed border-red-400/70 bg-red-50/70 px-4 py-5 text-center">
|
||||
<p className="text-xs font-semibold text-red-700">붙여넣은 JSON 을 읽지 못했습니다</p>
|
||||
<p className="mt-1.5 text-[11px] leading-relaxed text-red-600">{message}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/**
|
||||
* 붙여넣기 아이템의 질감 — Tailwind 로는 못 그리는 것만 여기 둔다.
|
||||
* 도넛판 홈, 종이 결, 톱니, 필름 구멍, 시험지 뒤집기.
|
||||
*
|
||||
* ★ 색은 전부 템플릿 토큰(--tpl-*)에서 받는다. 한때 갱지색·먹색을 hex 로 박아 뒀는데,
|
||||
* 템플릿을 바꿔도 이 질감들만 레트로 색으로 남아 화면이 두 벌로 보였다.
|
||||
*/
|
||||
|
||||
/* 종이 결 — 두 방향이 겹쳐야 종이로 읽힌다. 글자색을 옅게 깔아 어떤 팔레트에서도 결이 보인다. */
|
||||
.w4-paper {
|
||||
background-image:
|
||||
repeating-linear-gradient(0deg, color-mix(in oklab, currentcolor 4%, transparent) 0 1px, transparent 1px 3px),
|
||||
repeating-linear-gradient(90deg, color-mix(in oklab, currentcolor 3%, transparent) 0 1px, transparent 1px 4px);
|
||||
}
|
||||
|
||||
/* 도넛판. --lbl 이 라벨 색이다. */
|
||||
.w4-disc {
|
||||
/* 판의 검정은 템플릿의 어두운 면(--tpl-inverse)이다. 홈은 그 위에 밝기 차로만 판다. */
|
||||
background:
|
||||
radial-gradient(circle at 50% 50%, transparent 0 15.5%, var(--lbl) 15.5% 33%, transparent 33%),
|
||||
repeating-radial-gradient(
|
||||
circle at 50% 50%,
|
||||
color-mix(in oklab, var(--w4-vinyl) 88%, white) 0 1.4px,
|
||||
var(--w4-vinyl) 1.4px 3px
|
||||
),
|
||||
var(--w4-vinyl);
|
||||
box-shadow: inset 0 0 40px rgb(0 0 0 / 55%);
|
||||
}
|
||||
.w4-disc-sheen {
|
||||
background: conic-gradient(
|
||||
from 210deg,
|
||||
rgb(255 255 255 / 12%),
|
||||
transparent 22%,
|
||||
transparent 70%,
|
||||
rgb(255 255 255 / 7%)
|
||||
);
|
||||
}
|
||||
.w4-spin {
|
||||
animation: w4-rev 2.2s linear infinite;
|
||||
}
|
||||
@keyframes w4-rev {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* 미니 판 — 캐러셀에 늘어서는 작은 것. */
|
||||
.w4-disc-mini {
|
||||
background:
|
||||
radial-gradient(circle at 50% 50%, transparent 0 14%, var(--lbl) 14% 34%, transparent 34%),
|
||||
repeating-radial-gradient(
|
||||
circle at 50% 50%,
|
||||
color-mix(in oklab, var(--w4-vinyl) 88%, white) 0 1.2px,
|
||||
var(--w4-vinyl) 1.2px 2.6px
|
||||
),
|
||||
var(--w4-vinyl);
|
||||
box-shadow: 0 3px 10px rgb(0 0 0 / 35%);
|
||||
}
|
||||
|
||||
/* 일력 톱니 — 뜯어낸 자국. --tear 는 섹션 바탕색이 들어온다(뜯긴 자리로 바탕이 비쳐야 한다). */
|
||||
.w4-perf {
|
||||
background: repeating-linear-gradient(90deg, transparent 0 8px, var(--tear) 8px 9px);
|
||||
}
|
||||
|
||||
/* 승차권 절취선 */
|
||||
.w4-dash {
|
||||
border-top: 1px dashed currentcolor;
|
||||
}
|
||||
|
||||
/* 필름 퍼포레이션 — 위아래 구멍이 있어야 한 장면이 아니라 '롤'로 읽힌다.
|
||||
구멍은 currentColor(어두운 면 위의 글자색)로 뚫어 팔레트를 따른다. */
|
||||
.w4-film-perf {
|
||||
background: repeating-linear-gradient(90deg, currentcolor 0 9px, transparent 9px 21px);
|
||||
}
|
||||
|
||||
/* 시험지 뒤집기. 카드가 얇아 보이지 않게 두 면을 같은 자리에 겹쳐 둔다. */
|
||||
.w4-flip {
|
||||
perspective: 900px;
|
||||
}
|
||||
.w4-flip-inner {
|
||||
transform-style: preserve-3d;
|
||||
transition: transform 0.5s;
|
||||
}
|
||||
.w4-flip-on .w4-flip-inner {
|
||||
transform: rotateY(180deg);
|
||||
}
|
||||
.w4-flip-face {
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
.w4-flip-back {
|
||||
transform: rotateY(180deg);
|
||||
}
|
||||
|
||||
/*
|
||||
* 가로 슬라이더의 창(viewport).
|
||||
*
|
||||
* 스크립트가 붙기 전에는 그냥 가로 스크롤 상자다. embla 가 붙으면 `data-slider="on"` 이
|
||||
* 걸리고 그때부터 드래그가 스크롤을 대신한다 — 둘을 같이 켜면 관성이 겹쳐 튄다.
|
||||
*/
|
||||
.w4-scroll {
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
scroll-snap-type: x mandatory;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.w4-scroll::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.w4-scroll[data-slider='on'] {
|
||||
overflow-x: hidden;
|
||||
scroll-snap-type: none;
|
||||
}
|
||||
/* 문장을 잡으면 카드가 안 끌린다 — 끄는 동안만 선택을 끈다. */
|
||||
.w4-scroll[data-dragging='true'] {
|
||||
cursor: grabbing;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.w4-spin {
|
||||
animation: none;
|
||||
}
|
||||
.w4-flip-inner {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
-194
@@ -1,194 +0,0 @@
|
||||
/**
|
||||
* 추천 일정 — 캔버스. 승차권 한 장이 정거장 하나다.
|
||||
*
|
||||
* ★ 셋을 합친 자리다(반나절 산책 · 여행 스케줄 · 계절별 추천 하루). 축이 계절이 아니라 **기간**이다.
|
||||
* ★ 순위를 매기지 않는다 — 어느 일정이 1위인지는 우리가 정할 일이 아니다.
|
||||
* ★ 시각은 사장님이 적는 게 아니라 **계산한다**. 출발 시각 + 이동 + 머무는 시간.
|
||||
* 출발을 당기면 하루가 통째로 밀린다.
|
||||
* ★ 사장님이 붙여넣은 것이 없으면 **서버가 만든 일정**을 쓴다(useLocalGuide). 발행본
|
||||
* ItinerarySection 과 같은 폴백이다 — 둘이 갈리면 "미리보기와 다르다"가 된다.
|
||||
*/
|
||||
import {
|
||||
currentSeasons,
|
||||
inSeason,
|
||||
itineraryDays,
|
||||
itineraryDurations,
|
||||
parseSectionData,
|
||||
type ItineraryItem,
|
||||
type PlannedStop,
|
||||
} from '@o2o/shared';
|
||||
import {useLocalGuide} from '@/hooks/useLocalGuide';
|
||||
import {useBuilderStore} from '@/stores/builder';
|
||||
import {SectionBody, SectionFrame, Rail} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
export function ItineraryTickets(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<ItineraryItem>(section.type, section.data);
|
||||
const guide = useLocalGuide();
|
||||
const placeName = useBuilderStore((s) => s.storeName);
|
||||
// 사장님이 적은 것이 언제나 이긴다 — 서버가 만든 건 비었을 때의 기본값이다.
|
||||
const items = parsed.items.length > 0 ? parsed.items : guide.itineraries;
|
||||
const live = currentSeasons();
|
||||
const durations = itineraryDurations(items);
|
||||
const groups: (string | undefined)[] =
|
||||
durations.length > 0
|
||||
? [...durations, ...(items.some((i) => !i.duration?.trim()) ? [undefined] : [])]
|
||||
: [undefined];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="wide">
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : items.length === 0 ? (
|
||||
<PasteHint label="추천 일정" />
|
||||
) : (
|
||||
<div className="space-y-7">
|
||||
{groups.map((duration) => {
|
||||
const dayItems = items.filter((item) =>
|
||||
duration === undefined
|
||||
? !item.duration?.trim()
|
||||
: item.duration?.trim() === duration,
|
||||
);
|
||||
if (dayItems.length === 0) return null;
|
||||
return (
|
||||
<div key={duration ?? 'etc'} className="space-y-4">
|
||||
{duration && (
|
||||
<h3 className="text-lg" style={{fontFamily: ITEM_HEADING}}>
|
||||
{duration}
|
||||
</h3>
|
||||
)}
|
||||
{dayItems.map((item, index) => (
|
||||
<div key={`${item.name}-${index}`} className="space-y-2.5">
|
||||
<div className="flex flex-wrap items-baseline gap-x-2.5 gap-y-1">
|
||||
<h4 className="text-base font-bold" style={{fontFamily: ITEM_HEADING}}>
|
||||
{item.name}
|
||||
</h4>
|
||||
<span className="text-[11px] opacity-60">
|
||||
{[item.audience, item.season].filter(Boolean).join(' · ')}
|
||||
</span>
|
||||
{/* 계절을 적으면 손님 화면에서는 그 계절에만 나간다 — 사장님이 알아야 한다. */}
|
||||
{item.season && (
|
||||
<span className="text-[11px] opacity-60">
|
||||
{inSeason(item.season, live)
|
||||
? '· 지금 나갑니다'
|
||||
: `· 손님 화면에는 ${item.season} 에만 나갑니다`}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{item.why && (
|
||||
<p className="max-w-[52ch] text-[13px] leading-relaxed opacity-80">
|
||||
{item.why}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{itineraryDays(item).map((entry, dayIndex) => (
|
||||
<div key={`${entry.label}-${dayIndex}`} className="space-y-1.5">
|
||||
{/* ★ 출발지 — 첫날에만. 일정 데이터에는 없다(프롬프트가 정거장으로
|
||||
못 넣게 막는다) — 빌더가 이미 아는 상호명을 그 자리에서 얹는다. */}
|
||||
{dayIndex === 0 && placeName && (
|
||||
<p className="text-[11px] opacity-50">
|
||||
{placeName}에서 출발 · {entry.day.from}
|
||||
</p>
|
||||
)}
|
||||
{entry.label && (
|
||||
<p className="text-[11px] font-bold" style={{color: ITEM_ACCENT}}>
|
||||
{entry.label}
|
||||
<span className="ml-2 font-normal opacity-60">
|
||||
{entry.day.from}–{entry.day.to}
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<Rail label={`${item.name} ${entry.label || '정거장'}`}>
|
||||
{entry.day.stops.map((planned, stopIndex) => (
|
||||
<Ticket
|
||||
key={`${planned.stop.name}-${stopIndex}`}
|
||||
planned={planned}
|
||||
no={stopIndex + 1}
|
||||
isLast={stopIndex === entry.day.stops.length - 1}
|
||||
/>
|
||||
))}
|
||||
</Rail>
|
||||
{entry.day.dropped > 0 && (
|
||||
<p className="text-[11px] opacity-60">
|
||||
밤 9시를 넘기는 {entry.day.dropped}곳은 화면에서 뺐습니다.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
|
||||
/** 승차권 한 장. 마지막 장에는 완주 도장(아티팩트의 스탬프투어 형식). */
|
||||
function Ticket({planned, no, isLast}: {planned: PlannedStop; no: number; isLast: boolean}) {
|
||||
const {stop, time, until, move} = planned;
|
||||
return (
|
||||
<article
|
||||
className="w4-perf relative w-[214px] shrink-0 border"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<div
|
||||
className="flex items-baseline justify-between gap-2 border-b border-dashed px-3.5 py-2"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<span className="text-[10px] tracking-[0.2em] opacity-60">
|
||||
NO.{String(no).padStart(2, '0')}
|
||||
</span>
|
||||
<span className="text-[13px] font-bold tabular-nums" style={{fontFamily: ITEM_HEADING}}>
|
||||
{time}
|
||||
<span className="opacity-55">–{until}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div className="space-y-1 px-3.5 pb-3.5 pt-2.5">
|
||||
<h5 className="text-sm font-bold" style={{fontFamily: ITEM_HEADING}}>
|
||||
{stop.name}
|
||||
</h5>
|
||||
{stop.note && <p className="text-[12px] leading-relaxed opacity-80">{stop.note}</p>}
|
||||
{move > 0 && <p className="text-[10px] opacity-55">↓ 앞 칸에서 {move}분 이동</p>}
|
||||
</div>
|
||||
{isLast && (
|
||||
<span
|
||||
className="absolute bottom-2.5 right-2.5 grid size-10 rotate-[-12deg] place-items-center rounded-full border-2 text-[10px] font-bold"
|
||||
style={{borderColor: ITEM_ACCENT, color: ITEM_ACCENT}}
|
||||
aria-hidden
|
||||
>
|
||||
완주
|
||||
</span>
|
||||
)}
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* 지역 가이드 · 카테고리 한 묶음 — 제목(아이콘) → 도보 시간 필터 → 카드 캐러셀.
|
||||
*
|
||||
* 맛집·명소·축제가 전부 이 모양이다. 필터 상태는 묶음마다 따로 든다 —
|
||||
* 맛집을 "5분 이내"로 걸렀는데 명소까지 줄어들면 사장님이 명소가 사라진 줄 안다.
|
||||
*/
|
||||
import {useState, type ReactNode} from 'react';
|
||||
import type {LucideIcon} from 'lucide-react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {EmptyStateNotice, PlaceCarousel, WalkFilterTabs} from '../../primitives';
|
||||
import type {GuideCard} from './types';
|
||||
import {matchesWalkFilter, type WalkFilterKey} from './walking';
|
||||
|
||||
export function LocalCategorySection({
|
||||
icon: Icon,
|
||||
title,
|
||||
cards,
|
||||
emptyText,
|
||||
colors,
|
||||
renderLeading,
|
||||
linkUrl,
|
||||
}: {
|
||||
icon: LucideIcon;
|
||||
title: string;
|
||||
cards: GuideCard[];
|
||||
emptyText: string;
|
||||
colors: TemplateItem['colors'];
|
||||
renderLeading?: (card: GuideCard) => ReactNode;
|
||||
linkUrl?: (query: string) => string;
|
||||
}) {
|
||||
const [filter, setFilter] = useState<WalkFilterKey>('all');
|
||||
const visible = cards.filter((c) => matchesWalkFilter(filter, c.distanceMeters));
|
||||
|
||||
return (
|
||||
<section className="space-y-4">
|
||||
<h3
|
||||
className="flex items-center gap-2 text-sm font-bold text-stone-900"
|
||||
style={{color: colors.text}}
|
||||
>
|
||||
<Icon className="size-4" style={{color: colors.primary}} />
|
||||
<span>{title}</span>
|
||||
</h3>
|
||||
|
||||
{cards.length === 0 ? (
|
||||
<EmptyStateNotice>{emptyText}</EmptyStateNotice>
|
||||
) : (
|
||||
<>
|
||||
<WalkFilterTabs
|
||||
distances={cards.map((c) => c.distanceMeters)}
|
||||
value={filter}
|
||||
onChange={setFilter}
|
||||
colors={colors}
|
||||
/>
|
||||
{visible.length === 0 ? (
|
||||
<EmptyStateNotice>이 거리 안에는 아직 없습니다. 다른 구간을 눌러 보세요.</EmptyStateNotice>
|
||||
) : (
|
||||
<PlaceCarousel cards={visible} colors={colors} renderLeading={renderLeading} linkUrl={linkUrl} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
/**
|
||||
* 지역 가이드 — 맛집 · 명소 · 축제를 카테고리별 "도보 시간 필터 + 카드 캐러셀"로 세로 나열.
|
||||
*
|
||||
* ★ 2026-09-07 결정으로 전체/탭/요약 세 배리에이션을 이 하나로 통일했다.
|
||||
* 데이터가 이미 카테고리별로 나뉘어 있어 "탭으로 갈아끼우기"라는 구분이 캐러셀 구조에서는
|
||||
* 의미가 없어졌고, 요약(6곳)은 필터가 그 역할을 대신한다.
|
||||
* ★ 값은 서버(local.place_contents)가 소유한다 — 업장 좌표 반경으로 받은 것만 그린다.
|
||||
* 시연용 목록으로 자리를 메우지 않는다(남의 동네 맛집이 사장님 사이트에 붙는다).
|
||||
*/
|
||||
import {Calendar, MapPin, Utensils} from 'lucide-react';
|
||||
import {useLocalGuide} from '@/hooks/useLocalGuide';
|
||||
import {Pill, SectionBody, SectionFrame, SectionHeading, naverMapSearch} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import type {FestivalCard, GuideCard} from './types';
|
||||
import {LocalCategorySection} from './LocalCategorySection';
|
||||
import {WALK_DISCLAIMER} from './walking';
|
||||
|
||||
/** "2026년 9월 3일 갱신" — 서버 수집 시각(ISO)에서. 없으면 비운다(지어내지 않는다). */
|
||||
function syncedLabel(iso?: string): string | undefined {
|
||||
if (!iso) return undefined;
|
||||
const d = new Date(iso);
|
||||
if (Number.isNaN(d.getTime())) return undefined;
|
||||
return `${d.getFullYear()}년 ${d.getMonth() + 1}월 ${d.getDate()}일 갱신`;
|
||||
}
|
||||
|
||||
/** "전북특별자치도 군산시 …" → "군산시". 시군구 토큰이 없으면 첫 토큰. */
|
||||
function regionLabel(location: string): string {
|
||||
const tokens = location.split(' ').filter(Boolean);
|
||||
return tokens[1] ?? tokens[0] ?? '주변';
|
||||
}
|
||||
|
||||
export function LocalGuide(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, location, template} = props;
|
||||
const {foods, spots, festivals, syncedAt} = useLocalGuide();
|
||||
const colors = template.colors;
|
||||
const isStay = industryId === 'stay';
|
||||
const synced = syncedLabel(syncedAt);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="wide" className="space-y-10">
|
||||
<SectionHeading
|
||||
title={section.name || '주변 안내'}
|
||||
subtitle={`${regionLabel(location)} 지역의 맛집 · 명소 안내입니다.`}
|
||||
trailing={synced && <span className="text-xs text-stone-400">{synced}</span>}
|
||||
colors={colors}
|
||||
/>
|
||||
|
||||
{/* ★ 맛집은 사진이 없으면 목록에서 뺀다 (2026-09-15, 사장님 지시) — 명소는 이름 활자로 대신하는
|
||||
규칙을 유지하지만, 맛집은 실제 사이트(LocalGuideSection)와 맞춰 사진 없는 곳을 숨긴다. */}
|
||||
{/* ★ 맛집·명소 카드는 네이버지도 검색으로 연다 (2026-09-15, 사장님 지시) — 실제 사이트와 동일. */}
|
||||
<LocalCategorySection
|
||||
icon={Utensils}
|
||||
title="주변 맛집"
|
||||
cards={foods.filter((card) => card.imageUrl)}
|
||||
emptyText="주변 맛집·카페 추천은 아직 준비 중입니다."
|
||||
colors={colors}
|
||||
linkUrl={naverMapSearch}
|
||||
/>
|
||||
|
||||
<LocalCategorySection
|
||||
icon={MapPin}
|
||||
title="주변 명소"
|
||||
cards={spots}
|
||||
emptyText="주변 명소 추천은 아직 준비 중입니다."
|
||||
colors={colors}
|
||||
linkUrl={naverMapSearch}
|
||||
/>
|
||||
|
||||
{isStay && (
|
||||
<LocalCategorySection
|
||||
icon={Calendar}
|
||||
title="주변 축제 & 문화 행사"
|
||||
cards={festivals}
|
||||
emptyText="주변 축제 안내는 아직 준비 중입니다."
|
||||
colors={colors}
|
||||
renderLeading={(card: GuideCard) => {
|
||||
const fest = card as FestivalCard;
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
{fest.month && <Pill tone="accent">{fest.month}</Pill>}
|
||||
{fest.period && <Pill mono>{fest.period}</Pill>}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<p className="text-[11px] leading-relaxed text-stone-400">{WALK_DISCLAIMER}</p>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/**
|
||||
* 실시간 날씨 + AI 추천 한 덩어리.
|
||||
*
|
||||
* 지역 가이드 배리에이션 셋이 전부 이걸 쓴다 — 날씨 조회를 배리에이션마다 하면
|
||||
* 레이아웃을 바꿀 때마다 API 를 다시 때린다.
|
||||
*/
|
||||
import {ArrowUpRight, Cloud, CloudRain, Snowflake, Sparkles, Sun} from 'lucide-react';
|
||||
import {useWeather} from '@/hooks/useWeather';
|
||||
import {cn} from '@/lib/utils';
|
||||
import type {WeatherLocation} from '@/stores/builder';
|
||||
import {EmptyStateNotice} from '../../primitives';
|
||||
|
||||
function WeatherIcon({condition, className}: {condition: string; className?: string}) {
|
||||
switch (condition) {
|
||||
case '맑음':
|
||||
return <Sun className={cn('text-amber-500', className)} />;
|
||||
case '구름많음':
|
||||
return <Cloud className={cn('text-stone-500', className)} />;
|
||||
case '비':
|
||||
return <CloudRain className={cn('text-blue-500', className)} />;
|
||||
case '눈':
|
||||
return <Snowflake className={cn('text-cyan-400', className)} />;
|
||||
default:
|
||||
return <Cloud className={cn('text-stone-400', className)} />;
|
||||
}
|
||||
}
|
||||
|
||||
export function WeatherPanel({
|
||||
location,
|
||||
weatherLocation,
|
||||
dense,
|
||||
}: {
|
||||
location: string;
|
||||
weatherLocation?: WeatherLocation;
|
||||
dense?: boolean;
|
||||
}) {
|
||||
const observed = useWeather(
|
||||
weatherLocation?.regionCode,
|
||||
weatherLocation?.latitude,
|
||||
weatherLocation?.longitude,
|
||||
);
|
||||
const weather = weatherLocation ? observed : null;
|
||||
|
||||
if (dense) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-3 rounded-xl border border-stone-200/80 bg-white px-4 py-3 shadow-2xs">
|
||||
{weather ? (
|
||||
<>
|
||||
<WeatherIcon condition={weather.condition} className="size-5" />
|
||||
<span className="text-lg font-extrabold tracking-tight text-stone-900">
|
||||
{weather.temperature || '21.4'}°C
|
||||
</span>
|
||||
<span className="text-xs font-semibold text-stone-600">
|
||||
{weather.condition || '구름많음'}
|
||||
</span>
|
||||
{weather.stale && <span className="text-[10px] text-amber-700">최근 관측값</span>}
|
||||
<span className="min-w-0 flex-1 truncate text-[11px] text-stone-500">
|
||||
{weather.recommendation}
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<span className="text-[11px] text-stone-500">
|
||||
실시간 날씨는 아직 준비 중입니다.
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-4 rounded-2xl border border-stone-200/80 bg-white p-5 shadow-2xs sm:p-6">
|
||||
<div className="flex flex-col justify-between gap-3 border-b border-stone-100 pb-4 sm:flex-row sm:items-center">
|
||||
<div className="flex items-center gap-3.5">
|
||||
<div className="flex size-12 shrink-0 items-center justify-center rounded-2xl bg-stone-100/80">
|
||||
<WeatherIcon condition={weather?.condition ?? ''} className="size-6" />
|
||||
</div>
|
||||
<div>
|
||||
<span className="block text-[11px] font-semibold text-stone-400">
|
||||
{location || '제주 애월읍'} 실시간 기상
|
||||
</span>
|
||||
{weather ? (
|
||||
<div className="mt-0.5 flex items-baseline gap-2">
|
||||
<span className="font-sans text-2xl font-extrabold tracking-tight text-stone-900 sm:text-3xl">
|
||||
{weather.temperature || '21.4'}°C
|
||||
</span>
|
||||
<span className="text-xs font-semibold text-stone-700 sm:text-sm">
|
||||
{weather.condition || '구름많음'}
|
||||
</span>
|
||||
{weather.stale && (
|
||||
<span className="text-[10px] font-medium text-amber-700">최근 관측값</span>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<span className="mt-0.5 block text-xs text-stone-500">
|
||||
실시간 날씨는 아직 준비 중입니다.
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a
|
||||
href={`https://search.naver.com/search.naver?query=${encodeURIComponent(`${location} 날씨`)}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="flex items-center gap-1 self-start rounded-lg border border-stone-200/60 bg-stone-50 px-3 py-1.5 text-xs text-stone-500 transition-colors hover:bg-stone-100 hover:text-stone-900 sm:self-auto"
|
||||
>
|
||||
<span>주간 날씨 예보</span>
|
||||
<ArrowUpRight className="size-3.5" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{weather ? (
|
||||
<div className="flex items-start gap-2.5 rounded-xl border border-stone-200/60 bg-stone-50/70 p-3.5 text-xs leading-relaxed text-stone-700 sm:text-sm">
|
||||
<Sparkles className="mt-0.5 size-4 shrink-0 text-amber-600" />
|
||||
<div>
|
||||
<strong className="font-semibold text-stone-900">AI 맞춤 추천: </strong>
|
||||
<span>{weather.recommendation}</span>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<EmptyStateNotice>날씨 기반 AI 추천은 아직 준비 중입니다.</EmptyStateNotice>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* 지역 가이드 카드 한 장의 모양(맛집·명소·축제 공통).
|
||||
*
|
||||
* ★ 값은 서버(local.place_contents)가 소유한다. hooks/useLocalGuide 가 GET /v1/local/guide
|
||||
* 응답(발행 payload 와 같은 모양)을 이 타입으로 매핑한다.
|
||||
* ★ 도보 시간 배지·필터는 distanceMeters 로 계산한다(walking.ts::walkMinutes, 분속 80m).
|
||||
* distanceMeters 가 없으면(지역 캐시에서 온 수기 항목 등) 배지·필터 대상에서 빠진다 —
|
||||
* 업장 기준 거리를 모르는 값으로 "도보 N분"을 지어내지 않는다.
|
||||
*/
|
||||
export interface GuideCard {
|
||||
name: string;
|
||||
description: string;
|
||||
/** 상세 페이지 대신 검색으로 보낸다 — 없는 주소를 지어내지 않기 위해서다. */
|
||||
searchQuery: string;
|
||||
imageUrl?: string;
|
||||
distanceMeters?: number;
|
||||
/** 화면 배지에 그대로 쓰는 거리 문자열("850m"/"1.2km"). */
|
||||
distanceText?: string;
|
||||
}
|
||||
|
||||
/** 축제는 기간·월 배지가 더 붙는다. */
|
||||
export interface FestivalCard extends GuideCard {
|
||||
month: string;
|
||||
period: string;
|
||||
officialUrl?: string;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* 도보 시간 환산 — 직선거리(m) → 분.
|
||||
*
|
||||
* ★ 분속 80m 로 나눈다(보통 걸음 4.8km/h). 스크린샷 문구와 같은 기준이며 화면 하단에도 그대로 적는다:
|
||||
* "도보 시간은 숙소에서 잰 직선거리를 분속 80m 로 환산한 값입니다. 실제로 걷는 길은 이보다 길 수 있습니다."
|
||||
* ★ 실측 검증(2026-09-07): 135m→2분 · 297m→4분 · 305m→4분 · 566m→7분 · 13m→1분 — 반올림 + 최소 1분.
|
||||
*/
|
||||
export const WALK_METERS_PER_MINUTE = 80;
|
||||
|
||||
export const WALK_DISCLAIMER =
|
||||
`도보 시간은 숙소에서 잰 직선거리를 분속 ${WALK_METERS_PER_MINUTE}m 로 환산한 값입니다. 실제로 걷는 길은 이보다 길 수 있습니다.`;
|
||||
|
||||
export function walkMinutes(meters: number): number {
|
||||
return Math.max(1, Math.round(meters / WALK_METERS_PER_MINUTE));
|
||||
}
|
||||
|
||||
/**
|
||||
* 도보 시간 필터. ★ 구간은 배타적이 아니라 **누적**이다 — "10분 이내"는 "5분 이내"를 포함한다.
|
||||
* (스크린샷 수치 8·19·5 → 19+5=24=전체 로 확인. "5분 이내"는 "10분 이내"의 부분집합.)
|
||||
*/
|
||||
export type WalkFilterKey = 'all' | 'within5' | 'within10' | 'over10';
|
||||
|
||||
export const WALK_FILTERS: {key: WalkFilterKey; label: string; test: (minutes: number) => boolean}[] = [
|
||||
{key: 'all', label: '전체', test: () => true},
|
||||
{key: 'within5', label: '걸어서 5분 이내', test: (m) => m <= 5},
|
||||
{key: 'within10', label: '걸어서 10분 이내', test: (m) => m <= 10},
|
||||
{key: 'over10', label: '걸어서 10분 이상', test: (m) => m > 10},
|
||||
];
|
||||
|
||||
/** 거리를 모르는 항목은 '전체'에만 들어간다 — 모르는 값으로 구간을 정하지 않는다. */
|
||||
export function matchesWalkFilter(key: WalkFilterKey, meters: number | undefined): boolean {
|
||||
if (key === 'all') return true;
|
||||
if (meters === undefined) return false;
|
||||
const filter = WALK_FILTERS.find((f) => f.key === key);
|
||||
return filter ? filter.test(walkMinutes(meters)) : true;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* 오시는 길 · 간단 — 주소 한 줄과 길찾기 버튼만.
|
||||
* 도심처럼 "주소만 알면 찾아오는" 곳이면 표까지 깔 이유가 없다.
|
||||
*/
|
||||
import {MapPin} from 'lucide-react';
|
||||
import {
|
||||
AddressCard,
|
||||
EmptyStateNotice,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
|
||||
export function MapCompact(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, storeName, location, template, infoFields} = props;
|
||||
// ★ props 로 온 주소만 쓴다. 없으면 카드 대신 준비 중 안내를 둔다 —
|
||||
// 시연용 주소로 떨어지면 손님을 남의 집으로 보낸다.
|
||||
const address = infoFields.find((f) => f.id === 'address')?.value ?? '';
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading
|
||||
variant="minimal"
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
trailing={
|
||||
<span className="flex items-center gap-1 text-[11px] text-stone-500">
|
||||
<MapPin className="size-3.5" />
|
||||
{location}
|
||||
</span>
|
||||
}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
{address ? (
|
||||
<AddressCard
|
||||
address={address}
|
||||
searchName={storeName}
|
||||
variant="bar"
|
||||
colors={template.colors}
|
||||
/>
|
||||
) : (
|
||||
<EmptyStateNotice>주소는 아직 준비 중입니다.</EmptyStateNotice>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
/**
|
||||
* 오시는 길 · 상세 — 주소 카드 + 거점별 소요시간 표 + 주차/충전 안내.
|
||||
* 차로 찾아오는 손님이 많은 곳(외곽 스테이, 교외 카페)에 맞는다.
|
||||
*/
|
||||
import {Car, CarFront, Zap} from 'lucide-react';
|
||||
import {
|
||||
AddressCard,
|
||||
EmptyStateNotice,
|
||||
FeatureCard,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
|
||||
export function MapDetailed(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, template, infoFields} = props;
|
||||
// ★ 주소도 소요시간표도 시연용(제주 애월)이다 — 실사업장에는 한 줄도 내보내지 않는다.
|
||||
const address =
|
||||
infoFields.find((f) => f.id === 'address')?.value ?? '';
|
||||
/**
|
||||
* 소요시간 표.
|
||||
*
|
||||
* ★ 서버(local.routes)의 산출물이고 캔버스 계약(SectionRenderProps)에 없다 —
|
||||
* 흘러올 창구가 생기기 전까지 빈다. 시연용 표(제주 애월 기준)를 깔지 않는다:
|
||||
* 남의 동네 소요시간을 보고 손님이 출발 시각을 정한다.
|
||||
*/
|
||||
const travelTimes: {
|
||||
destination: string;
|
||||
byCar: string;
|
||||
byWalkOrTransit: string;
|
||||
distance: string;
|
||||
}[] = [];
|
||||
const isStay = industryId === 'stay';
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading title={section.name} subtitle={section.description} colors={template.colors} />
|
||||
|
||||
{address ? (
|
||||
<AddressCard
|
||||
address={address}
|
||||
searchName={storeName}
|
||||
colors={template.colors}
|
||||
/>
|
||||
) : (
|
||||
<EmptyStateNotice>주소는 아직 준비 중입니다.</EmptyStateNotice>
|
||||
)}
|
||||
|
||||
{isStay && travelTimes.length === 0 && (
|
||||
<EmptyStateNotice>주요 거점 소요시간은 아직 준비 중입니다.</EmptyStateNotice>
|
||||
)}
|
||||
|
||||
{isStay && travelTimes.length > 0 && (
|
||||
<div className="overflow-hidden rounded-xl border border-stone-200/80 bg-white shadow-2xs">
|
||||
<div className="flex items-center gap-2 border-b border-stone-200 bg-stone-50 p-3.5 text-xs font-bold text-stone-800">
|
||||
<Car className="size-4 text-stone-700" />
|
||||
<span>주요 거점 이동 소요시간</span>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-left text-xs">
|
||||
<thead className="border-b border-stone-100 bg-stone-50/50 font-medium text-stone-500">
|
||||
<tr>
|
||||
<th className="p-3">목적지</th>
|
||||
<th className="p-3">차량</th>
|
||||
<th className="p-3">도보 / 대중교통</th>
|
||||
<th className="hidden p-3 sm:table-cell">거리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="text-stone-700 [&>tr+tr]:border-t [&>tr+tr]:border-stone-100">
|
||||
{travelTimes.map((row) => (
|
||||
<tr key={row.destination} className="hover:bg-stone-50/50">
|
||||
<td className="p-3 font-bold text-stone-900">{row.destination}</td>
|
||||
<td
|
||||
className="p-3 font-semibold"
|
||||
style={{color: template.colors.primary}}
|
||||
>
|
||||
{row.byCar}
|
||||
</td>
|
||||
<td className="p-3">{row.byWalkOrTransit}</td>
|
||||
<td className="hidden p-3 font-mono text-stone-400 sm:table-cell">
|
||||
{row.distance}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
<FeatureCard
|
||||
icon={CarFront}
|
||||
title="전용 주차장 완비"
|
||||
description="객실동 입구 전용 주차 공간 4대 무료 이용 가능"
|
||||
colors={template.colors}
|
||||
/>
|
||||
<FeatureCard
|
||||
icon={Zap}
|
||||
title="전기차 완속 충전기"
|
||||
description="스테이 전용 7kW 완속 충전기 1기 구비"
|
||||
iconClassName="text-emerald-600"
|
||||
colors={template.colors}
|
||||
/>
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 메뉴 · 카드 격자 — 설명을 넉넉히 보여준다. 시그니처가 몇 개뿐일 때 강하다.
|
||||
*/
|
||||
import {PriceRow, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {menuItems} from './useMenuItems';
|
||||
|
||||
export function MenuGrid(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template} = props;
|
||||
const items = menuItems(industryId);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
variant="centered"
|
||||
eyebrow="MENU"
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
{items.map((item) => (
|
||||
<PriceRow key={item.name} item={item} variant="card" colors={template.colors} />
|
||||
))}
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* 메뉴 · 목록 — 이름과 가격을 한 줄씩. 종이 메뉴판처럼 읽힌다.
|
||||
*/
|
||||
import {ListCard, PriceRow, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {menuItems} from './useMenuItems';
|
||||
|
||||
export function MenuList(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template} = props;
|
||||
const items = menuItems(industryId);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<ListCard>
|
||||
{items.map((item) => (
|
||||
<PriceRow key={item.name} item={item} colors={template.colors} />
|
||||
))}
|
||||
</ListCard>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* 메뉴 · 가격표 — 이름과 가격만 점선으로 이어 붙인 가장 압축된 형태.
|
||||
* 품목이 많은 곳(코스 여러 개, 음료 다수)에 맞는다.
|
||||
*/
|
||||
import {Pill, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {menuItems} from './useMenuItems';
|
||||
|
||||
export function MenuPriceTable(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template} = props;
|
||||
const items = menuItems(industryId);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading variant="minimal" title={section.name} colors={template.colors} />
|
||||
|
||||
<ul className="space-y-3.5">
|
||||
{items.map((item) => (
|
||||
<li key={item.name} className="space-y-0.5">
|
||||
<div className="flex items-baseline gap-2">
|
||||
<span
|
||||
className="flex items-center gap-2 text-xs font-bold text-stone-900 sm:text-sm"
|
||||
style={{color: template.colors.text}}
|
||||
>
|
||||
{item.name}
|
||||
{item.tag && <Pill tone="accent">{item.tag}</Pill>}
|
||||
</span>
|
||||
{/* 점선 리더 — 이름과 가격 사이를 눈으로 잇는다. 선 자체는 중립 회색으로 둔다. */}
|
||||
<span className="min-w-4 flex-1 translate-y-[-3px] border-b border-dotted border-stone-300" />
|
||||
<span
|
||||
className="font-mono text-xs font-extrabold text-stone-900 sm:text-sm"
|
||||
style={{color: template.colors.primary}}
|
||||
>
|
||||
{item.price}
|
||||
</span>
|
||||
</div>
|
||||
{item.desc && <p className="text-[11px] leading-relaxed text-stone-500">{item.desc}</p>}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import type {IndustryType} from '@o2o/shared';
|
||||
import type {PricedItem} from '../../primitives';
|
||||
|
||||
/**
|
||||
* 메뉴.
|
||||
*
|
||||
* ★ 지금은 항상 빈 목록이다. 메뉴는 unit(하위 단위)이고, 캔버스 계약에 units 가 없다.
|
||||
* 업종 시드의 menuList/courseList 를 폴백으로 쓰던 코드를 걷어냈다 —
|
||||
* "포레스트 크림라떼 7,500원" 이 실제로 모든 카페 화면에 떴다.
|
||||
*/
|
||||
export function menuItems(_industryId: IndustryType): PricedItem[] {
|
||||
return [];
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
/**
|
||||
* 인물 열전 — 필름 스트립.
|
||||
*
|
||||
* 프레임 하나가 인물 하나다. 사진 자리에는 **활판 이니셜**이 들어간다 —
|
||||
* 이 데이터에는 쓸 수 있는 인물 사진이 없고, 빈 회색 상자를 두면 "사진을 못 넣은 화면"으로 읽힌다.
|
||||
* 이니셜을 넣으면 없는 것이 형식이 된다.
|
||||
* ★ 이미지 URL 을 받지 않는다(dataSpec: imageQuery). 초상권 확인은 사장님 몫이라 검색어까지만 싣는다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type PeopleItem} from '@o2o/shared';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_HEADING,
|
||||
ITEM_INVERSE,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
/** 이니셜 한 글자. 성이 두 글자인 이름도 첫 자만 — 프레임이 좁아 두 글자는 안 읽힌다. */
|
||||
function initialOf(name: string): string {
|
||||
return name.trim().charAt(0) || '?';
|
||||
}
|
||||
|
||||
export function PeopleFilmstrip(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<PeopleItem>(section.type, section.data);
|
||||
const [picked, setPicked] = useState(0);
|
||||
|
||||
// 항목이 줄어 인덱스가 범위를 벗어나도 첫 사람으로 떨어진다 — 빈 화면을 만들지 않는다.
|
||||
const current = parsed.items[picked] ?? parsed.items[0];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="dark">
|
||||
{/* ★ 어두운 면 위의 글자색을 여기서 한 번만. 필름 구멍(w4-film-perf)도 이 색을 따라간다. */}
|
||||
<SectionBody width="wide" className="text-[color:var(--tpl-bg,#fff)]">
|
||||
<div className="space-y-1.5">
|
||||
<p className="text-[11px] tracking-[0.28em]" style={{color: ITEM_ACCENT}}>
|
||||
PORTRAIT ROLL
|
||||
</p>
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-55" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : !current ? (
|
||||
<PasteHint label="인물 열전" />
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
<div
|
||||
className="border"
|
||||
style={{
|
||||
backgroundColor: ITEM_INVERSE,
|
||||
borderColor: 'color-mix(in oklab, currentColor 22%, transparent)',
|
||||
}}
|
||||
>
|
||||
<div className="w4-film-perf h-2.5 opacity-70" />
|
||||
<Rail label="인물" tone="dark" nav="overlay" gap={0.75} viewportClassName="px-3 py-3">
|
||||
{parsed.items.map((person, index) => (
|
||||
<button
|
||||
key={`${person.name}-${index}`}
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setPicked(index);
|
||||
}}
|
||||
aria-current={index === picked}
|
||||
className={cn(
|
||||
'w-[126px] shrink-0 snap-center text-left transition-all',
|
||||
// 고른 프레임만 색이 돌아온다 — 필름을 손으로 짚은 자리.
|
||||
index === picked ? 'opacity-100' : 'opacity-45 grayscale',
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className="grid aspect-3/4 w-full place-items-center border"
|
||||
style={{
|
||||
// 프레임 안쪽은 필름보다 한 단 밝게 — 색을 박지 않고 글자색을 섞어 만든다.
|
||||
backgroundColor: 'color-mix(in oklab, currentColor 14%, transparent)',
|
||||
borderColor:
|
||||
index === picked
|
||||
? ITEM_ACCENT
|
||||
: 'color-mix(in oklab, currentColor 28%, transparent)',
|
||||
}}
|
||||
>
|
||||
<span className="leading-none" style={{fontFamily: ITEM_HEADING, fontSize: 46}}>
|
||||
{initialOf(person.name)}
|
||||
</span>
|
||||
</span>
|
||||
<span className="mt-2 block truncate text-xs opacity-95">{person.name}</span>
|
||||
<span className="block truncate text-[10px] opacity-60">
|
||||
{[person.role, person.years].filter(Boolean).join(' · ') || '역할 미상'}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</Rail>
|
||||
<div className="w4-film-perf h-2.5 opacity-70" />
|
||||
</div>
|
||||
|
||||
{/* 고른 프레임의 자막 — 프레임 안에 넣으면 이름조차 안 읽힌다 */}
|
||||
<div className="space-y-2 border-l-2 pl-4" style={{borderColor: ITEM_ACCENT}}>
|
||||
<h3 className="text-xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{current.name}
|
||||
{current.aka && <span className="ml-2 text-sm opacity-55">호 {current.aka}</span>}
|
||||
</h3>
|
||||
<p className="text-xs opacity-55">
|
||||
{[current.role, current.years].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
{current.oneLine && (
|
||||
<p
|
||||
className="max-w-[52ch] text-sm leading-relaxed opacity-80"
|
||||
style={{fontFamily: ITEM_BODY}}
|
||||
>
|
||||
{current.oneLine}
|
||||
</p>
|
||||
)}
|
||||
{current.imageQuery && (
|
||||
<p className="text-[10px] opacity-60">사진 검색어 · {current.imageQuery}</p>
|
||||
)}
|
||||
<SourceLine source={current.source} verified={current.verified} tone="dark" />
|
||||
</div>
|
||||
|
||||
<p className="text-[11px] opacity-60">
|
||||
사진이 없는 인물은 이름 활자로 대신합니다 · 총 {parsed.items.length}명
|
||||
{parsed.unverified > 0 && ` · 확인 필요 ${parsed.unverified}명`}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* 사진 · 가로 슬라이드 — 큰 사진을 한 장씩 넘겨 본다.
|
||||
* 장수가 적고 한 장 한 장이 좋을 때 가장 세게 보인다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
Rail,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
|
||||
export function PhotosCarousel(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos} = props;
|
||||
const items = galleryPhotos(industryId, photos);
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody width="wide">
|
||||
<SectionHeading title={section.name} subtitle={section.description} colors={template.colors} />
|
||||
|
||||
{/* ★ 예전엔 점이 그려져 있기만 하고 아무것도 가리키지 않았다(전부 같은 색·클릭 불가).
|
||||
지금 몇 번째인지는 Rail 이 숫자로 말하고, 화살표와 드래그로 실제로 넘어간다. */}
|
||||
<Rail label="사진" gap={0.75}>
|
||||
{items.map((photo, idx) => (
|
||||
<PhotoTile
|
||||
key={photo.id}
|
||||
photo={photo}
|
||||
fit="landscape"
|
||||
onOpen={() => setOpenIndex(idx)}
|
||||
className="w-[78vw] max-w-[420px] shrink-0"
|
||||
/>
|
||||
))}
|
||||
</Rail>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox photos={items} index={openIndex} onClose={() => setOpenIndex(null)} onMove={setOpenIndex} />
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* 사진 · 정사각 격자 — 모든 사진을 같은 크기로. 장수가 많을수록 정돈돼 보인다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
|
||||
export function PhotosGrid(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos} = props;
|
||||
const items = galleryPhotos(industryId, photos);
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description || `사진 ${items.length}장 · 클릭하면 크게 보입니다`}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-2 gap-2.5 sm:grid-cols-3 sm:gap-3 md:grid-cols-4">
|
||||
{items.map((photo, idx) => (
|
||||
<PhotoTile key={photo.id} photo={photo} fit="square" onOpen={() => setOpenIndex(idx)} />
|
||||
))}
|
||||
</div>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox photos={items} index={openIndex} onClose={() => setOpenIndex(null)} onMove={setOpenIndex} />
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* 사진 · 벽돌쌓기 — 세로/가로 비율을 살려 어긋나게 쌓는다.
|
||||
* 사진마다 구도가 다를 때 잘라내지 않고 보여줄 수 있다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
|
||||
export function PhotosMasonry(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos} = props;
|
||||
const items = galleryPhotos(industryId, photos);
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
variant="eyebrow"
|
||||
eyebrow="GALLERY"
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
{/* columns 로 쌓으면 사진 높이를 자르지 않고도 빈틈 없이 채워진다. */}
|
||||
<div className="columns-2 gap-2.5 sm:columns-3 sm:gap-3 [&>*]:mb-2.5 sm:[&>*]:mb-3">
|
||||
{items.map((photo, idx) => (
|
||||
<PhotoTile
|
||||
key={photo.id}
|
||||
photo={photo}
|
||||
fit="free"
|
||||
onOpen={() => setOpenIndex(idx)}
|
||||
className="break-inside-avoid"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox photos={items} index={openIndex} onClose={() => setOpenIndex(null)} onMove={setOpenIndex} />
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
/**
|
||||
* 사진 · 사진 + 영상 — 격자 갤러리 아래에 YouTube 영상을 붙인다.
|
||||
* 릴스·유튜브로 이미 알려진 곳이면 사진보다 영상이 더 잘 판다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {Plus} from 'lucide-react';
|
||||
import {convertYouTubeToEmbed} from '@/lib/youtube';
|
||||
import {
|
||||
EmptyStateNotice,
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {galleryPhotos} from '../common';
|
||||
import {VideoCard, type VideoItem} from './VideoCard';
|
||||
|
||||
export function PhotosWithVideos(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template, photos} = props;
|
||||
const items = galleryPhotos(industryId, photos);
|
||||
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
// 영상은 사장님이 이 화면에서 직접 추가한 것만 있다 — 시연용 목록을 깔지 않는다.
|
||||
const [added, setAdded] = useState<VideoItem[]>([]);
|
||||
const [removedIds, setRemovedIds] = useState<string[]>([]);
|
||||
const videos = added.filter((v) => !removedIds.includes(v.id));
|
||||
const [playingId, setPlayingId] = useState<string | null>(null);
|
||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||
const [inputTitle, setInputTitle] = useState('');
|
||||
const [inputUrl, setInputUrl] = useState('');
|
||||
const [errorMsg, setErrorMsg] = useState('');
|
||||
|
||||
const handleAddVideo = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setErrorMsg('');
|
||||
|
||||
if (!inputTitle.trim() || !inputUrl.trim()) {
|
||||
setErrorMsg('제목과 YouTube URL을 모두 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const {embedUrl, isValid} = convertYouTubeToEmbed(inputUrl);
|
||||
if (!isValid || !embedUrl) {
|
||||
setErrorMsg('올바른 YouTube URL 형식이 아닙니다.');
|
||||
return;
|
||||
}
|
||||
|
||||
setAdded((prev) => [
|
||||
{id: `canvas-v-${Date.now()}`, title: inputTitle.trim(), videoUrl: inputUrl.trim(), embedUrl},
|
||||
...prev,
|
||||
]);
|
||||
setInputTitle('');
|
||||
setInputUrl('');
|
||||
setIsFormOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody className="space-y-8">
|
||||
<div className="space-y-6">
|
||||
<SectionHeading title={section.name} subtitle={section.description} colors={template.colors} />
|
||||
|
||||
<div className="grid grid-cols-2 gap-2.5 sm:grid-cols-3 sm:gap-3 md:grid-cols-4">
|
||||
{items.map((photo, idx) => (
|
||||
<PhotoTile
|
||||
key={photo.id}
|
||||
photo={photo}
|
||||
fit="square"
|
||||
onOpen={() => setOpenIndex(idx)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-6">
|
||||
<SectionHeading
|
||||
title="영상 갤러리"
|
||||
subtitle="공간의 분위기를 영상으로 미리 확인해 보세요"
|
||||
trailing={
|
||||
<button
|
||||
type="button"
|
||||
title="영상 추가"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setIsFormOpen((v) => !v);
|
||||
}}
|
||||
className="flex size-8 cursor-pointer items-center justify-center rounded-full border border-stone-300 bg-white text-stone-700 shadow-2xs transition-colors hover:bg-stone-100 hover:text-stone-900"
|
||||
>
|
||||
<Plus className="size-4" />
|
||||
</button>
|
||||
}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
{isFormOpen && (
|
||||
<div
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
role="presentation"
|
||||
className="rounded-xl border border-stone-200 bg-white p-4 shadow-xs"
|
||||
>
|
||||
<form onSubmit={handleAddVideo} className="space-y-3">
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
<input
|
||||
type="text"
|
||||
value={inputTitle}
|
||||
onChange={(e) => setInputTitle(e.target.value)}
|
||||
placeholder="영상 제목 (예: 스테이의 아침)"
|
||||
className="rounded-lg border border-stone-200 bg-stone-50 px-3 py-2 text-xs focus:bg-white focus:outline-none"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
value={inputUrl}
|
||||
onChange={(e) => setInputUrl(e.target.value)}
|
||||
placeholder="YouTube URL (https://www.youtube.com/watch?v=...)"
|
||||
className="rounded-lg border border-stone-200 bg-stone-50 px-3 py-2 text-xs focus:bg-white focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
{errorMsg && <p className="text-[11px] text-rose-600">{errorMsg}</p>}
|
||||
<div className="flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsFormOpen(false)}
|
||||
className="cursor-pointer rounded-lg px-3 py-1.5 text-xs text-stone-500 hover:bg-stone-100"
|
||||
>
|
||||
취소
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="cursor-pointer rounded-lg px-4 py-1.5 text-xs font-semibold text-white"
|
||||
style={{backgroundColor: template.colors.primary}}
|
||||
>
|
||||
등록
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{videos.length === 0 ? (
|
||||
<EmptyStateNotice>
|
||||
등록된 영상이 아직 없습니다. + 버튼으로 추가할 수 있습니다.
|
||||
</EmptyStateNotice>
|
||||
) : (
|
||||
<div className="grid grid-cols-1 gap-5 md:grid-cols-2">
|
||||
{videos.map((video) => (
|
||||
<VideoCard
|
||||
key={video.id}
|
||||
video={video}
|
||||
isPlaying={playingId === video.id}
|
||||
onPlay={() => setPlayingId(video.id)}
|
||||
onRemove={() => setRemovedIds((prev) => [...prev, video.id])}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox
|
||||
photos={items}
|
||||
index={openIndex}
|
||||
onClose={() => setOpenIndex(null)}
|
||||
onMove={setOpenIndex}
|
||||
/>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
import {ExternalLink, Trash2} from 'lucide-react';
|
||||
|
||||
/**
|
||||
* 영상 한 건. 원래 시연용 데이터 파일이 소유하던 타입을 실제로 쓰는 여기로 옮겼다.
|
||||
*/
|
||||
export interface VideoItem {
|
||||
id: string;
|
||||
title: string;
|
||||
videoUrl: string;
|
||||
embedUrl: string;
|
||||
duration?: string;
|
||||
}
|
||||
|
||||
/** URL 에서 YouTube 영상 id 를 뽑는다. 못 뽑으면 썸네일을 대체 이미지로 떨어뜨린다. */
|
||||
export function youTubeId(url: string): string | null {
|
||||
const match = url.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);
|
||||
return match && match[2].length === 11 ? match[2] : null;
|
||||
}
|
||||
|
||||
const FALLBACK_THUMB =
|
||||
'https://images.unsplash.com/photo-1582719478250-c89cae4dc85b?auto=format&fit=crop&w=800&q=80';
|
||||
|
||||
/** 영상 한 칸 — 썸네일을 누르면 그 자리에서 iframe 으로 바뀐다. */
|
||||
export function VideoCard({
|
||||
video,
|
||||
isPlaying,
|
||||
onPlay,
|
||||
onRemove,
|
||||
}: {
|
||||
video: VideoItem;
|
||||
isPlaying: boolean;
|
||||
onPlay: () => void;
|
||||
onRemove: () => void;
|
||||
}) {
|
||||
const ytId = youTubeId(video.videoUrl || video.embedUrl || '');
|
||||
const thumb = ytId ? `https://img.youtube.com/vi/${ytId}/hqdefault.jpg` : FALLBACK_THUMB;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col overflow-hidden rounded-xl border border-stone-200/90 bg-white shadow-2xs">
|
||||
<div className="group relative aspect-16/9 overflow-hidden bg-stone-900">
|
||||
{isPlaying ? (
|
||||
<iframe
|
||||
src={`${video.embedUrl}?autoplay=1&rel=0`}
|
||||
title={video.title}
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowFullScreen
|
||||
className="absolute inset-0 size-full border-0"
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onPlay();
|
||||
}}
|
||||
className="absolute inset-0 cursor-pointer"
|
||||
>
|
||||
<img
|
||||
src={thumb}
|
||||
alt={video.title}
|
||||
className="size-full object-cover opacity-90 transition-transform duration-300 group-hover:scale-105"
|
||||
/>
|
||||
<div className="absolute inset-0 flex items-center justify-center bg-black/40 transition-colors group-hover:bg-black/30">
|
||||
<div className="flex size-12 items-center justify-center rounded-full bg-white/90 pl-1 text-stone-900 shadow-lg transition-transform group-hover:scale-110 group-active:scale-95">
|
||||
<svg className="size-5 fill-current" viewBox="0 0 24 24">
|
||||
<path d="M8 5v14l11-7z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div className="absolute left-3 top-3 flex items-center gap-1.5 rounded-md bg-black/60 px-2 py-1 text-[10px] font-medium text-white backdrop-blur-xs">
|
||||
<span className="size-2 rounded-full bg-rose-500" />
|
||||
<span>YouTube</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between gap-2 border-t border-stone-100 bg-white p-3.5">
|
||||
<span className="truncate text-xs font-semibold text-stone-900 sm:text-sm">
|
||||
{video.title}
|
||||
</span>
|
||||
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
<a
|
||||
href={video.videoUrl || `https://www.youtube.com/watch?v=${ytId}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
title="YouTube에서 열기"
|
||||
className="rounded p-1 text-stone-400 hover:text-stone-700"
|
||||
>
|
||||
<ExternalLink className="size-3.5" />
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
title="삭제"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onRemove();
|
||||
}}
|
||||
className="cursor-pointer p-1 text-stone-400 hover:text-rose-600"
|
||||
>
|
||||
<Trash2 className="size-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/**
|
||||
* 오늘의 엽서 — 엽서 뒷면 더미.
|
||||
*
|
||||
* 앞면(사진)은 없다. 쓸 수 있는 사진이 없기도 하고, 이 아이템의 목적이 **손님이 자기 계정에
|
||||
* 붙여넣는 것**이라 글이 놓이는 뒷면이 전부다. 우표 자리·소인·가운데 괘선이 그 형식을 만든다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {Check, Copy} from 'lucide-react';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type PostcardItem} from '@o2o/shared';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ITEM_INK,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
function Postcard({item}: {item: PostcardItem}) {
|
||||
const [copied, setCopied] = useState(false);
|
||||
const text = [item.line, (item.hashtags ?? []).join(' ')].filter(Boolean).join(' ');
|
||||
|
||||
const copy = (event: React.MouseEvent) => {
|
||||
event.stopPropagation();
|
||||
navigator.clipboard.writeText(text).then(
|
||||
() => {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 1600);
|
||||
},
|
||||
() => {
|
||||
// 클립보드가 막힌 브라우저 — 직접 긁어 갈 수 있게 띄운다.
|
||||
window.prompt('아래 문장을 복사하세요', text);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<article
|
||||
className="w4-paper w-[304px] shrink-0 snap-center border p-4 shadow-[4px_4px_0_rgba(27,26,21,.13)]"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
|
||||
>
|
||||
<div className="grid grid-cols-[minmax(0,1fr)_auto] gap-3">
|
||||
{/* 가운데 괘선 — 엽서 뒷면을 반으로 가르는 그 선 */}
|
||||
<div className="min-w-0 border-r pr-3" style={{borderColor: ITEM_BORDER}}>
|
||||
<p className="text-[19px] leading-snug" style={{fontFamily: ITEM_BODY}}>
|
||||
“{item.line}”
|
||||
</p>
|
||||
{item.hashtags && item.hashtags.length > 0 && (
|
||||
<p className="mt-2 text-[11px] opacity-60">{item.hashtags.join(' ')}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex w-[62px] flex-col items-center gap-3">
|
||||
<span
|
||||
className="grid h-[56px] w-[44px] place-items-center border border-dashed text-center text-[9px] leading-tight opacity-60"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
郵票
|
||||
<br />
|
||||
10원
|
||||
</span>
|
||||
<span
|
||||
className="grid size-[54px] -rotate-6 place-items-center rounded-full border-2 px-1 text-center text-[9px] leading-tight"
|
||||
style={{fontFamily: ITEM_HEADING, borderColor: ITEM_ACCENT, color: ITEM_ACCENT}}
|
||||
>
|
||||
{item.postmark || item.place || '소인'}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="mt-3 flex items-center justify-between gap-2 border-t border-dashed pt-2.5"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
<button
|
||||
type="button"
|
||||
onClick={copy}
|
||||
className="flex shrink-0 items-center gap-1 border px-2 py-1 text-[10px] opacity-75 transition-opacity hover:opacity-100"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{copied ? <Check className="size-3" /> : <Copy className="size-3" />}
|
||||
{copied ? '복사됨' : '복사'}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
export function PostcardStack(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<PostcardItem>(section.type, section.data);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody width="wide">
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : parsed.items.length === 0 ? (
|
||||
<PasteHint label="오늘의 엽서" />
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<Rail label="엽서">
|
||||
{parsed.items.map((item, index) => (
|
||||
<Postcard key={`${item.line}-${index}`} item={item} />
|
||||
))}
|
||||
</Rail>
|
||||
<p className="text-[11px] opacity-60">
|
||||
[복사] 를 누르면 문장과 해시태그가 함께 복사됩니다 · 총 {parsed.items.length}장
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* 체험 프로그램 · 카드 — 소요시간·대상까지 붙여 한 장씩. 처음 오는 손님이 고르기 쉽다.
|
||||
*/
|
||||
import {PriceRow, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {programItems} from './useProgramItems';
|
||||
|
||||
export function ProgramsCards(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template} = props;
|
||||
const items = programItems(industryId);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{items.map((item) => (
|
||||
<PriceRow key={item.name} item={item} variant="card" colors={template.colors} />
|
||||
))}
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/**
|
||||
* 체험 프로그램 · 표 — 프로그램/시간/대상/가격을 열로 세워 비교시킨다.
|
||||
* 정규 클래스처럼 조건을 견줘 고르는 곳에 맞는다.
|
||||
*/
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {programItems} from './useProgramItems';
|
||||
|
||||
export function ProgramsTable(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, template} = props;
|
||||
const items = programItems(industryId);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody>
|
||||
<SectionHeading variant="minimal" title={section.name} colors={template.colors} />
|
||||
|
||||
<div className="overflow-hidden rounded-xl border border-stone-200/80 bg-white shadow-2xs">
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-left text-xs">
|
||||
<thead className="border-b border-stone-100 bg-stone-50/60 font-medium text-stone-500">
|
||||
<tr>
|
||||
<th className="p-3">프로그램</th>
|
||||
<th className="hidden p-3 sm:table-cell">소요 · 대상</th>
|
||||
<th className="p-3 text-right">참가비</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="text-stone-700 [&>tr+tr]:border-t [&>tr+tr]:border-stone-100">
|
||||
{items.map((item) => (
|
||||
<tr key={item.name} className="hover:bg-stone-50/50">
|
||||
<td className="p-3">
|
||||
<span
|
||||
className="block font-bold text-stone-900"
|
||||
style={{color: template.colors.text}}
|
||||
>
|
||||
{item.name}
|
||||
</span>
|
||||
{item.desc && (
|
||||
<span className="mt-0.5 block text-[11px] text-stone-500">{item.desc}</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="hidden p-3 text-[11px] text-stone-500 sm:table-cell">
|
||||
{item.meta?.join(' · ')}
|
||||
</td>
|
||||
<td
|
||||
className="p-3 text-right font-mono font-extrabold text-stone-900"
|
||||
style={{color: template.colors.primary}}
|
||||
>
|
||||
{item.price}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import type {IndustryType} from '@o2o/shared';
|
||||
import type {PricedItem} from '../../primitives';
|
||||
|
||||
/**
|
||||
* 체험 프로그램.
|
||||
*
|
||||
* ★ 지금은 항상 빈 목록이다. 프로그램은 unit(하위 단위)이고, 캔버스 계약에 units 가 없다.
|
||||
* 업종 시드의 programList 를 폴백으로 쓰던 코드를 걷어냈다 — 가공의 상품이 가격까지
|
||||
* 붙어 모든 사업장 화면에 똑같이 떴다.
|
||||
*/
|
||||
export function programItems(_industryId: IndustryType): PricedItem[] {
|
||||
return [];
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
/**
|
||||
* 뒤집어 보는 질문 — 갱지 시험지 플립.
|
||||
*
|
||||
* 앞면은 질문 하나, 뒤집으면 힌트와 출처가 나온다.
|
||||
* ★ 정답을 단정하지 않는다(dataSpec: answer 필드 없음). 이 데이터는 검증되지 않은 줄이 더 많아서
|
||||
* 정답을 걸면 틀린 걸 확신하는 화면이 된다. 힌트까지가 우리가 책임질 수 있는 선이다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type QuizItem} from '@o2o/shared';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ITEM_INK,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
function QuizCard({item, no}: {item: QuizItem; no: number}) {
|
||||
const [flipped, setFlipped] = useState(false);
|
||||
const face = 'w4-flip-face absolute inset-0 flex flex-col justify-between border p-4';
|
||||
const faceStyle = {backgroundColor: ITEM_CARD, borderColor: ITEM_INK};
|
||||
|
||||
return (
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-pressed={flipped}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setFlipped((v) => !v);
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== 'Enter' && event.key !== ' ') return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setFlipped((v) => !v);
|
||||
}}
|
||||
className={cn('w4-flip h-[216px] w-[262px] shrink-0 cursor-pointer snap-center', flipped && 'w4-flip-on')}
|
||||
>
|
||||
<div className="w4-flip-inner relative size-full">
|
||||
<div className={cn(face, 'w4-paper')} style={faceStyle}>
|
||||
<p className="text-[10px] tracking-[0.16em] opacity-60">
|
||||
문제 {no}
|
||||
{item.level ? ` · ${item.level}` : ''}
|
||||
</p>
|
||||
<p className="text-[17px] leading-snug" style={{fontFamily: ITEM_BODY}}>
|
||||
{item.question}
|
||||
</p>
|
||||
<p className="text-[10px]" style={{color: ITEM_ACCENT}}>
|
||||
뒤집기 →
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={cn(face, 'w4-flip-back w4-paper')} style={faceStyle}>
|
||||
<p className="text-[10px] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
|
||||
힌트
|
||||
</p>
|
||||
{item.hint ? (
|
||||
<p className="text-[13px] leading-relaxed opacity-85" style={{fontFamily: ITEM_BODY}}>
|
||||
{item.hint}
|
||||
</p>
|
||||
) : (
|
||||
<p className="text-[13px] opacity-60">힌트가 아직 없습니다.</p>
|
||||
)}
|
||||
<div className="space-y-1 border-t border-dashed pt-2" style={{borderColor: ITEM_BORDER}}>
|
||||
{item.topic && <p className="text-[10px] opacity-60">{item.topic}</p>}
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function QuizFlip(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<QuizItem>(section.type, section.data);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="wide">
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : parsed.items.length === 0 ? (
|
||||
<PasteHint label="뒤집어 보는 질문" />
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<Rail label="질문">
|
||||
{parsed.items.map((item, index) => (
|
||||
<QuizCard key={`${item.question}-${index}`} item={item} no={index + 1} />
|
||||
))}
|
||||
</Rail>
|
||||
<p className="text-[11px] opacity-60">
|
||||
정답은 두지 않습니다 — 힌트와 출처까지만 · 총 {parsed.items.length}문항
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
/**
|
||||
* 지역 읽기 — 한 슬라이드에 한 꼭지.
|
||||
*
|
||||
* ★ 에디터는 **전부 보여준다.** 발행본은 이 중 5~6개만 매번 무작위로 세우지만
|
||||
* (`site/sections/items/ReadingSection.tsx`), 고칠 사람은 안 뽑힌 꼭지도 봐야 한다 —
|
||||
* 에디터에서 무작위로 가리면 방금 고친 글이 다음 렌더에 사라진다.
|
||||
* ★ 출처 줄이 없다. 이 종류의 출처는 제목으로 만든 검색 링크라 서버가 붙인다
|
||||
* (`backend/services/grounding/story.py` `_SEARCH_LINK_KINDS`) — 붙여넣기 단계에는 없다.
|
||||
*/
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type ReadingItem} from '@o2o/shared';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
function Post({item}: {item: ReadingItem}) {
|
||||
return (
|
||||
<article
|
||||
className="w-[300px] shrink-0 snap-center border p-4"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{item.group && (
|
||||
<p
|
||||
className="text-[11px] font-bold tracking-[0.18em]"
|
||||
style={{color: ITEM_ACCENT, fontFamily: ITEM_BODY}}
|
||||
>
|
||||
{item.group}
|
||||
{item.year != null && <span className="font-normal opacity-70"> · {item.year}</span>}
|
||||
</p>
|
||||
)}
|
||||
<h3
|
||||
className="mt-2 border-b-2 pb-2 text-lg leading-snug"
|
||||
style={{fontFamily: ITEM_HEADING, borderColor: 'currentColor'}}
|
||||
>
|
||||
{item.title}
|
||||
</h3>
|
||||
<p
|
||||
className="mt-2.5 text-[13px] leading-[1.8] break-keep opacity-80"
|
||||
style={{fontFamily: ITEM_BODY}}
|
||||
>
|
||||
{item.body}
|
||||
</p>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
export function ReadingRail(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<ReadingItem>(section.type, section.data);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="wide">
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : parsed.items.length === 0 ? (
|
||||
<PasteHint label="지역 읽기" />
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{/* 발행본과 에디터가 다르게 보이는 자리라, 몇 개가 나가는지 여기서 밝힌다. */}
|
||||
<p className="text-[11px] opacity-60">
|
||||
전체 {parsed.items.length}꼭지 · 발행본은 이 중 5~6개를 매번 무작위로 세웁니다
|
||||
</p>
|
||||
<Rail label="지역 읽기" gap={0}>
|
||||
{parsed.items.map((item, index) => (
|
||||
<Post key={`${item.title}-${index}`} item={item} />
|
||||
))}
|
||||
</Rail>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
/**
|
||||
* 객실 한 칸.
|
||||
*
|
||||
* 슬라이드든 격자든 목록이든 "객실 한 개"를 보여주는 방식은 같아야 한다 —
|
||||
* 카드 안쪽이 배리에이션마다 다르면 사장님이 레이아웃을 바꿀 때 정보가 사라진 것처럼 보인다.
|
||||
*/
|
||||
import {ExternalLink, Sparkles} from 'lucide-react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {CtaLink, Pill} from '../../primitives';
|
||||
|
||||
/**
|
||||
* 객실 한 건.
|
||||
*
|
||||
* ★ 이 타입은 원래 시연용 데이터 파일(data/stayData.ts)이 소유했다. 그 파일을 지우면서
|
||||
* 실제로 쓰는 쪽인 여기로 옮겼다 — 타입이 데이터 시드에 매여 있을 이유가 없다.
|
||||
* 서버 unit 이 캔버스로 흘러오게 되면 이 모양에 맞춰 매핑하면 된다.
|
||||
*/
|
||||
export interface Room {
|
||||
slug: string;
|
||||
name: string;
|
||||
subName: string;
|
||||
type: string;
|
||||
capacity: string;
|
||||
bedInfo: string;
|
||||
size: string;
|
||||
price: string;
|
||||
weekdayPrice: string;
|
||||
weekendPrice: string;
|
||||
/** 다른 객실과의 차이 한 줄 */
|
||||
difference: string;
|
||||
description: string;
|
||||
features: string[];
|
||||
amenities: string[];
|
||||
images: {url: string; alt: string}[];
|
||||
}
|
||||
|
||||
export function RoomCard({
|
||||
room,
|
||||
index,
|
||||
total,
|
||||
bookingUrl,
|
||||
layout = 'card',
|
||||
colors,
|
||||
className,
|
||||
}: {
|
||||
room: Room;
|
||||
index: number;
|
||||
total: number;
|
||||
bookingUrl: string;
|
||||
/** card = 사진 위 / 정보 아래, row = 사진 왼쪽 / 정보 오른쪽 */
|
||||
layout?: 'card' | 'row';
|
||||
/**
|
||||
* 템플릿 색 토큰. 객실명·요금·예약 버튼이 브랜드 색을 따른다.
|
||||
*
|
||||
* ★ "차별점" 상자의 호박색은 그대로 둔다 — 카드 안에서 유일하게 눈을 끄는 자리라,
|
||||
* 토큰을 먹이면 제목·요금과 같은 색이 되어 강조가 사라진다.
|
||||
*/
|
||||
colors?: TemplateItem['colors'];
|
||||
className?: string;
|
||||
}) {
|
||||
const specs = (
|
||||
<div className="space-y-1 border-t border-stone-200/60 pt-1 text-xs text-stone-600">
|
||||
<p className="flex items-center gap-1.5">
|
||||
<span className="text-stone-400">•</span>
|
||||
<span>수용 인원: {room.capacity}</span>
|
||||
</p>
|
||||
<p className="flex items-center gap-1.5">
|
||||
<span className="text-stone-400">•</span>
|
||||
<span>침대 구성: {room.bedInfo}</span>
|
||||
</p>
|
||||
<p className="flex items-center gap-1.5">
|
||||
<span className="text-stone-400">•</span>
|
||||
<span>면적: {room.size}</span>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
const highlight = (
|
||||
<div className="flex items-start gap-2 rounded-xl border border-amber-200/70 bg-amber-50/80 p-3 text-xs text-amber-950">
|
||||
<Sparkles className="mt-0.5 size-4 shrink-0 text-amber-600" />
|
||||
<div className="break-keep leading-relaxed">
|
||||
<strong className="font-bold">차별점: </strong>
|
||||
<span>{room.difference}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const cover = (
|
||||
<div
|
||||
className={cn(
|
||||
'relative overflow-hidden bg-stone-100',
|
||||
layout === 'row' ? 'aspect-4/3 sm:aspect-auto sm:h-full' : 'aspect-16/10',
|
||||
)}
|
||||
>
|
||||
<img src={room.images[0].url} alt={room.images[0].alt} className="size-full object-cover" />
|
||||
<Pill tone="dark" className="absolute left-3 top-3 rounded-full px-2.5 py-1 text-[11px] backdrop-blur-md">
|
||||
{room.type}
|
||||
</Pill>
|
||||
{layout === 'card' && (
|
||||
<span className="absolute bottom-2.5 right-2.5 rounded-lg bg-white/95 px-2.5 py-1 text-xs font-bold text-stone-900 shadow-2xs backdrop-blur-md">
|
||||
{index + 1} / {total}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
const body = (
|
||||
<div className="space-y-3 p-4 sm:p-5">
|
||||
<div className="space-y-1">
|
||||
<h3
|
||||
className="serif-title text-base font-bold leading-snug text-stone-900 sm:text-lg"
|
||||
style={colors ? {color: colors.text} : undefined}
|
||||
>
|
||||
{room.name}
|
||||
</h3>
|
||||
<div
|
||||
className="font-mono text-sm font-extrabold text-stone-900 sm:text-base"
|
||||
style={colors ? {color: colors.primary} : undefined}
|
||||
>
|
||||
{room.price}
|
||||
</div>
|
||||
</div>
|
||||
{highlight}
|
||||
{specs}
|
||||
</div>
|
||||
);
|
||||
|
||||
const action = (
|
||||
<div className="p-4 pt-0 sm:p-5 sm:pt-0">
|
||||
<CtaLink href={bookingUrl} variant="solid" size="sm" colors={colors} block>
|
||||
{/* ★ "실시간 예약 신청" 이었다(2026-09-09 수정). 실시간 재고를 갖지 않으므로
|
||||
누르면 예약이 확정되는 것처럼 읽히면 안 된다 — 발행본과 같은 말로 맞춘다. */}
|
||||
<span>예약 안내 보기</span>
|
||||
<ExternalLink className="size-3.5" />
|
||||
</CtaLink>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (layout === 'row') {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'grid grid-cols-1 overflow-hidden rounded-2xl border border-stone-200/90 bg-stone-50/70 shadow-2xs sm:grid-cols-12',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className="sm:col-span-5">{cover}</div>
|
||||
<div className="flex flex-col justify-between sm:col-span-7">
|
||||
{body}
|
||||
{action}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col justify-between overflow-hidden rounded-2xl border border-stone-200/90 bg-stone-50/70 shadow-2xs',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div>
|
||||
{cover}
|
||||
{body}
|
||||
</div>
|
||||
{action}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* 객실 · 가로 슬라이드 — 모바일에서 한 칸씩 스와이프, PC 에서는 2열.
|
||||
* 객실이 2~4개일 때 가장 자연스럽다.
|
||||
*/
|
||||
import {EmptyStateNotice, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {bookingHref} from '../common';
|
||||
import {RoomCard, type Room} from './RoomCard';
|
||||
|
||||
export function RoomsCarousel(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, template} = props;
|
||||
const url = bookingHref(industryId, storeName);
|
||||
// ★ 객실(unit)은 캔버스 계약에 없다 — 시연용 세트로 자리를 메우지 않는다.
|
||||
const rooms: Room[] = [];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading title={section.name} subtitle="자연을 오롯이 품은 객실 타입" colors={template.colors} />
|
||||
|
||||
{rooms.length === 0 ? (
|
||||
<EmptyStateNotice>객실 정보는 아직 준비 중입니다.</EmptyStateNotice>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
<div className="scrollbar-none flex snap-x snap-mandatory gap-4 overflow-x-auto px-1 pb-4 sm:grid sm:grid-cols-2 sm:gap-6 sm:overflow-visible sm:pb-0">
|
||||
{rooms.map((room, idx) => (
|
||||
<RoomCard
|
||||
key={room.slug}
|
||||
room={room}
|
||||
index={idx}
|
||||
total={rooms.length}
|
||||
bookingUrl={url}
|
||||
className="w-[85vw] max-w-[340px] shrink-0 snap-center sm:w-full"
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-center gap-2 pt-1 text-[11px] text-stone-400 sm:hidden">
|
||||
<span>← 좌우로 스와이프하여 다른 객실을 확인하세요 →</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* 객실 · 격자 — 전부 한눈에 늘어놓는다. 객실이 많고 비교해서 고르게 하고 싶을 때.
|
||||
*/
|
||||
import {EmptyStateNotice, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {bookingHref} from '../common';
|
||||
import {RoomCard, type Room} from './RoomCard';
|
||||
|
||||
export function RoomsGrid(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, template} = props;
|
||||
const url = bookingHref(industryId, storeName);
|
||||
// ★ 객실(unit)은 캔버스 계약에 없다 — 시연용 세트로 자리를 메우지 않는다.
|
||||
const rooms: Room[] = [];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody width="wide">
|
||||
<SectionHeading
|
||||
variant="centered"
|
||||
eyebrow="ROOMS"
|
||||
title={section.name}
|
||||
subtitle="원하는 객실을 비교해 보세요"
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
{rooms.length === 0 ? (
|
||||
<EmptyStateNotice>객실 정보는 아직 준비 중입니다.</EmptyStateNotice>
|
||||
) : (
|
||||
<div className="grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{rooms.map((room, idx) => (
|
||||
<RoomCard
|
||||
key={room.slug}
|
||||
room={room}
|
||||
index={idx}
|
||||
total={rooms.length}
|
||||
bookingUrl={url}
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* 객실 · 가로 목록 — 사진 왼쪽, 설명 오른쪽으로 한 줄씩.
|
||||
* 객실마다 설명이 길 때 글을 넉넉히 읽힌다.
|
||||
*/
|
||||
import {EmptyStateNotice, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {bookingHref} from '../common';
|
||||
import {RoomCard, type Room} from './RoomCard';
|
||||
|
||||
export function RoomsList(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, template} = props;
|
||||
const url = bookingHref(industryId, storeName);
|
||||
// ★ 객실(unit)은 캔버스 계약(SectionRenderProps)에 없다 — 흘러올 창구가 생기기 전까지 빈다.
|
||||
// 시연용 세트로 자리를 메우지 않는다: 남의 객실·요금이 사장님 사이트로 발행된다.
|
||||
const rooms: Room[] = [];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody>
|
||||
<SectionHeading title={section.name} subtitle="객실별 구성과 차이를 자세히" colors={template.colors} />
|
||||
|
||||
{rooms.length === 0 ? (
|
||||
<EmptyStateNotice>객실 정보는 아직 준비 중입니다.</EmptyStateNotice>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
{rooms.map((room, idx) => (
|
||||
<RoomCard
|
||||
key={room.slug}
|
||||
room={room}
|
||||
index={idx}
|
||||
total={rooms.length}
|
||||
bookingUrl={url}
|
||||
layout="row"
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
/**
|
||||
* 가요 다방 — 턴테이블 하나 + 도넛판 캐러셀.
|
||||
*
|
||||
* 판을 누르면 톤암이 내려오고 판이 돈다. 가사를 못 싣는 제약(DB_Guide: 원문 전재 금지)을
|
||||
* 숨기지 않고 라벨 아래 각인으로 드러낸다 — 제약이 곧 이 아이템의 인상이다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type SongItem} from '@o2o/shared';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_HEADING,
|
||||
ITEM_INVERSE,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
/** 곡이 라벨 색을 안 주면 템플릿 강조색이 라벨이 된다 — hex 를 박으면 팔레트를 바꿔도 판만 남는다. */
|
||||
const FALLBACK_LABEL = ITEM_ACCENT;
|
||||
|
||||
export function SongsTurntable(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template} = props;
|
||||
const parsed = parseSectionData<SongItem>(section.type, section.data);
|
||||
const [playing, setPlaying] = useState(0);
|
||||
|
||||
// 항목이 줄어 인덱스가 범위를 벗어나도 첫 곡으로 떨어진다 — 빈 화면을 만들지 않는다.
|
||||
const current = parsed.items[playing] ?? parsed.items[0];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="dark">
|
||||
{/* ★ 어두운 면 위의 글자색을 여기서 한 번만 정한다. 아래는 전부 currentColor·opacity 로 단을 만든다 —
|
||||
자식마다 색을 박으면 템플릿을 바꿨을 때 한두 곳이 옛 색으로 남는다. */}
|
||||
<SectionBody width="wide" className="text-[color:var(--tpl-bg,#fff)]">
|
||||
<div className="space-y-1.5">
|
||||
<p className="text-[11px] tracking-[0.28em]" style={{color: ITEM_ACCENT}}>
|
||||
33⅓ RPM
|
||||
</p>
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-55" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : !current ? (
|
||||
<PasteHint label="가요 다방" />
|
||||
) : (
|
||||
<>
|
||||
<div className="grid items-center gap-8 border p-6 sm:p-8 md:grid-cols-[260px_minmax(0,1fr)]"
|
||||
style={{
|
||||
backgroundColor: ITEM_INVERSE,
|
||||
borderColor: 'color-mix(in oklab, currentColor 22%, transparent)',
|
||||
}}>
|
||||
{/* 턴테이블 */}
|
||||
<div className="relative mx-auto size-[240px]">
|
||||
{/* 플래터 — 판 아래 깔리는 원반. 어두운 면 위에 글자색을 옅게 얹어 단을 만든다. */}
|
||||
<div
|
||||
className="absolute inset-0 rounded-full shadow-[0_10px_26px_rgba(0,0,0,.45)]"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 16%, transparent)'}}
|
||||
/>
|
||||
<div
|
||||
className="w4-disc w4-spin absolute inset-2 rounded-full"
|
||||
style={{
|
||||
['--lbl' as string]: current.labelColor || FALLBACK_LABEL,
|
||||
['--w4-vinyl' as string]: ITEM_INVERSE,
|
||||
}}
|
||||
>
|
||||
<div className="w4-disc-sheen absolute inset-0 rounded-full" />
|
||||
<div
|
||||
className="absolute left-1/2 top-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 30%, transparent)'}}
|
||||
/>
|
||||
</div>
|
||||
{/* 톤암 — 곡이 얹혀 있으니 항상 내려와 있다. */}
|
||||
<div className="absolute -right-1 top-3 h-2 w-[120px] origin-right rotate-6">
|
||||
<div
|
||||
className="absolute inset-y-[3px] right-4 left-0 rounded-sm"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 65%, transparent)'}}
|
||||
/>
|
||||
<div
|
||||
className="absolute left-0 -top-1 h-4 w-4 rounded-sm"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 40%, transparent)'}}
|
||||
/>
|
||||
<div
|
||||
className="absolute -top-2 right-0 size-6 rounded-full"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 55%, transparent)'}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 지금 도는 곡 */}
|
||||
<div className="min-w-0 space-y-3">
|
||||
<p className="text-[10px] tracking-[0.24em]" style={{color: ITEM_ACCENT}}>
|
||||
A면 · {playing + 1} / {parsed.items.length}
|
||||
</p>
|
||||
<h3 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{current.title}
|
||||
</h3>
|
||||
<p className="text-xs opacity-55">
|
||||
{[
|
||||
current.artist,
|
||||
current.year ? String(current.year) : undefined,
|
||||
current.lyricist || current.composer
|
||||
? `작사 ${current.lyricist ?? '미상'} / 작곡 ${current.composer ?? '미상'}`
|
||||
: undefined,
|
||||
current.label,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
</p>
|
||||
{current.story && (
|
||||
<p
|
||||
className="max-w-[46ch] text-sm leading-relaxed opacity-80"
|
||||
style={{fontFamily: ITEM_BODY}}
|
||||
>
|
||||
{current.story}
|
||||
</p>
|
||||
)}
|
||||
{current.connection && (
|
||||
<p
|
||||
className="max-w-[46ch] text-sm leading-relaxed"
|
||||
style={{fontFamily: ITEM_BODY, color: template.colors.accent}}
|
||||
>
|
||||
{current.connection}
|
||||
</p>
|
||||
)}
|
||||
<span className="inline-block border border-dashed px-2 py-1 text-[10px] tracking-[0.1em] opacity-60"
|
||||
style={{borderColor: 'color-mix(in oklab, currentColor 35%, transparent)'}}>
|
||||
◎ 가사 대신 이야기 — 원문은 싣지 않습니다
|
||||
</span>
|
||||
<SourceLine source={current.source} verified={current.verified} tone="dark" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 판 고르기 */}
|
||||
<Rail label="곡" tone="dark">
|
||||
{parsed.items.map((song, index) => (
|
||||
<button
|
||||
key={`${song.title}-${index}`}
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setPlaying(index);
|
||||
}}
|
||||
aria-current={index === playing}
|
||||
className="w-24 shrink-0 snap-center text-center"
|
||||
>
|
||||
<span
|
||||
className="w4-disc-mini mx-auto block size-[84px] rounded-full transition-transform hover:scale-105"
|
||||
style={{
|
||||
['--lbl' as string]: song.labelColor || FALLBACK_LABEL,
|
||||
['--w4-vinyl' as string]: ITEM_INVERSE,
|
||||
// 고른 판만 강조색 링 — 금색을 박으면 팔레트를 바꿔도 이 링만 남는다.
|
||||
boxShadow:
|
||||
index === playing
|
||||
? `0 0 0 2px ${ITEM_ACCENT}, 0 3px 10px rgba(0,0,0,.4)`
|
||||
: undefined,
|
||||
}}
|
||||
/>
|
||||
<span className="mt-2 block truncate text-[10px] leading-tight opacity-55">
|
||||
{song.title}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</Rail>
|
||||
</>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* 공간 안내 · 목록 — 사진 없이 구역 이름과 설명만. 사진이 부실할 때 더 깔끔하다.
|
||||
*/
|
||||
import {ListCard, PlaceRow, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
|
||||
export function SpaceList(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template, photos} = props;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading variant="minimal" title={section.name} colors={template.colors} />
|
||||
|
||||
<ListCard>
|
||||
{photos.map((photo) => (
|
||||
<PlaceRow
|
||||
key={photo.id}
|
||||
name={photo.title}
|
||||
meta={photo.category}
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</ListCard>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* 공간 안내 · 구역 카드 — 수집된 사진을 "어떤 자리인지"로 묶어 보여준다.
|
||||
* 좌석/층 구성이 궁금한 카페·다이닝에 맞는다.
|
||||
*/
|
||||
import {PhotoTile, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
|
||||
export function SpaceZones(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template, photos, infoFields} = props;
|
||||
const seats = infoFields.find((f) => f.id === 'seats');
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
title={section.name}
|
||||
subtitle={section.description}
|
||||
trailing={
|
||||
seats && !seats.requiresVerification ? (
|
||||
<span className="rounded-lg border border-stone-200 bg-stone-50 px-2.5 py-1 text-[11px] font-medium text-stone-600">
|
||||
{seats.value}
|
||||
</span>
|
||||
) : null
|
||||
}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{photos.map((photo) => (
|
||||
<div key={photo.id} className="space-y-2">
|
||||
<PhotoTile
|
||||
photo={{id: photo.id, url: photo.url, alt: photo.title}}
|
||||
fit="landscape"
|
||||
showMeta={false}
|
||||
/>
|
||||
<div className="space-y-0.5 px-0.5">
|
||||
<span
|
||||
className="block text-xs font-bold text-stone-900"
|
||||
style={{color: template.colors.text}}
|
||||
>
|
||||
{photo.title}
|
||||
</span>
|
||||
<span className="block text-[11px] text-stone-500">{photo.category}</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/**
|
||||
* 영상 — 캔버스.
|
||||
*
|
||||
* ★ **캔버스에서는 재생하지 않는다.** 에디터 미리보기 안에 유튜브 iframe 을 띄우면
|
||||
* 섹션을 고를 때마다 남의 스크립트가 붙었다 떨어지고, 사장님이 편집 중에 광고가 돈다.
|
||||
* 여기서는 표지와 자막만 보여주고, 재생은 발행본에서 한다.
|
||||
* ★ 유튜브가 아닌 주소는 표지가 없다 — 그 사실을 그 자리에서 말한다.
|
||||
*/
|
||||
import {parseSectionData, youtubeId, youtubePoster, isVerticalVideo, type VideoItem} from '@o2o/shared';
|
||||
import {Play} from 'lucide-react';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {ITEM_BODY, ITEM_BORDER, ITEM_CARD, ITEM_HEADING, ParseError, PasteHint, SourceLine} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
export function VideoFrame(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<VideoItem>(section.type, section.data);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody width="wide">
|
||||
<div className="space-y-1.5">
|
||||
<h2 className="text-2xl sm:text-3xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
{parsed.title || section.name}
|
||||
</h2>
|
||||
{(parsed.subtitle || section.description) && (
|
||||
<p className="text-sm opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{parsed.subtitle || section.description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{parsed.error ? (
|
||||
<ParseError message={parsed.error} />
|
||||
) : parsed.items.length === 0 ? (
|
||||
<PasteHint label="영상" />
|
||||
) : (
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
{parsed.items.map((item, index) => {
|
||||
const id = youtubeId(item.url);
|
||||
const vertical = isVerticalVideo(item.url);
|
||||
return (
|
||||
<figure key={`${item.url}-${index}`} className="space-y-2">
|
||||
<div
|
||||
className="relative overflow-hidden border"
|
||||
style={{
|
||||
borderColor: ITEM_BORDER,
|
||||
backgroundColor: ITEM_CARD,
|
||||
aspectRatio: vertical ? '9 / 16' : '16 / 9',
|
||||
maxHeight: vertical ? 420 : undefined,
|
||||
marginInline: vertical ? 'auto' : undefined,
|
||||
width: vertical ? 'min(100%, 236px)' : undefined,
|
||||
}}
|
||||
>
|
||||
{id ? (
|
||||
<>
|
||||
<img
|
||||
src={youtubePoster(id)}
|
||||
alt=""
|
||||
className="size-full object-cover"
|
||||
loading="lazy"
|
||||
/>
|
||||
<span className="absolute inset-0 grid place-items-center">
|
||||
<span className="grid size-12 place-items-center rounded-full bg-black/60 text-white">
|
||||
<Play className="size-5" />
|
||||
</span>
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
<span className="grid size-full place-items-center px-4 text-center text-[11px] opacity-60">
|
||||
유튜브 주소가 아닙니다 — 발행본에서는 링크로만 나갑니다
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{item.caption && (
|
||||
<figcaption className="text-xs opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{item.caption}
|
||||
</figcaption>
|
||||
)}
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</figure>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {WeatherPanel} from '../local/WeatherPanel';
|
||||
|
||||
/** 에디터에서 순서·노출을 독립적으로 관리하는 날씨 섹션. */
|
||||
export function WeatherSection({
|
||||
section,
|
||||
isSelected,
|
||||
onSelect,
|
||||
location,
|
||||
weatherLocation,
|
||||
template,
|
||||
}: SectionRenderProps) {
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading
|
||||
variant="minimal"
|
||||
title="오늘의 날씨"
|
||||
subtitle={`${location || '사업장 주변'}의 현재 기상 정보입니다.`}
|
||||
colors={template.colors}
|
||||
/>
|
||||
<WeatherPanel location={location} weatherLocation={weatherLocation} />
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import type {IndustryType, TemplateItem} from '@o2o/shared';
|
||||
import {derivePalette} from '@/features/dev/palette';
|
||||
import {derivePalette} from './palette';
|
||||
|
||||
export interface ColorPalettePreset {
|
||||
id: string;
|
||||
|
||||
+8
-38
@@ -1,14 +1,6 @@
|
||||
import {mix} from '@/lib/color';
|
||||
|
||||
/**
|
||||
* 팔레트 → 디자인 토큰 유도.
|
||||
*
|
||||
* colorhunt 처럼 **색 4개**만 주어졌을 때, 그걸 화면 전체를 바꿀 수 있는 토큰 한 벌로 편다.
|
||||
*
|
||||
* ★ 색을 역할에 배정하는 규칙이 이 파일의 전부다. 아무 색이나 primary 로 쓰면
|
||||
* 흰 글씨가 안 보이는 버튼이 나온다 — primary 는 "흰 글씨를 얹을 수 있는 어두운 색" 이라는
|
||||
* 계약을 지켜야 한다(배리에이션들이 그 전제로 쓰고 있다).
|
||||
*/
|
||||
/** 팔레트 → 디자인 토큰 유도. */
|
||||
|
||||
/** `#rrggbb` 로 정규화. 못 읽으면 null. */
|
||||
function normalizeHex(raw: string): string | null {
|
||||
@@ -57,13 +49,7 @@ export function carriesWhiteText(hex: string): boolean {
|
||||
return contrast(hex, '#ffffff') >= MIN_CONTRAST;
|
||||
}
|
||||
|
||||
/**
|
||||
* 대비가 모자라면 될 때까지 어둡게(또는 밝게) 민다.
|
||||
*
|
||||
* ★ 팔레트 사이트의 색은 '예쁜 조합'이지 '읽히는 조합'이 아니다.
|
||||
* 고른 색을 그대로 쓰면 버튼 위 흰 글씨가 안 보이는 팔레트가 절반이다 —
|
||||
* 여기서 최소 대비를 보장한다. 색상(hue)은 유지되고 밝기만 움직인다.
|
||||
*/
|
||||
/** 대비가 모자라면 될 때까지 어둡게(또는 밝게) 민다. */
|
||||
function ensureContrast(color: string, against: string, min = MIN_CONTRAST): string {
|
||||
const toward = luminance(against) > 0.5 ? '#000000' : '#ffffff';
|
||||
let out = color;
|
||||
@@ -73,14 +59,7 @@ function ensureContrast(color: string, against: string, min = MIN_CONTRAST): str
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 입력에서 hex 를 뽑는다.
|
||||
*
|
||||
* 받아들이는 것:
|
||||
* - colorhunt URL `https://colorhunt.co/palette/222831393e46948979dfd0b8`
|
||||
* - `#222831 #393E46 #948979 #DFD0B8` (쉼표·줄바꿈·공백 아무거나)
|
||||
* - `222831,393e46,...`
|
||||
*/
|
||||
/** 입력에서 hex 를 뽑는다. */
|
||||
export function parsePalette(input: string): string[] {
|
||||
const text = input.trim();
|
||||
|
||||
@@ -113,14 +92,7 @@ export interface DerivedPalette {
|
||||
border: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 색 목록 → 토큰 한 벌.
|
||||
*
|
||||
* 배정 규칙:
|
||||
* 밝은 순으로 세워서 밝은 쪽은 바탕(surface/card), 어두운 쪽은 글자(text/inverse).
|
||||
* primary 는 **어두운 것 중 가장 색이 있는 것** — 흰 글씨 계약을 지키기 위해서다.
|
||||
* accent 는 밝기와 무관하게 가장 색이 진한 것(배경으로는 안 쓰이므로 자유롭다).
|
||||
*/
|
||||
/** 색 목록 → 토큰 한 벌. */
|
||||
export function derivePalette(input: string[]): DerivedPalette | null {
|
||||
const hexes = [...new Set(input)];
|
||||
if (hexes.length < 2) return null;
|
||||
@@ -130,8 +102,7 @@ export function derivePalette(input: string[]): DerivedPalette | null {
|
||||
const lightest = byLight[0];
|
||||
const darkest = byLight[byLight.length - 1];
|
||||
const second = byLight[1] ?? lightest;
|
||||
// 보조 텍스트·테두리에 쓸 중간 색. 밝은 바탕 위에서 읽혀야 하므로
|
||||
// 너무 밝으면(0.6 초과) 쓰지 않고 가장 어두운 색으로 떨어뜨린다.
|
||||
// 보조 텍스트·테두리에 쓸 중간 색.
|
||||
const midCandidate = byLight[byLight.length - 2] ?? darkest;
|
||||
const mid = luminance(midCandidate) > 0.6 ? darkest : midCandidate;
|
||||
|
||||
@@ -143,10 +114,9 @@ export function derivePalette(input: string[]): DerivedPalette | null {
|
||||
// 후보가 전부 밝으면(파스텔 팔레트) 대비가 찰 때까지 어둡게 민다.
|
||||
const primary = ensureContrast(primaryBase, '#ffffff');
|
||||
|
||||
// ★ 팔레트 4색만으로는 '면 단계'가 부족하다 — 섹션 기본 / 살짝 어두운 면 / 카드 세 단계가
|
||||
// 서로 구분돼야 섹션이 경계선 없이도 나뉜다. 가장 밝은 색을 기준으로 섞어서 만든다.
|
||||
// 팔레트 4색만으로는 '면 단계'가 부족하다 — 섹션 기본 / 살짝 어두운 면 / 카드 세 단계가 서로 구분돼야 섹션이 경계선 없이도 나뉜다.
|
||||
return {
|
||||
// 섹션 기본 바탕(가장 흔한 톤). 팔레트의 가장 밝은 색을 그대로 쓴다.
|
||||
// 섹션 기본 바탕(가장 흔한 톤).
|
||||
bg: lightest,
|
||||
// paper 톤 — 기본보다 아주 살짝 어둡게.
|
||||
surface: mix(lightest, darkest, 0.06),
|
||||
@@ -160,7 +130,7 @@ export function derivePalette(input: string[]): DerivedPalette | null {
|
||||
secondary: ensureContrast(mid, lightest),
|
||||
primary,
|
||||
accent,
|
||||
// ★ 테두리를 card 와 같게 두면 카드 경계가 사라진다 — 한 단계 어두운 중간색을 쓴다.
|
||||
// 테두리를 card 와 같게 두면 카드 경계가 사라진다 — 한 단계 어두운 중간색을 쓴다.
|
||||
border: mid,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import type {SectionItem} from '@o2o/shared';
|
||||
import {SECTION_DATA_SPEC} from './dataSpec';
|
||||
import type {ThumbKey} from './thumbs';
|
||||
|
||||
export interface AddableSection {
|
||||
type: string;
|
||||
name: string;
|
||||
description: string;
|
||||
thumb: ThumbKey;
|
||||
}
|
||||
|
||||
const META: Record<string, {description: string; thumb: ThumbKey}> = {
|
||||
songs: {description: '도넛판을 눌러 얹으면 판이 돈다. 곡 3~8개일 때 가장 좋다.', thumb: 'carousel'},
|
||||
daily: {description: '오늘 날짜에 맞는 한 장이 자동으로 펼쳐진다.', thumb: 'compact'},
|
||||
people: {description: '프레임 하나가 인물 하나. 사진이 없으면 이름 활자가 대신 들어간다.', thumb: 'carousel'},
|
||||
chronicle: {description: '연도가 큰 활자로 서고 사건이 붙는다.', thumb: 'timeline'},
|
||||
reading: {description: '한 슬라이드에 한 꼭지. 발행본은 이 중 5~6개만 무작위로 세운다.', thumb: 'carousel'},
|
||||
postcard: {description: '우표 자리와 소인이 찍힌 엽서 뒷면. 손님이 그대로 퍼 간다.', thumb: 'carousel'},
|
||||
quiz: {description: '앞면은 질문, 뒤집으면 힌트와 출처. 정답은 두지 않는다.', thumb: 'cards'},
|
||||
video: {description: '표지를 먼저 보여주고 누르면 재생한다.', thumb: 'fullbleed'},
|
||||
event: {description: '지금 하는 행사와 공지.', thumb: 'cards'},
|
||||
itinerary: {description: '표 한 장이 정거장 하나인 승차권 일정.', thumb: 'carousel'},
|
||||
};
|
||||
|
||||
// dataSpec이 단일 출처다. 아이템을 하나 더 만들면 여기에도 자동으로 나타난다.
|
||||
export const ADDABLE_SECTIONS: AddableSection[] = Object.values(SECTION_DATA_SPEC).map((spec) => ({
|
||||
type: spec.kind,
|
||||
name: spec.label,
|
||||
description: META[spec.kind]?.description ?? '',
|
||||
thumb: META[spec.kind]?.thumb ?? 'cards',
|
||||
}));
|
||||
|
||||
export function addableSection(type: string): AddableSection | undefined {
|
||||
return ADDABLE_SECTIONS.find((item) => item.type === type);
|
||||
}
|
||||
|
||||
// id는 타입과 같다. 같은 아이템을 두 번 넣지 않는다.
|
||||
export function newSectionOf(type: string): SectionItem | undefined {
|
||||
const addable = addableSection(type);
|
||||
if (!addable) return undefined;
|
||||
return {
|
||||
id: type,
|
||||
type,
|
||||
name: addable.name,
|
||||
description: addable.description,
|
||||
isLocked: false,
|
||||
isEnabled: true,
|
||||
};
|
||||
}
|
||||
+8
-45
@@ -1,12 +1,4 @@
|
||||
/**
|
||||
* 붙여넣기 아이템의 **쓰는 쪽** — "이 섹션 타입의 JSON 을 어떻게 받아 오나".
|
||||
*
|
||||
* 프롬프트·예시·라벨이 여기 있고, **읽는 쪽 계약**(항목 타입 · 파서)은 `@o2o/shared` 에 있다 —
|
||||
* 같은 JSON 을 빌더 캔버스와 발행 사이트가 함께 읽기 때문이다(`shared/lib/section-data.ts`).
|
||||
*
|
||||
* 배리에이션 레지스트리와 같은 결이다: 여기 한 줄을 더하면 캔버스·[콘텐츠] 탭·프롬프트가 동시에 는다.
|
||||
* 데이터는 섹션 **타입**에 붙고 모양은 배리에이션이 갈아끼운다 — 같은 곡 JSON 으로 도넛판도 카세트도 된다.
|
||||
*/
|
||||
/** 붙여넣기 아이템의 **쓰는 쪽** — "이 섹션 타입의 JSON 을 어떻게 받아 오나". */
|
||||
|
||||
import {SECTION_PROMPT_RULES, SECTION_PROMPTS} from '@o2o/shared';
|
||||
|
||||
@@ -20,22 +12,9 @@ export interface SectionDataSpec {
|
||||
task: string;
|
||||
/** 그 아이템에만 걸리는 금지·형식 규칙. */
|
||||
rules: string;
|
||||
/**
|
||||
* 직접 입력 폼의 칸.
|
||||
*
|
||||
* ★ 왜 필요한가: JSON 붙여넣기가 유일한 입구였다. 한 글자만 고치고 싶어도 사장님이
|
||||
* 중괄호와 쉼표를 헤집어야 했고, 쉼표 하나 잘못 지우면 섹션이 통째로 사라졌다.
|
||||
* ChatGPT 를 안 쓰는 사장님은 아예 못 채운다.
|
||||
* ★ 폼과 JSON 은 **한 값의 두 얼굴**이다 — 진실은 `section.data` 문자열 하나뿐이고
|
||||
* 폼은 그걸 비춘다. 그래서 JSON 을 붙여넣으면 폼이 따라 바뀌고, 폼을 고치면 JSON 이
|
||||
* 다시 쓰인다. 어느 쪽이 최신인지 물을 일이 없다.
|
||||
*/
|
||||
/** 직접 입력 폼의 칸. */
|
||||
fields: ItemField[];
|
||||
/**
|
||||
* 항목 안의 목록(정거장 · 시간대 · 들르는 곳).
|
||||
*
|
||||
* ★ 이게 없으면 코스·스케줄은 폼으로 못 채운다 — 그 아이템의 알맹이가 전부 이 배열에 있다.
|
||||
*/
|
||||
/** 항목 안의 목록(정거장 · 시간대 · 들르는 곳). */
|
||||
child?: {key: string; label: string; fields: ItemField[]};
|
||||
}
|
||||
|
||||
@@ -60,8 +39,7 @@ const SOURCE_FIELDS: ItemField[] = [
|
||||
{key: 'source.url', label: '출처 주소', type: 'text', hint: '실제로 열리는 공식·기관·언론 페이지'},
|
||||
];
|
||||
|
||||
// ★ 테마 전체 상한이 64KB 다(site_service._THEME_MAX_BYTES). 세 아이템이 각자 다 채우면 거절당하고,
|
||||
// 거절은 발행 직전에야 드러난다. 그래서 한 섹션당 여기서 먼저 끊는다.
|
||||
// 테마 전체 상한이 64KB 다(site_service._THEME_MAX_BYTES).
|
||||
export const SECTION_DATA_MAX_CHARS = 12000;
|
||||
|
||||
export interface PromptContext {
|
||||
@@ -72,11 +50,7 @@ export interface PromptContext {
|
||||
industryLabel: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 주소 원문에서 시·군·구 한 조각.
|
||||
*
|
||||
* ★ 주소를 통째로 넣으면 모델이 그 동네 안쪽만 뒤진다. 이야깃거리는 시 단위에 있다.
|
||||
*/
|
||||
/** 주소 원문에서 시·군·구 한 조각. */
|
||||
export function regionOf(location: string): string {
|
||||
const token = location
|
||||
.trim()
|
||||
@@ -87,12 +61,7 @@ export function regionOf(location: string): string {
|
||||
|
||||
const PROMPT_RULES = SECTION_PROMPT_RULES;
|
||||
|
||||
/**
|
||||
* 붙여넣으면 바로 답이 나오는 프롬프트.
|
||||
*
|
||||
* ★ `[지역]` 같은 빈칸을 남기지 않는다. 빈칸이 있으면 사장님이 못 채우고 그대로 보내고,
|
||||
* 모델은 빈칸을 지명으로 착각해 엉뚱한 곳 이야기를 지어낸다.
|
||||
*/
|
||||
/** 붙여넣으면 바로 답이 나오는 프롬프트. */
|
||||
export function buildPrompt(spec: SectionDataSpec, ctx: PromptContext): string {
|
||||
const store = ctx.storeName.trim() || '(가게 이름을 먼저 입력해 주세요)';
|
||||
const region = regionOf(ctx.location) || '(주소를 먼저 입력해 주세요)';
|
||||
@@ -378,9 +347,7 @@ export const SECTION_DATA_SPEC: Record<string, SectionDataSpec> = {
|
||||
),
|
||||
task: SECTION_PROMPTS.reading.task,
|
||||
rules: SECTION_PROMPTS.reading.rules,
|
||||
/* 출처 칸이 없다 — 이 종류의 출처는 서버가 제목으로 만든 검색 링크다
|
||||
(`backend/services/grounding/story.py` `_SEARCH_LINK_KINDS`). 손으로 적는 칸을 두면
|
||||
거기 적힌 주소가 그 규칙을 비껴간다. */
|
||||
/* 출처 칸이 없다 — 이 종류의 출처는 서버가 제목으로 만든 검색 링크다 (`backend/services/grounding/story.py` `_SEARCH_LINK_KINDS`). */
|
||||
fields: [
|
||||
{key: 'group', label: '갈래', half: true, hint: '인물 · 문학'},
|
||||
{key: 'year', label: '연도', type: 'number', half: true},
|
||||
@@ -560,11 +527,7 @@ export const SECTION_DATA_SPEC: Record<string, SectionDataSpec> = {
|
||||
null,
|
||||
2,
|
||||
),
|
||||
/*
|
||||
* ★ 이 아이템만 프롬프트가 다르다. 나머지는 지역을 리서치해 오는 것이지만
|
||||
* 소식은 **이 가게에서 지금 실제로 하는 일**이다 — 모델이 알 수 없고, 지어내면
|
||||
* 손님이 없는 행사를 보고 찾아온다. 그래서 "찾아라" 가 아니라 "옮겨 적어라" 다.
|
||||
*/
|
||||
/* 이 아이템만 프롬프트가 다르다. */
|
||||
task: `[해야 할 일]
|
||||
아래 붙여넣은 인스타그램 게시물·공지 글을 소식 JSON 으로 **옮겨 적는다.** 찾지 말고 옮긴다.
|
||||
|
||||
+18
-7
@@ -1,10 +1,21 @@
|
||||
/**
|
||||
* 배리에이션 와이어프레임 썸네일.
|
||||
*
|
||||
* 사장님은 "InfoTable" 이라는 이름으로 고르지 않는다 — 모양을 보고 고른다.
|
||||
* 그래서 배리에이션 카드에는 반드시 그림이 붙고, 그 그림은 여기 한 곳에서만 그린다.
|
||||
*/
|
||||
import type {ThumbKey} from './types';
|
||||
// 섹션 추가 목록의 와이어프레임 썸네일.
|
||||
export type ThumbKey =
|
||||
| 'fullbleed'
|
||||
| 'split'
|
||||
| 'stack'
|
||||
| 'centered'
|
||||
| 'grid'
|
||||
| 'masonry'
|
||||
| 'carousel'
|
||||
| 'list'
|
||||
| 'table'
|
||||
| 'cards'
|
||||
| 'accordion'
|
||||
| 'two-column'
|
||||
| 'banner'
|
||||
| 'form'
|
||||
| 'timeline'
|
||||
| 'compact';
|
||||
|
||||
const BOX = 'fill-stone-300';
|
||||
const LINE = 'fill-stone-200';
|
||||
@@ -1,224 +0,0 @@
|
||||
/**
|
||||
* 드래그 카로셀 — 마우스로 잡아끌어 넘기는 슬라이더.
|
||||
*
|
||||
* ★ 캔버스의 photos.carousel 은 `overflow-x-auto + snap` 이라 데스크톱 마우스로는 못 끈다
|
||||
* (트랙패드 스크롤만 먹는다). 쇼케이스는 커서로 끌어야 하므로 여기서 따로 만든다.
|
||||
*
|
||||
* ★ 애니메이션 라이브러리(motion)의 drag 를 쓰지 않는다.
|
||||
* 그쪽은 제스처 처리를 requestAnimationFrame 프레임 루프에 태우는데, **탭이 백그라운드면
|
||||
* rAF 가 멈춰서 드래그가 아예 동작하지 않는다.** 자동화 브라우저(hidden 탭)에서 검증이
|
||||
* 불가능해지는 것도 같은 이유다. 여기서는 pointermove 에서 transform 을 직접 쓰고,
|
||||
* 놓았을 때의 스냅만 CSS transition 에 맡긴다 — rAF 없이도 돈다.
|
||||
*/
|
||||
import {useCallback, useEffect, useRef, useState, type PointerEvent as ReactPointerEvent, type ReactNode} from 'react';
|
||||
import {ChevronLeft, ChevronRight} from 'lucide-react';
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
interface DragCarouselProps {
|
||||
slides: ReactNode[];
|
||||
index: number;
|
||||
onIndexChange: (next: number) => void;
|
||||
/** 아래 점 네비게이션. 슬라이드가 아주 많으면 끈다. */
|
||||
showDots?: boolean;
|
||||
label?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/** 이만큼 끌면 넘긴다(컨테이너 너비 대비). 너무 작으면 살짝 흔들려도 넘어간다. */
|
||||
const DRAG_RATIO = 0.2;
|
||||
/** 짧게 튕겨도 넘어가게 하는 속도 임계(px/ms). */
|
||||
const FLICK_VELOCITY = 0.5;
|
||||
/** 양 끝에서 더 끌 때의 저항. 1 이면 끝에서도 그냥 끌려서 경계가 안 느껴진다. */
|
||||
const EDGE_RESISTANCE = 0.35;
|
||||
const SNAP_MS = 320;
|
||||
|
||||
export function DragCarousel({
|
||||
slides,
|
||||
index,
|
||||
onIndexChange,
|
||||
showDots = true,
|
||||
label,
|
||||
className,
|
||||
}: DragCarouselProps) {
|
||||
const viewportRef = useRef<HTMLDivElement>(null);
|
||||
const trackRef = useRef<HTMLDivElement>(null);
|
||||
const [width, setWidth] = useState(0);
|
||||
const [dragging, setDragging] = useState(false);
|
||||
const drag = useRef({startX: 0, startTime: 0, dx: 0, active: false});
|
||||
const count = slides.length;
|
||||
|
||||
// 너비는 창 크기·패널 접힘에 따라 바뀐다 — 측정값을 붙들고 있으면 슬라이드가 어긋난다.
|
||||
useEffect(() => {
|
||||
const el = viewportRef.current;
|
||||
if (!el) return;
|
||||
const ro = new ResizeObserver((entries) => {
|
||||
const w = entries[0]?.contentRect.width;
|
||||
if (typeof w === 'number') setWidth(w);
|
||||
});
|
||||
ro.observe(el);
|
||||
setWidth(el.getBoundingClientRect().width);
|
||||
return () => ro.disconnect();
|
||||
}, []);
|
||||
|
||||
/** 트랙 위치를 직접 쓴다. 드래그 중에는 transition 을 꺼야 손가락을 따라온다. */
|
||||
const paint = useCallback((offsetPx: number, animated: boolean) => {
|
||||
const track = trackRef.current;
|
||||
if (!track) return;
|
||||
track.style.transition = animated ? `transform ${SNAP_MS}ms cubic-bezier(0.22, 1, 0.36, 1)` : 'none';
|
||||
track.style.transform = `translate3d(${offsetPx}px, 0, 0)`;
|
||||
}, []);
|
||||
|
||||
// index / width 가 바뀌면(바깥 목록 클릭 포함) 제자리로 스냅.
|
||||
useEffect(() => {
|
||||
paint(-index * width, true);
|
||||
}, [index, width, paint]);
|
||||
|
||||
const settle = useCallback(
|
||||
(next: number) => {
|
||||
const clamped = Math.max(0, Math.min(count - 1, next));
|
||||
// ★ 클램프돼서 index 가 그대로면 부모가 리렌더되지 않는다 —
|
||||
// 그러면 끌어당긴 자리에 트랙이 멈춰 버리므로 여기서 직접 되돌린다.
|
||||
paint(-clamped * width, true);
|
||||
if (clamped !== index) onIndexChange(clamped);
|
||||
},
|
||||
[count, index, onIndexChange, paint, width],
|
||||
);
|
||||
|
||||
const onPointerDown = (e: ReactPointerEvent<HTMLDivElement>) => {
|
||||
if (count < 2 || e.button !== 0) return;
|
||||
drag.current = {startX: e.clientX, startTime: e.timeStamp, dx: 0, active: true};
|
||||
setDragging(true);
|
||||
e.currentTarget.setPointerCapture(e.pointerId);
|
||||
};
|
||||
|
||||
const onPointerMove = (e: ReactPointerEvent<HTMLDivElement>) => {
|
||||
if (!drag.current.active) return;
|
||||
let dx = e.clientX - drag.current.startX;
|
||||
// 양 끝을 넘어가면 저항을 준다 — 끝이라는 게 손에 느껴져야 한다.
|
||||
const atStart = index === 0 && dx > 0;
|
||||
const atEnd = index === count - 1 && dx < 0;
|
||||
if (atStart || atEnd) dx *= EDGE_RESISTANCE;
|
||||
drag.current.dx = dx;
|
||||
paint(-index * width + dx, false);
|
||||
};
|
||||
|
||||
const endDrag = (e: ReactPointerEvent<HTMLDivElement>) => {
|
||||
if (!drag.current.active) return;
|
||||
const {dx, startTime} = drag.current;
|
||||
drag.current.active = false;
|
||||
setDragging(false);
|
||||
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
||||
e.currentTarget.releasePointerCapture(e.pointerId);
|
||||
}
|
||||
|
||||
const elapsed = Math.max(1, e.timeStamp - startTime);
|
||||
const velocity = dx / elapsed; // px/ms
|
||||
const threshold = width * DRAG_RATIO;
|
||||
|
||||
if (dx < -threshold || velocity < -FLICK_VELOCITY) settle(index + 1);
|
||||
else if (dx > threshold || velocity > FLICK_VELOCITY) settle(index - 1);
|
||||
else settle(index);
|
||||
};
|
||||
|
||||
if (count === 0) return null;
|
||||
|
||||
return (
|
||||
<div className={cn('flex flex-col gap-3', className)}>
|
||||
<div
|
||||
ref={viewportRef}
|
||||
className="relative overflow-hidden"
|
||||
role="group"
|
||||
aria-roledescription="carousel"
|
||||
aria-label={label}
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'ArrowRight') settle(index + 1);
|
||||
if (e.key === 'ArrowLeft') settle(index - 1);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
ref={trackRef}
|
||||
onPointerDown={onPointerDown}
|
||||
onPointerMove={onPointerMove}
|
||||
onPointerUp={endDrag}
|
||||
onPointerCancel={endDrag}
|
||||
className={cn(
|
||||
'flex touch-pan-y',
|
||||
count > 1 && (dragging ? 'cursor-grabbing' : 'cursor-grab'),
|
||||
)}
|
||||
>
|
||||
{slides.map((slide, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="shrink-0 grow-0"
|
||||
style={{width: width || '100%'}}
|
||||
aria-hidden={i !== index}
|
||||
>
|
||||
{/* 드래그 중 내부 이미지가 잡히면 브라우저 기본 이미지 드래그와 싸운다. */}
|
||||
<div className={cn('[&_img]:select-none', dragging && 'select-none [&_*]:pointer-events-none')}>
|
||||
{slide}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{count > 1 && (
|
||||
<>
|
||||
<CarouselArrow side="left" disabled={index === 0} onClick={() => settle(index - 1)} />
|
||||
<CarouselArrow
|
||||
side="right"
|
||||
disabled={index === count - 1}
|
||||
onClick={() => settle(index + 1)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{showDots && count > 1 && (
|
||||
<div className="flex items-center justify-center gap-1.5">
|
||||
{slides.map((_, i) => (
|
||||
<button
|
||||
key={i}
|
||||
type="button"
|
||||
aria-label={`${i + 1}번째로 이동`}
|
||||
aria-current={i === index}
|
||||
onClick={() => settle(i)}
|
||||
className={cn(
|
||||
'h-1.5 cursor-pointer rounded-full transition-all',
|
||||
i === index ? 'w-5 bg-foreground' : 'w-1.5 bg-border hover:bg-muted-foreground',
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CarouselArrow({
|
||||
side,
|
||||
disabled,
|
||||
onClick,
|
||||
}: {
|
||||
side: 'left' | 'right';
|
||||
disabled: boolean;
|
||||
onClick: () => void;
|
||||
}) {
|
||||
const Icon = side === 'left' ? ChevronLeft : ChevronRight;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
aria-label={side === 'left' ? '이전' : '다음'}
|
||||
className={cn(
|
||||
'absolute top-1/2 z-20 -translate-y-1/2 rounded-full border border-border bg-card/90 p-1.5 shadow-sm backdrop-blur-sm transition',
|
||||
'disabled:pointer-events-none disabled:opacity-0',
|
||||
'cursor-pointer hover:bg-card',
|
||||
side === 'left' ? 'left-2' : 'right-2',
|
||||
)}
|
||||
>
|
||||
<Icon className="size-4" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* 쇼케이스용 목업 props — 배리에이션 하나를 스토어 없이 그리기 위한 최소 입력.
|
||||
*
|
||||
* 캔버스(CanvasView)는 빌더 스토어에서 props 를 모으지만, 쇼케이스는 스토어를 건드리면 안 된다 —
|
||||
* 개발자가 색을 구경하다가 사장님이 편집 중이던 사이트 상태를 바꿔 버리면 곤란하다.
|
||||
* 그래서 여기서 업종 기본 데이터로 같은 모양의 props 를 직접 만든다.
|
||||
*/
|
||||
import type {IndustryType, SectionItem, TemplateItem} from '@o2o/shared';
|
||||
import {INDUSTRY_CONFIGS} from '@/data/industryData';
|
||||
import {dataSpecFor} from '@/features/builder/canvas/dataSpec';
|
||||
import type {SectionRenderProps} from '@/features/builder/canvas/types';
|
||||
import type {SectionVariant} from '@/features/builder/canvas/types';
|
||||
import {asTemplate, type TokenGroup} from './tokenGroups';
|
||||
|
||||
/** 업종의 첫 템플릿 — 토큰 그룹이 색만 갈아끼울 바탕이 된다. */
|
||||
export function baseTemplate(industry: IndustryType): TemplateItem {
|
||||
return INDUSTRY_CONFIGS[industry].templates[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 섹션 메타를 만든다.
|
||||
*
|
||||
* 업종 기본 섹션 목록에 같은 타입이 있으면 그걸 쓴다(이름·잠금 상태가 실제와 같아진다).
|
||||
* 없으면 최소 형태로 지어낸다 — 그 업종 메뉴엔 없지만 배리에이션은 존재하는 경우다.
|
||||
*/
|
||||
function sectionFor(sectionType: string, industry: IndustryType, variantId: string): SectionItem {
|
||||
// 붙여넣기 아이템은 JSON 이 없으면 "붙여넣으세요" 안내만 뜬다 — 디자인을 보러 온 화면에선 예시를 얹는다.
|
||||
const sample = dataSpecFor(sectionType)?.sample;
|
||||
const found = INDUSTRY_CONFIGS[industry].sections.find((s) => s.type === sectionType);
|
||||
if (found) return {...found, isEnabled: true, variantId, ...(sample ? {data: sample} : {})};
|
||||
return {
|
||||
id: sectionType,
|
||||
type: sectionType,
|
||||
name: sectionType,
|
||||
isLocked: false,
|
||||
isEnabled: true,
|
||||
variantId,
|
||||
...(sample ? {data: sample} : {}),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 쇼케이스 전용 자리표시 값.
|
||||
*
|
||||
* ★ 실제 업소처럼 보이는 값을 쓰지 않는다. 예전에는 업종 시드('달빛스테이 제주',
|
||||
* '포레스트 힐 로스터스')를 그대로 썼는데, 그 값들이 캔버스 배리에이션에도
|
||||
* 폴백으로 새어 사장님 화면에 남의 가게가 떴다. 그래서 시드에서 콘텐츠를 걷어냈고,
|
||||
* 쇼케이스는 한눈에 가짜인 값을 **여기서만** 들고 간다 — 이 파일은 DEV 라우트
|
||||
* (`/dev/showcase`, app/router.tsx)에서만 로드된다.
|
||||
*/
|
||||
const SHOWCASE_VALUES = {
|
||||
storeName: '샘플 상호',
|
||||
location: '샘플 지역',
|
||||
infoFields: [],
|
||||
photos: [],
|
||||
};
|
||||
|
||||
/** 배리에이션 하나를 그릴 props 한 벌. */
|
||||
export function mockPropsFor(
|
||||
sectionType: string,
|
||||
variant: SectionVariant,
|
||||
industry: IndustryType,
|
||||
group: TokenGroup,
|
||||
): SectionRenderProps {
|
||||
return {
|
||||
section: sectionFor(sectionType, industry, variant.id),
|
||||
industryId: industry,
|
||||
...SHOWCASE_VALUES,
|
||||
template: asTemplate(group, baseTemplate(industry)),
|
||||
// 쇼케이스는 "고르는" 화면이 아니다 — 선택 링·배지가 뜨면 디자인을 가린다.
|
||||
isSelected: false,
|
||||
onSelect: () => {},
|
||||
};
|
||||
}
|
||||
@@ -1,340 +0,0 @@
|
||||
/**
|
||||
* 디자인 토큰 그룹 — "색·모서리 한 세트"를 이름 붙여 저장하고 통째로 갈아끼운다.
|
||||
*
|
||||
* 배리에이션 레지스트리가 "레이아웃의 단일 출처"라면, 여기는 "색의 단일 출처"다.
|
||||
* 쇼케이스에서 그룹을 바꾸면 가운데 미리보기 전체가 그 그룹으로 다시 그려진다.
|
||||
*
|
||||
* ★ 내장 그룹은 업종 템플릿(INDUSTRY_CONFIGS[*].templates)에서 그대로 끌어온다 —
|
||||
* 쇼케이스용으로 색을 따로 적어두면 실제 템플릿과 갈라져서, 여기서 예뻐도 캔버스에선 다르다.
|
||||
*/
|
||||
import type {IndustryType, TemplateItem} from '@o2o/shared';
|
||||
import {INDUSTRY_CONFIGS} from '@/data/industryData';
|
||||
import {derivePalette} from './palette';
|
||||
|
||||
export type TokenColors = TemplateItem['colors'];
|
||||
|
||||
/**
|
||||
* 면(surface) 토큰 — **화면 면적의 대부분**을 차지하는 색이다.
|
||||
*
|
||||
* ★ 색 6개(TemplateItem.colors)만으로는 팔레트를 바꿔도 인상이 안 바뀐다.
|
||||
* 섹션 바탕과 카드 면이 하드코딩돼 있었기 때문이다. 그걸 여기로 끌어냈다.
|
||||
* `white` 톤은 일부러 진짜 흰색으로 남긴다 — surface/surfaceAlt 와 함께 세 단계가 있어야
|
||||
* 섹션이 서로 구분되는 리듬이 생긴다.
|
||||
*/
|
||||
export interface TokenSurfaces {
|
||||
/** 섹션 기본 바탕(paper 톤). */
|
||||
surface: string;
|
||||
/** 섹션 대체 바탕(tint 톤) — 위아래 섹션과 다르게 보이게 하는 색. */
|
||||
surfaceAlt: string;
|
||||
/** 어두운 섹션(dark 톤). 흰 글씨를 얹는다. */
|
||||
inverse: string;
|
||||
/** 카드·표 테두리. */
|
||||
border: string;
|
||||
}
|
||||
|
||||
export interface TokenFonts {
|
||||
heading: string;
|
||||
body: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 고를 수 있는 서체.
|
||||
*
|
||||
* ★ 새 폰트를 내려받지 않는다 — 전부 이미 있는 것(Pretendard self-host)이나
|
||||
* OS 기본 폰트로만 스택을 짠다. 미리보기 하나 때문에 네트워크를 타면 안 된다.
|
||||
*/
|
||||
export const FONT_PRESETS: {id: string; label: string; stack: string}[] = [
|
||||
{id: 'sans', label: '고딕', stack: "'Pretendard Variable', 'Noto Sans KR', system-ui, sans-serif"},
|
||||
{id: 'serif', label: '명조', stack: "'Noto Serif KR', 'Batang', 'Times New Roman', serif"},
|
||||
{id: 'system', label: '시스템', stack: "system-ui, -apple-system, 'Apple SD Gothic Neo', sans-serif"},
|
||||
{id: 'mono', label: '모노', stack: "'JetBrains Mono', Consolas, ui-monospace, monospace"},
|
||||
];
|
||||
|
||||
const FONT_SANS = FONT_PRESETS[0].stack;
|
||||
const FONT_SERIF = FONT_PRESETS[1].stack;
|
||||
|
||||
/** 스택 문자열 → 프리셋 id(고르는 UI 가 현재 값을 표시할 때 쓴다). */
|
||||
export function fontPresetId(stack: string): string {
|
||||
return FONT_PRESETS.find((f) => f.stack === stack)?.id ?? 'sans';
|
||||
}
|
||||
|
||||
export interface TokenGroup {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
colors: TokenColors;
|
||||
/** 모서리 반경(px). --tpl-radius 로 내려간다. */
|
||||
radius: number;
|
||||
/** 제목·본문 서체. CSS font-family 스택을 그대로 담는다(--tpl-font-* 로 내려간다). */
|
||||
fonts: TokenFonts;
|
||||
/** 섹션 바탕·카드 면·테두리. 팔레트 인상을 좌우하는 쪽은 사실 이쪽이다. */
|
||||
surfaces: TokenSurfaces;
|
||||
/** 내장 그룹은 수정·삭제 대신 "복제해서 편집" 만 된다. */
|
||||
builtin?: boolean;
|
||||
}
|
||||
|
||||
export const TOKEN_COLOR_KEYS: {key: keyof TokenColors; label: string; hint: string}[] = [
|
||||
{key: 'primary', label: 'Primary', hint: '예약·문의 버튼처럼 누르게 만드는 색'},
|
||||
{key: 'secondary', label: 'Secondary', hint: '본문 보조 텍스트'},
|
||||
{key: 'bg', label: 'Background', hint: '페이지 바탕'},
|
||||
{key: 'card', label: 'Card', hint: '카드·패널 바탕'},
|
||||
{key: 'text', label: 'Text', hint: '제목·본문 기본색'},
|
||||
{key: 'accent', label: 'Accent', hint: '배지·강조 포인트'},
|
||||
];
|
||||
|
||||
const STORAGE_KEY = 'o2o.dev.tokenGroups';
|
||||
|
||||
/**
|
||||
* colorhunt 인기 팔레트에서 고른 것들.
|
||||
*
|
||||
* ★ 아무 팔레트나 쓰면 안 된다 — 웹사이트로 쓰려면 최소 조건이 있다:
|
||||
* ① 아주 밝은 색(바탕용) ② 흰 글씨를 얹을 수 있는 어두운 색(버튼·제목용)
|
||||
* ③ 채도 있는 포인트 색. 파스텔만 있는 팔레트는 글자가 안 읽힌다.
|
||||
* 여기 있는 건 그 조건으로 걸러낸 것들이다.
|
||||
*/
|
||||
const COLORHUNT_PALETTES: {name: string; hexes: string[]}[] = [
|
||||
{name: '네이비 & 샌드', hexes: ['#222831', '#393e46', '#948979', '#dfd0b8']},
|
||||
{name: '블루 그라데이션', hexes: ['#e3f2fd', '#90caf9', '#2196f3', '#0d47a1']},
|
||||
{name: '바다와 모래', hexes: ['#3368a0', '#66a3bf', '#c8dfdb', '#f2efe7']},
|
||||
{name: '포레스트 크림', hexes: ['#1d4533', '#f7eae0', '#f9d2ba', '#5e3122']},
|
||||
{name: '크림 & 체리', hexes: ['#fff7eb', '#f9f0e0', '#a2ab73', '#cc3a63']},
|
||||
{name: '모카 & 오렌지', hexes: ['#524646', '#a8a492', '#fcf2e5', '#ec5b38']},
|
||||
{name: '선셋 테라코타', hexes: ['#fef2a0', '#f3cd97', '#e98b50', '#bc4f4f']},
|
||||
{name: '틸 & 앰버', hexes: ['#007979', '#24b1b1', '#ffe2af', '#e37434']},
|
||||
{name: '차콜 플럼', hexes: ['#2c2c2c', '#853953', '#612d53', '#f3f4f4']},
|
||||
{name: '네이비 골드', hexes: ['#133458', '#838921', '#d99b21', '#faf7bb']},
|
||||
{name: '올리브 & 오렌지', hexes: ['#2e2910', '#2c5745', '#ebe3a7', '#eb7d00']},
|
||||
];
|
||||
|
||||
/** colorhunt 팔레트 → 내장 토큰 그룹. 유도 규칙은 붙여넣기와 완전히 같다(palette.ts). */
|
||||
function paletteGroups(): TokenGroup[] {
|
||||
return COLORHUNT_PALETTES.flatMap(({name, hexes}) => {
|
||||
const d = derivePalette(hexes);
|
||||
if (!d) return [];
|
||||
return [
|
||||
{
|
||||
id: `builtin:palette:${name}`,
|
||||
name: `팔레트 · ${name}`,
|
||||
description: hexes.join(' '),
|
||||
colors: {
|
||||
primary: d.primary,
|
||||
secondary: d.secondary,
|
||||
bg: d.bg,
|
||||
card: d.card,
|
||||
text: d.text,
|
||||
accent: d.accent,
|
||||
},
|
||||
radius: 8,
|
||||
fonts: {heading: FONT_SANS, body: FONT_SANS},
|
||||
surfaces: {
|
||||
surface: d.surface,
|
||||
surfaceAlt: d.surfaceAlt,
|
||||
inverse: d.inverse,
|
||||
border: d.border,
|
||||
},
|
||||
builtin: true,
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/** 업종 템플릿에서 뽑아낸 내장 그룹. 실제 서비스가 쓰는 색 그대로다. */
|
||||
export function builtinGroups(): TokenGroup[] {
|
||||
const out: TokenGroup[] = [];
|
||||
(Object.keys(INDUSTRY_CONFIGS) as IndustryType[]).forEach((industry) => {
|
||||
INDUSTRY_CONFIGS[industry].templates.forEach((t) => {
|
||||
out.push({
|
||||
id: `builtin:${industry}:${t.id}`,
|
||||
name: `${INDUSTRY_CONFIGS[industry].name} · ${t.name}`,
|
||||
description: t.description,
|
||||
colors: {...t.colors},
|
||||
radius: 8,
|
||||
// 사진 중심 템플릿은 제목을 명조로 — 기존 캔버스의 serif-title 과 같은 인상이다.
|
||||
fonts: {heading: t.tone === 'photo' ? FONT_SERIF : FONT_SANS, body: FONT_SANS},
|
||||
// 템플릿이 이미 갖고 있던 bg·card 를 섹션 바탕으로 쓴다 —
|
||||
// 그래야 템플릿을 바꿀 때 버튼 색만이 아니라 화면 전체가 바뀐다.
|
||||
surfaces: {
|
||||
surface: t.colors.bg,
|
||||
surfaceAlt: t.colors.card,
|
||||
inverse: '#1c1917',
|
||||
border: t.colors.secondary,
|
||||
},
|
||||
builtin: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
// ★ 팔레트를 앞에 둔다 — 색을 고르러 온 사람이 제일 먼저 보는 게 팔레트여야 한다.
|
||||
return [...paletteGroups(), ...out];
|
||||
}
|
||||
|
||||
/** 저장해 둔 커스텀 그룹. 깨진 값이 들어 있으면 조용히 버린다 — 개발 도구가 흰 화면이 되면 안 된다. */
|
||||
export function loadCustomGroups(): TokenGroup[] {
|
||||
try {
|
||||
const raw = localStorage.getItem(STORAGE_KEY);
|
||||
if (!raw) return [];
|
||||
const parsed: unknown = JSON.parse(raw);
|
||||
if (!Array.isArray(parsed)) return [];
|
||||
// ★ 폰트가 없던 시절에 저장된 그룹이 있다 — 없으면 기본값으로 채운다(그 항목만 버리면 사용자 작업이 날아간다).
|
||||
return parsed.filter(isTokenGroup).map((g) => ({
|
||||
...g,
|
||||
radius: typeof g.radius === 'number' ? g.radius : 8,
|
||||
fonts: {
|
||||
heading: g.fonts?.heading || FONT_SANS,
|
||||
body: g.fonts?.body || FONT_SANS,
|
||||
},
|
||||
surfaces: {
|
||||
surface: g.surfaces?.surface || g.colors.bg,
|
||||
surfaceAlt: g.surfaces?.surfaceAlt || g.colors.card,
|
||||
inverse: g.surfaces?.inverse || '#1c1917',
|
||||
border: g.surfaces?.border || g.colors.secondary,
|
||||
},
|
||||
builtin: false,
|
||||
}));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function isTokenGroup(value: unknown): value is TokenGroup {
|
||||
if (!value || typeof value !== 'object') return false;
|
||||
const g = value as Partial<TokenGroup>;
|
||||
if (typeof g.id !== 'string' || typeof g.name !== 'string') return false;
|
||||
if (!g.colors || typeof g.colors !== 'object') return false;
|
||||
return TOKEN_COLOR_KEYS.every(({key}) => typeof g.colors?.[key] === 'string');
|
||||
}
|
||||
|
||||
function persist(groups: TokenGroup[]) {
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(groups));
|
||||
} catch {
|
||||
// 저장 실패(시크릿 모드·용량 초과)해도 화면은 계속 돈다.
|
||||
}
|
||||
}
|
||||
|
||||
/** 저장(같은 id 면 덮어쓴다). 저장 후 전체 커스텀 목록을 돌려준다. */
|
||||
export function saveCustomGroup(group: TokenGroup): TokenGroup[] {
|
||||
const next = loadCustomGroups().filter((g) => g.id !== group.id);
|
||||
next.push({...group, builtin: false});
|
||||
persist(next);
|
||||
return next;
|
||||
}
|
||||
|
||||
export function deleteCustomGroup(id: string): TokenGroup[] {
|
||||
const next = loadCustomGroups().filter((g) => g.id !== id);
|
||||
persist(next);
|
||||
return next;
|
||||
}
|
||||
|
||||
/** 편집 시작점. 내장 그룹을 고른 채로 색을 만지면 이 함수로 복제본을 만든다. */
|
||||
export function duplicateGroup(source: TokenGroup, name: string): TokenGroup {
|
||||
return {
|
||||
id: `custom:${Date.now().toString(36)}`,
|
||||
name,
|
||||
description: `${source.name} 에서 복제`,
|
||||
colors: {...source.colors},
|
||||
radius: source.radius,
|
||||
fonts: {...source.fonts},
|
||||
surfaces: {...source.surfaces},
|
||||
builtin: false,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 내장 그룹을 만지는 순간 자동으로 생기는 편집본.
|
||||
*
|
||||
* ★ id 를 원본에서 결정론적으로 만든다 — 색상 피커는 드래그하는 동안 onChange 가
|
||||
* 연달아 터지는데, 매번 새 id 를 뽑으면 복사본이 수십 개 쌓인다.
|
||||
* 같은 내장 그룹을 다시 편집하면 같은 편집본을 이어서 고치게 된다.
|
||||
*/
|
||||
export function autoForkOf(source: TokenGroup): TokenGroup {
|
||||
return {
|
||||
id: `custom:edit:${source.id}`,
|
||||
name: `${source.name} 편집본`,
|
||||
description: `${source.name} 를 편집한 사본`,
|
||||
colors: {...source.colors},
|
||||
radius: source.radius,
|
||||
fonts: {...source.fonts},
|
||||
surfaces: {...source.surfaces},
|
||||
builtin: false,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 토큰 그룹을 캔버스가 읽는 모양(TemplateItem)으로 바꾼다.
|
||||
*
|
||||
* 배리에이션들은 `template.colors` 로 색을 읽으므로, 그룹을 통째로 갈아끼우려면
|
||||
* 새 TemplateItem 을 만들어 props 로 내려보내는 게 유일한 경로다.
|
||||
*/
|
||||
export function asTemplate(group: TokenGroup, base: TemplateItem): TemplateItem {
|
||||
return {...base, colors: {...group.colors}};
|
||||
}
|
||||
|
||||
/** 미리보기 프레임에 씌울 CSS 변수. 캔버스(CanvasView)와 같은 --tpl-* 이름을 쓴다. */
|
||||
export function tokenCssVars(group: TokenGroup): Record<string, string> {
|
||||
return {
|
||||
'--tpl-primary': group.colors.primary,
|
||||
'--tpl-secondary': group.colors.secondary,
|
||||
'--tpl-bg': group.colors.bg,
|
||||
'--tpl-card': group.colors.card,
|
||||
'--tpl-text': group.colors.text,
|
||||
'--tpl-accent': group.colors.accent,
|
||||
'--tpl-radius': `${group.radius}px`,
|
||||
'--tpl-font-heading': group.fonts.heading,
|
||||
'--tpl-font-body': group.fonts.body,
|
||||
'--tpl-surface': group.surfaces.surface,
|
||||
'--tpl-surface-alt': group.surfaces.surfaceAlt,
|
||||
'--tpl-inverse': group.surfaces.inverse,
|
||||
'--tpl-border': group.surfaces.border,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* `template.colors` 를 실제로 읽는 배리에이션 목록.
|
||||
*
|
||||
* ★ 나머지는 stone-* 나 #hex 로 색을 박아 두어서 **토큰 그룹을 바꿔도 안 변한다.**
|
||||
* 쇼케이스가 이걸 배지로 표시해서, 토큰을 바꿨는데 화면이 그대로인 걸
|
||||
* "버그" 로 오해하지 않게 한다.
|
||||
*
|
||||
* 목록 갱신:
|
||||
* grep -rln "template.colors" src/features/builder/canvas/variants
|
||||
*/
|
||||
export const TOKEN_AWARE_VARIANT_IDS = new Set([
|
||||
'hero.editorial',
|
||||
'hero.split',
|
||||
'hero.full-bleed',
|
||||
'hero.type-only',
|
||||
'intro.story',
|
||||
'intro.centered',
|
||||
'intro.side-by-side',
|
||||
'info.table',
|
||||
'info.cards',
|
||||
'info.inline',
|
||||
'photos.grid',
|
||||
'photos.masonry',
|
||||
'photos.carousel',
|
||||
'photos.with-videos',
|
||||
'map.detailed',
|
||||
'map.compact',
|
||||
'local.guide',
|
||||
'faq.accordion',
|
||||
'faq.open-list',
|
||||
'faq.two-column',
|
||||
'rooms.carousel',
|
||||
'rooms.grid',
|
||||
'rooms.list',
|
||||
'rules.list',
|
||||
'rules.cards',
|
||||
'booking.card',
|
||||
'booking.banner',
|
||||
'menu.list',
|
||||
'menu.grid',
|
||||
'menu.price-table',
|
||||
'space.zones',
|
||||
'space.list',
|
||||
'inquiry.cta',
|
||||
'inquiry.form',
|
||||
'programs.cards',
|
||||
'programs.table',
|
||||
'exhibition.gallery',
|
||||
'exhibition.notice',
|
||||
]);
|
||||
@@ -12,12 +12,7 @@ import {WizardFooter} from './WizardFooter';
|
||||
import {WizardSteps} from './WizardSteps';
|
||||
|
||||
|
||||
/**
|
||||
* 템플릿 미리보기 — 그 템플릿의 서체·모서리·테두리·그림자로 **실제로** 그린다.
|
||||
*
|
||||
* ★ 예전에는 회색 막대 세 줄과 색 동그라미였다. 다섯 템플릿이 전부 같은 그림이라
|
||||
* 무엇을 고르는지 알 수 없었고, 그래서 아무거나 골랐다.
|
||||
*/
|
||||
/** 템플릿 미리보기 — 그 템플릿의 서체·모서리·테두리·그림자로 **실제로** 그린다. */
|
||||
function TemplatePreview({template}: {template: TemplateItem}) {
|
||||
const {look, colors} = template;
|
||||
|
||||
@@ -51,7 +46,7 @@ function TemplatePreview({template}: {template: TemplateItem}) {
|
||||
className="mt-1.5 text-[10px] leading-relaxed"
|
||||
style={{fontFamily: look.fontBody, color: colors.secondary}}
|
||||
>
|
||||
제목은 {template.fontStyle}, 본문은 이 서체로 나갑니다.
|
||||
제목과 본문이 이 서체로 나갑니다.
|
||||
</p>
|
||||
|
||||
<div
|
||||
@@ -116,12 +111,7 @@ export function Step4Template() {
|
||||
|
||||
const config = INDUSTRY_CONFIGS[industry];
|
||||
|
||||
/**
|
||||
* 고른 순간 서버에도 남긴다.
|
||||
*
|
||||
* ★ 화면 상태로만 두면 발행 잡이 읽을 곳이 없어 업종 기본 템플릿으로 굽는다 —
|
||||
* 사장님이 고른 디자인과 실제 발행본이 갈린다. 저장은 화면을 기다리게 하지 않는다.
|
||||
*/
|
||||
/** 고른 순간 서버에도 남긴다. */
|
||||
const chooseTemplate = (id: string) => {
|
||||
selectTemplate(id);
|
||||
queueSiteTemplateSave(placeId, id);
|
||||
@@ -141,6 +131,9 @@ export function Step4Template() {
|
||||
{config.name}에 맞춘 템플릿입니다. 색상과 서체는 에디터에서 언제든 바꿀 수 있고,
|
||||
어떤 템플릿을 골라도 구조화 데이터와 필수 섹션은 동일하게 들어갑니다.
|
||||
</p>
|
||||
<p className="mx-auto mt-1 max-w-lg text-xs text-muted-foreground">
|
||||
템플릿을 바꾸면 이전 템플릿이 켜 둔 섹션이 꺼질 수 있습니다. 내용은 지워지지 않습니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-5 lg:grid-cols-3">
|
||||
@@ -164,7 +157,7 @@ export function Step4Template() {
|
||||
<div>
|
||||
<h2 className="text-base font-bold">{template.name}</h2>
|
||||
<span className="text-xs font-medium text-muted-foreground">
|
||||
{template.toneLabel} · {template.fontStyle}
|
||||
{template.tag}
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
|
||||
@@ -3,81 +3,27 @@ import {ApiError} from '@/api';
|
||||
import {notifyApiError} from '@/lib/notify';
|
||||
import {callSiteApi, type ResultEnvelope} from './siteApi';
|
||||
|
||||
/**
|
||||
* 에디터 [디자인] 탭의 결과를 서버에 저장한다(POST /v1/place/{id}/site/theme).
|
||||
*
|
||||
* ★ 왜 필요한가
|
||||
* 사장님이 에디터에서 바꿀 수 있는 디자인은 여섯 가지다 — 섹션 on/off · 섹션 순서 ·
|
||||
* 섹션별 배리에이션 · 색 · 서체 · 템플릿. 이 중 저장되는 자리가 있던 건 templateId 하나뿐이었고,
|
||||
* 나머지 다섯은 zustand 메모리에만 있다가 **새로고침 한 번에 사라졌다.**
|
||||
* 발행 잡(backend services/site_payload)도 읽을 곳이 없어 업종 기본 표(_DEFAULT_THEME)로 구웠고,
|
||||
* 그 표는 `enabled` 를 항상 True 로 박아 넣었다 — 사장님이 섹션을 꺼도 발행본에는 그대로 나왔다.
|
||||
* "미리보기"가 미리보기가 아니었던 자리가 여기다.
|
||||
*
|
||||
* ★ 서버는 이 값을 해석하지 않는다.
|
||||
* 섹션 목록·배리에이션 키·색 팔레트는 전부 프론트(레지스트리·프리셋)가 소유한다.
|
||||
* 서버가 화이트리스트를 들면 프론트에 항목 하나 늘 때마다 백엔드를 같이 고쳐야 한다.
|
||||
* 모르는 값이 들어가도 발행 잡이 업종 기본으로 떨어뜨리므로 화면이 깨지지 않는다.
|
||||
*
|
||||
* ★ templateId 는 여기 넣지 않는다 — 이미 sites.template_id 라는 자기 자리가 있다
|
||||
* (siteTemplate.ts). 같은 값을 두 곳에 두면 어느 쪽이 진실인지 물어야 한다.
|
||||
*
|
||||
* ★ orval 을 쓰지 않는 이유는 siteApi.ts 참조.
|
||||
*/
|
||||
// [디자인] 탭 결과를 sites.theme에 저장한다.
|
||||
export interface SiteThemePayload {
|
||||
/**
|
||||
* 해석된 색. 발행 렌더러는 이 값만 보면 된다 — 팔레트 프리셋 목록을 몰라도 된다.
|
||||
*/
|
||||
colors: TemplateItem['colors'];
|
||||
fontStyle: string;
|
||||
/**
|
||||
* 사장님이 고른 색 팔레트 프리셋 id.
|
||||
*
|
||||
* ★ 해석된 colors 만 저장하면 에디터로 되돌릴 때 "어느 프리셋을 골랐었는지"를 잃는다.
|
||||
* 색값을 프리셋 목록과 역으로 대조해 맞추는 방법도 있지만, 두 프리셋의 색이 겹치거나
|
||||
* 프리셋 색이 나중에 한 톤 바뀌면 엉뚱한 칩이 선택된 것처럼 보인다.
|
||||
* 렌더러가 쓸 값(colors)과 에디터가 복원할 값(id)은 쓰임이 다르니 둘 다 싣는다.
|
||||
* 서버는 어느 쪽도 해석하지 않는다.
|
||||
*/
|
||||
// 에디터 복원 전용.
|
||||
colorPaletteId?: string | null;
|
||||
/**
|
||||
* 템플릿의 생김새(서체·모서리·테두리·그림자·여백).
|
||||
*
|
||||
* ★ 이걸 안 실으면 발행본은 색만 템플릿을 따르고 서체는 늘 같은 것으로 나간다 —
|
||||
* 사장님이 레트로를 골라도 발행 페이지만 고딕이었다. 서버는 해석하지 않고 보관만 한다.
|
||||
*/
|
||||
look?: TemplateLook;
|
||||
sections: {
|
||||
id: string;
|
||||
/**
|
||||
* 섹션 타입.
|
||||
*
|
||||
* ★ 예전엔 안 실었다 — 시드에 다 있으니 id 로 찾으면 됐다. [+ 섹션 추가] 가 생기면서
|
||||
* 시드에 없는 섹션이 저장되기 시작했고, type 이 없으면 복원 때 그게 뭐였는지 알 길이 없어
|
||||
* 통째로 버려진다(사장님이 채운 JSON 까지 같이).
|
||||
*/
|
||||
type?: string;
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
locked: boolean;
|
||||
variantId?: string;
|
||||
description?: string;
|
||||
body?: string;
|
||||
/** 붙여넣기 아이템의 원문 JSON. 서버는 이 값도 해석하지 않고 그대로 보관한다. */
|
||||
data?: string;
|
||||
}[];
|
||||
customInfoFields?: InfoField[];
|
||||
visiblePhotoIds?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 에디터 상태 → 저장 모양.
|
||||
*
|
||||
* ★ 배열 순서가 곧 섹션 순서다. 순서를 따로 필드로 두지 않는 이유는, 번호를 들고 다니면
|
||||
* 드래그 한 번에 전 항목의 번호를 다시 매겨야 하고 그러다 한 칸이 어긋나면 조용히 뒤집힌다.
|
||||
* ★ 화면 타입(SectionItem)의 isEnabled/isLocked 를 발행 계약(SectionSetting)의 enabled/locked 로
|
||||
* 여기서 한 번만 바꾼다 — 두 층의 이름이 다른 건 계약이 다르기 때문이고, 그 번역은 경계에 둔다.
|
||||
*/
|
||||
// 배열 순서가 곧 섹션 순서다.
|
||||
export function toThemePayload(
|
||||
template: TemplateItem,
|
||||
sections: SectionItem[],
|
||||
@@ -87,7 +33,6 @@ export function toThemePayload(
|
||||
): SiteThemePayload {
|
||||
return {
|
||||
colors: template.colors,
|
||||
fontStyle: template.fontStyle,
|
||||
look: template.look,
|
||||
colorPaletteId,
|
||||
sections: sections.map((s) => ({
|
||||
@@ -99,7 +44,6 @@ export function toThemePayload(
|
||||
...(s.description ? {description: s.description} : {}),
|
||||
...(s.body ? {body: s.body} : {}),
|
||||
...(s.data ? {data: s.data} : {}),
|
||||
...(s.variantId ? {variantId: s.variantId} : {}),
|
||||
})),
|
||||
customInfoFields: infoFields.filter((field) => field.id.startsWith('custom_')),
|
||||
visiblePhotoIds,
|
||||
@@ -113,20 +57,11 @@ export async function saveSiteTheme(placeId: string, theme: SiteThemePayload): P
|
||||
method: 'POST',
|
||||
body: JSON.stringify({theme}),
|
||||
});
|
||||
// ★ 거절도 200 으로 온다. 여기서 throw 하지 않으면 저장 안 된 디자인이 저장된 것처럼 넘어가고,
|
||||
// 사장님은 발행하고 나서야 자기 설정이 없어진 걸 안다.
|
||||
// 거절도 200 으로 온다.
|
||||
if (res.result?.success === false) throw new ApiError(200, 'SITE_THEME_REJECTED', res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 저장 대기줄 + 디바운스.
|
||||
*
|
||||
* ★ 디자인 편집은 연속으로 들어온다 — 드래그로 섹션을 옮기면 한 번에 여러 번,
|
||||
* 배리에이션은 "이 모양 저 모양" 눌러보며 여러 번. 매 조작마다 쏘면 서버를 두드리는 것도 문제지만,
|
||||
* 병렬로 나간 요청이 순서를 바꿔 도착하면 **마지막 선택이 옛 선택에 덮인다** — 화면은 새 디자인,
|
||||
* 서버는 옛 디자인이 되고 그 차이는 발행하고 나서야 드러난다.
|
||||
* 그래서 (1) 멈추면 마지막 것 하나만 보내고 (2) 보낸 것들은 순서대로 흘린다.
|
||||
*/
|
||||
/** 저장 대기줄 + 디바운스. */
|
||||
const THEME_SAVE_DEBOUNCE_MS = 600;
|
||||
|
||||
let saveChain: Promise<void> = Promise.resolve();
|
||||
@@ -134,14 +69,7 @@ let saveChain: Promise<void> = Promise.resolve();
|
||||
let saveSeq = 0;
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
/**
|
||||
* 저장이 **서버에 닿은 뒤** 알린다. 미리보기(iframe)가 이 신호를 듣고 다시 그린다.
|
||||
*
|
||||
* ★ 왜 스토어 구독이 아니라 여기인가 — 미리보기는 `GET /site/preview` 로 **서버에서**
|
||||
* payload 를 받는다. 스토어가 바뀐 순간 다시 그리면 아직 저장 전이라 옛 값을 받아 오고,
|
||||
* 화면은 "드래그해도 그대로" 가 된다. 저장 완료가 다시 그릴 수 있는 가장 이른 시점이다.
|
||||
* ★ 실패하면 알리지 않는다 — 서버가 옛 값이면 다시 그려 봐야 옛 그림이다.
|
||||
*/
|
||||
/** 저장이 **서버에 닿은 뒤** 알린다. */
|
||||
type ThemeSavedListener = () => void;
|
||||
const savedListeners = new Set<ThemeSavedListener>();
|
||||
|
||||
@@ -151,12 +79,7 @@ export function onSiteThemeSaved(listener: ThemeSavedListener): () => void {
|
||||
return () => savedListeners.delete(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 디자인 변경을 저장하되 **화면을 기다리게 하지 않는다.**
|
||||
*
|
||||
* 저장 실패가 편집을 막으면 안 된다 — 디자인은 주소와 달리 발행 뒤에도 바꿀 수 있는 값이라
|
||||
* 여기서 사장님을 세울 이유가 없다. 알리기만 한다.
|
||||
*/
|
||||
/** 디자인 변경을 저장하되 **화면을 기다리게 하지 않는다. */
|
||||
export function queueSiteThemeSave(placeId: string | null, theme: SiteThemePayload) {
|
||||
if (!placeId) return;
|
||||
if (timer) clearTimeout(timer);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '@/features/builder/canvas/primitives';
|
||||
import type {SectionRenderProps} from '@/features/builder/canvas/types';
|
||||
|
||||
export function SocialCanvasSection({section, isSelected, onSelect, template}: SectionRenderProps) {
|
||||
return <SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading variant="minimal" title="함께 발행한 소식" subtitle="승인해 Threads에 게재한 최신 소식이 홈페이지 맨 아래에 표시됩니다." colors={template.colors} />
|
||||
</SectionBody>
|
||||
</SectionFrame>;
|
||||
}
|
||||
Reference in new issue
Block a user