/** * 쇼케이스용 목업 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: () => {}, }; }