[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:
minaChoiandClaude Opus 5.5 committed 2026-09-28 15:57:35 +09:00
1 parent 46b74b310b
commit c6908629f3
183 files changed
+1824 -15243

No files matched your search

+11 -59
View File
@@ -1,68 +1,20 @@
import type {ReactNode} from 'react';
import type {SitePayload} from '@o2o/shared';
import {MobileTabBar, SiteFooter, SiteHeader} from '@site/sections';
import {templateOf, type SitePayload} from '@o2o/shared';
import {SiteProvider} from '@site/lib/site-context';
import {layoutOf} from '@site/lib/layout';
import {Shell as ReservationShell} from '@site/layouts/reservation/Shell';
import {Shell as OasiShell} from '@site/layouts/oasi/Shell';
import {Shell as StudioShell} from '@site/layouts/studio/Shell';
import {Shell as PastelShell} from '@site/layouts/pastel/Shell';
import {Shell as EditorialShell} from '@site/layouts/editorial/Shell';
import {Shell as PaperShell} from '@site/layouts/paper/Shell';
import {HomePage} from '@site/pages';
import {LayoutProvider} from '@site/lib/layout';
import {LAYOUTS} from '@site/layouts';
import {SectionList} from '@site/pages';
/**
* 발행 사이트 — **한 장짜리다.**
*
* ★ 왜 라우터를 쓰지 않나 (2026-08-31 결정)
* 소상공인 사이트는 원래 내용이 적다. 그걸 홈·객실·주변·오시는길·FAQ 로 쪼개면
* 페이지마다 얇아지고, 검색엔진은 그런 페이지를 색인에서 버린다("Crawled – currently
* not indexed"). 한 장에 모으면 알찬 페이지 하나가 된다.
* 덤으로 `basename` 을 맞추던 문제(SSR 은 /faq, 하이드레이션 후엔 /s/mmg/faq)가
* 통째로 사라진다 — 섹션 이동은 전부 앵커(#faq)다.
*
* 섹션 순서·표시 여부는 HomePage 가 theme.sections 로 정한다.
*/
export function App({payload}: {payload: SitePayload}) {
/*
* ★ 껍데기(상단·본문 폭·하단)를 템플릿이 정한다.
* 여기 한 벌로 두면 색만 다른 사이트가 나온다 — 안이 갈리려면 뼈대가 갈려야 한다.
*/
const layout = layoutOf(payload.theme.templateId);
const Shell =
layout === 'reservation'
? ReservationShell
: layout === 'oasi'
? OasiShell
: layout === 'studio'
? StudioShell
: layout === 'pastel'
? PastelShell
: layout === 'editorial'
? EditorialShell
: layout === 'paper'
? PaperShell
: DefaultShell;
const layout = LAYOUTS[templateOf(payload.theme.templateId).layout];
const {Frame} = layout;
return (
<SiteProvider payload={payload}>
<Shell>
<HomePage />
</Shell>
<LayoutProvider value={layout}>
<Frame>
<SectionList />
</Frame>
</LayoutProvider>
</SiteProvider>
);
}
/** 기본 껍데기 — 지금까지 발행된 사이트가 쓰는 그것. 건드리지 않는다. */
function DefaultShell({children}: {children: ReactNode}) {
return (
<div className="flex min-h-screen w-full flex-col">
<SiteHeader />
<div className="flex w-full flex-1 flex-col">{children}</div>
<SiteFooter />
<MobileTabBar />
</div>
);
}