[refactor] postgres-init,solution: DB 구조 재편 — 스키마 해체 · 공용 콘텐츠 한 벌 · 마이그레이션 체계
도메인별 스키마(company·place·fact·local·site·job)를 걷어내고 public 한 벌로 폈다.
스키마 한정자가 붙은 순간부터 ORM·raw SQL·테스트 픽스처가 각자 그 이름을 들고 다녀야 했다.
- 공용 콘텐츠를 한 테이블로 되돌린다. spots·region_stories 를 따로 파 놓고 보니
같은 성격이 세 곳으로 갈라져 있었다 — `area_contents` 가 처음부터 content_type 으로
종류를 가르는 설계였고 그걸 쓰면 됐다. 관계(거리·숨김)만 `place_area_refs` 로 남긴다.
- migrations/ + scripts/migrate.py: `init.sql` 은 **DB 를 처음 만들 때만** 돈다. 파일에
컬럼을 더해도 이미 데이터가 든 DB 에는 반영되지 않는다 — 실제로 TourAPI 가 주변 정보를
받아 와도 저장할 곳이 없어 축제·맛집이 0건이었고, 화면에는 "그냥 안 나오는 것" 으로만 보였다.
DECISIONS.md 가 예고한 그대로다("운영 DB 가 생기는 순간 다시 필요해진다").
Alembic 을 쓰지 않는 이유는 스키마 정의가 이미 두 곳(ORM·init.sql)이라 세 번째를
더하면 어긋날 자리가 하나 더 생기기 때문이다.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
7bbeb068a8
commit
64ce467f21
189 files changed
+13374
-5023
No files matched your search
@@ -18,8 +18,46 @@ export interface SectionDataSpec {
|
||||
task: string;
|
||||
/** 그 아이템에만 걸리는 금지·형식 규칙. */
|
||||
rules: string;
|
||||
/**
|
||||
* 직접 입력 폼의 칸.
|
||||
*
|
||||
* ★ 왜 필요한가: JSON 붙여넣기가 유일한 입구였다. 한 글자만 고치고 싶어도 사장님이
|
||||
* 중괄호와 쉼표를 헤집어야 했고, 쉼표 하나 잘못 지우면 섹션이 통째로 사라졌다.
|
||||
* ChatGPT 를 안 쓰는 사장님은 아예 못 채운다.
|
||||
* ★ 폼과 JSON 은 **한 값의 두 얼굴**이다 — 진실은 `section.data` 문자열 하나뿐이고
|
||||
* 폼은 그걸 비춘다. 그래서 JSON 을 붙여넣으면 폼이 따라 바뀌고, 폼을 고치면 JSON 이
|
||||
* 다시 쓰인다. 어느 쪽이 최신인지 물을 일이 없다.
|
||||
*/
|
||||
fields: ItemField[];
|
||||
/**
|
||||
* 항목 안의 목록(정거장 · 시간대 · 들르는 곳).
|
||||
*
|
||||
* ★ 이게 없으면 코스·스케줄은 폼으로 못 채운다 — 그 아이템의 알맹이가 전부 이 배열에 있다.
|
||||
*/
|
||||
child?: {key: string; label: string; fields: ItemField[]};
|
||||
}
|
||||
|
||||
export interface ItemField {
|
||||
/** 항목 객체의 키. `@o2o/shared` 의 아이템 타입에 있는 이름 그대로다. */
|
||||
key: string;
|
||||
label: string;
|
||||
/** text = 한 줄 · area = 여러 줄 · number = 숫자 · tags = 쉼표로 끊는 배열 · color = 색 */
|
||||
type?: 'text' | 'area' | 'number' | 'tags' | 'color';
|
||||
/** 칸 아래 회색 한 줄. 무엇을 적는 칸인지 애매할 때만 적는다. */
|
||||
hint?: string;
|
||||
/** 고르는 값이면 목록. 계절처럼 오탈자가 곧 버그가 되는 칸에 쓴다. */
|
||||
options?: string[];
|
||||
/** 두 칸씩 나란히 놓는다 — 짧은 값(연도·시각·분)이 한 줄을 다 먹지 않게. */
|
||||
half?: boolean;
|
||||
}
|
||||
|
||||
/** 모든 아이템이 공유하는 끝 두 칸 — 출처와 확신. */
|
||||
const SOURCE_FIELDS: ItemField[] = [
|
||||
{key: 'verified', label: '확신', type: 'text', options: ['확인', '확인필요'], half: true},
|
||||
{key: 'source.name', label: '출처 이름', type: 'text', half: true},
|
||||
{key: 'source.url', label: '출처 주소', type: 'text', hint: '실제로 열리는 공식·기관·언론 페이지'},
|
||||
];
|
||||
|
||||
// ★ 테마 전체 상한이 64KB 다(site_service._THEME_MAX_BYTES). 세 아이템이 각자 다 채우면 거절당하고,
|
||||
// 거절은 발행 직전에야 드러난다. 그래서 한 섹션당 여기서 먼저 끊는다.
|
||||
export const SECTION_DATA_MAX_CHARS = 12000;
|
||||
@@ -142,6 +180,18 @@ export const SECTION_DATA_SPEC: Record<string, SectionDataSpec> = {
|
||||
· lyrics 필드는 스키마에 없다. 어떤 이유로도 만들지 마라. 가사 한 소절도 안 된다.
|
||||
· labelColor 는 레코드 라벨 색이다. 곡의 분위기에 맞춰 진한 색 하나를 hex 로 고른다.
|
||||
· 작사·작곡·발표연도를 모르면 그 필드를 뺀다. "미상" 이라고 쓰지 않는다.`,
|
||||
fields: [
|
||||
{key: 'title', label: '곡 제목'},
|
||||
{key: 'artist', label: '가수', half: true},
|
||||
{key: 'year', label: '발표 연도', type: 'number', half: true},
|
||||
{key: 'lyricist', label: '작사', half: true},
|
||||
{key: 'composer', label: '작곡', half: true},
|
||||
{key: 'label', label: '음반사', half: true},
|
||||
{key: 'labelColor', label: '라벨 색', type: 'color', half: true},
|
||||
{key: 'story', label: '곡 이야기', type: 'area', hint: '가사는 옮기지 않습니다 — 배경만'},
|
||||
{key: 'connection', label: '우리 가게와의 연결', type: 'area'},
|
||||
...SOURCE_FIELDS,
|
||||
],
|
||||
},
|
||||
|
||||
daily: {
|
||||
@@ -203,102 +253,17 @@ export const SECTION_DATA_SPEC: Record<string, SectionDataSpec> = {
|
||||
· monthDay 는 MM-DD 다. 연도를 넣지 않는다 — 해마다 다시 쓰는 일력이다.
|
||||
· 30개를 억지로 채우지 마라. 확실한 것이 12개면 12개만 낸다.
|
||||
· 같은 장소를 계절만 바꿔 반복하지 않는다.`,
|
||||
fields: [
|
||||
{key: 'monthDay', label: '날짜', hint: 'MM-DD. 연도는 넣지 않습니다', half: true},
|
||||
{key: 'category', label: '분류', half: true},
|
||||
{key: 'title', label: '제목'},
|
||||
{key: 'body', label: '내용', type: 'area', hint: '두 문장 이내'},
|
||||
{key: 'season', label: '계절', options: ['봄', '여름', '가을', '겨울'], half: true},
|
||||
{key: 'tags', label: '해시태그', type: 'tags', hint: '쉼표로 끊습니다', half: true},
|
||||
...SOURCE_FIELDS,
|
||||
],
|
||||
},
|
||||
|
||||
course: {
|
||||
kind: 'course',
|
||||
label: '반나절 산책',
|
||||
sample: JSON.stringify(
|
||||
{
|
||||
kind: 'course',
|
||||
version: 1,
|
||||
title: '반나절 산책',
|
||||
items: [
|
||||
{
|
||||
name: '탁류길 코스',
|
||||
duration: '3시간',
|
||||
startsFrom: '스테이 머뭄',
|
||||
stops: [
|
||||
{order: 1, name: '채만식문학관', minutes: 12, note: '금강 하구 옆. 소설의 배경을 먼저 눈에 담습니다.', searchQuery: '군산 채만식문학관'},
|
||||
{order: 2, name: '군산 내항 부잔교', minutes: 9, note: '조수에 오르내리던 뜬다리. 이 코스의 중심입니다.', searchQuery: '군산 내항 부잔교'},
|
||||
{order: 3, name: '째보선창', minutes: 7, note: '항구 노동의 기억이 남은 선창입니다.', searchQuery: '군산 째보선창'},
|
||||
{order: 4, name: '초원사진관', minutes: 11, note: '영화가 남기고 간 자리입니다.', searchQuery: '군산 초원사진관'},
|
||||
{order: 5, name: '이성당', minutes: 6, note: '코스의 끝. 단팥빵 하나로 반나절을 닫습니다.', searchQuery: '군산 이성당'},
|
||||
],
|
||||
verified: '확인',
|
||||
source: {name: '군산 스탬프투어', url: 'https://www.gunsanstamp.kr/'},
|
||||
},
|
||||
],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
task: `[해야 할 일]
|
||||
[업소]에서 출발하는 반나절 산책 코스를 2~3개 만든다. 코스마다 정거장 4~6곳.
|
||||
걸어서 이동할 수 있는 순서로 배열하고, 앞 정거장에서 다음까지 걸리는 분을 minutes 에 적는다.
|
||||
|
||||
[스키마]
|
||||
{ "kind":"course", "version":1, "title":"반나절 산책", "items":[
|
||||
{ "name":"코스 이름", "duration":"3시간", "startsFrom":"[업소]",
|
||||
"stops":[ {"order":1,"name":"장소","minutes":12,
|
||||
"note":"한 문장","searchQuery":"검색어"} ],
|
||||
"verified":"확인|확인필요",
|
||||
"source":{"name":"출처명","url":"https://..."} } ] }`,
|
||||
rules: `
|
||||
[이 아이템만의 규칙]
|
||||
· 정거장에 url 을 넣지 않는다. searchQuery(지도 검색어)만 넣는다.
|
||||
· minutes 는 도보 기준이다. 차로만 갈 수 있으면 note 에 "차로 이동" 이라고 적는다.
|
||||
· 영업시간·요금은 넣지 않는다. 바뀌면 손님이 헛걸음한다.`,
|
||||
},
|
||||
|
||||
schedule: {
|
||||
kind: 'schedule',
|
||||
label: '여행 스케줄',
|
||||
sample: JSON.stringify(
|
||||
{
|
||||
kind: 'schedule',
|
||||
version: 1,
|
||||
title: '여행 스케줄',
|
||||
items: [
|
||||
{
|
||||
name: '비 오는 날의 하루',
|
||||
audience: '혼자 온 손님',
|
||||
season: '장마',
|
||||
slots: [
|
||||
{time: '09:00', title: '늦은 아침', place: '스테이 머뭄', minutes: 60, note: '창가 자리에서 비 소리를 먼저 듣습니다.'},
|
||||
{time: '10:30', title: '실내로 피신', place: '군산근대역사박물관', minutes: 90, note: '항구 도시가 어떻게 만들어졌는지 한 바퀴.', searchQuery: '군산근대역사박물관'},
|
||||
{time: '12:30', title: '점심', place: '한일옥', minutes: 60, note: '무국 한 그릇으로 몸을 데웁니다.', searchQuery: '군산 한일옥'},
|
||||
{time: '14:00', title: '책과 커피', place: '마리서사', minutes: 120, note: '비 그칠 때까지 앉아 있기 좋은 곳입니다.', searchQuery: '군산 마리서사'},
|
||||
{time: '17:00', title: '해 질 무렵 산책', place: '경암동 철길마을', minutes: 60, note: '비 온 뒤 철길에 물이 고여 하늘이 두 번 보입니다.', searchQuery: '군산 경암동 철길마을'},
|
||||
],
|
||||
verified: '확인필요',
|
||||
source: {name: '군산시 문화관광', url: 'https://www.gunsan.go.kr/tour'},
|
||||
},
|
||||
],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
task: `[해야 할 일]
|
||||
[업소]에 묵거나 들른 손님이 [지역]에서 하루를 어떻게 보내면 좋을지 여행 스케줄을 2~3개 만든다.
|
||||
스케줄마다 시간대 5~7개. 아침부터 저녁까지 시각 순서로 배열한다.
|
||||
스케줄은 서로 성격이 달라야 한다 — 날씨(비 오는 날)·동행(아이와 함께)·계절 중 하나로 가른다.
|
||||
|
||||
[스키마]
|
||||
{ "kind":"schedule", "version":1, "title":"여행 스케줄", "items":[
|
||||
{ "name":"스케줄 이름", "audience":"누구를 위한 하루", "season":"계절·날씨",
|
||||
"slots":[ {"time":"09:00","title":"무엇을 하나","place":"장소",
|
||||
"minutes":60,"note":"한 문장","searchQuery":"지도 검색어"} ],
|
||||
"verified":"확인|확인필요",
|
||||
"source":{"name":"출처명","url":"https://..."} } ] }`,
|
||||
rules: `
|
||||
[이 아이템만의 규칙]
|
||||
· time 은 24시간 "HH:MM" 로만 적는다. "오전 9시" 처럼 쓰지 않는다.
|
||||
· 그 장소의 영업시간·휴무일을 안다고 가정하지 않는다. 바뀌면 손님이 헛걸음한다.
|
||||
· 첫 칸은 [업소]에서 시작하고, 이동은 걸어서 또는 대중교통으로 갈 수 있는 범위로 짠다.
|
||||
· 장소에 url 을 넣지 않는다. searchQuery 만 넣는다.
|
||||
· 예약이 필요한 곳은 note 에 "예약 필요" 라고만 적고 연락처는 쓰지 않는다.`,
|
||||
},
|
||||
people: {
|
||||
kind: 'people',
|
||||
label: '인물 열전',
|
||||
@@ -354,6 +319,15 @@ export const SECTION_DATA_SPEC: Record<string, SectionDataSpec> = {
|
||||
· "~ 출신으로 알려진" 처럼 근거가 전언뿐이면 verified 를 "확인필요" 로 한다.
|
||||
· 생존 인물의 가족·거주지·건강 같은 사생활은 쓰지 않는다.
|
||||
· 사진 URL 을 넣지 않는다. imageQuery 만 넣는다 — 초상권과 저작권은 사장님이 확인한다.`,
|
||||
fields: [
|
||||
{key: 'name', label: '이름'},
|
||||
{key: 'aka', label: '호 · 예명', half: true},
|
||||
{key: 'years', label: '생몰년', half: true},
|
||||
{key: 'role', label: '역할'},
|
||||
{key: 'oneLine', label: '한 줄 소개', type: 'area'},
|
||||
{key: 'imageQuery', label: '사진 검색어', hint: '사진 주소는 받지 않습니다 — 검색어만'},
|
||||
...SOURCE_FIELDS,
|
||||
],
|
||||
},
|
||||
|
||||
chronicle: {
|
||||
@@ -420,72 +394,14 @@ export const SECTION_DATA_SPEC: Record<string, SectionDataSpec> = {
|
||||
· turning 은 도시의 성격을 바꾼 해에만 true 다. 3~4개를 넘기지 않는다.
|
||||
· 연도가 불확실하면 그 항목을 통째로 뺀다. 연표에서 틀린 연도는 바로 들킨다.
|
||||
· place 는 지금도 찾아갈 수 있는 자리만 적는다. 없으면 필드를 뺀다.`,
|
||||
},
|
||||
|
||||
literature: {
|
||||
kind: 'literature',
|
||||
label: '문학 서가',
|
||||
sample: JSON.stringify(
|
||||
{
|
||||
kind: 'literature',
|
||||
version: 1,
|
||||
title: '문학 서가',
|
||||
subtitle: '이 도시를 쓴 책들',
|
||||
items: [
|
||||
{
|
||||
workTitle: '탁류',
|
||||
author: '채만식',
|
||||
year: '1937–1938 연재',
|
||||
genre: '장편소설',
|
||||
spineColor: '#7d3320',
|
||||
background: '일제강점기 군산을 무대로 한 여자의 삶과 도시의 경제를 겹쳐 놓았습니다.',
|
||||
whyHere: '소설 속 거리를 따라 걸으면 지금의 내항이 겹쳐 보입니다.',
|
||||
verified: '확인',
|
||||
source: {name: '군산시 채만식문학관', url: 'https://www.gunsan.go.kr/chae/'},
|
||||
},
|
||||
{
|
||||
workTitle: '레디메이드 인생',
|
||||
author: '채만식',
|
||||
year: '1934',
|
||||
genre: '단편소설',
|
||||
spineColor: '#2a4a6b',
|
||||
background: '배운 사람이 일자리를 얻지 못하는 식민지 도시의 앞뒤를 풍자로 잘라 보입니다.',
|
||||
whyHere: '같은 작가의 문학관이 금강 하구 옆에 서 있습니다.',
|
||||
verified: '확인필요',
|
||||
source: {name: '군산시 채만식문학관', url: 'https://www.gunsan.go.kr/chae/'},
|
||||
},
|
||||
{
|
||||
workTitle: '아리랑',
|
||||
author: '조정래',
|
||||
year: '대하소설',
|
||||
genre: '장편소설',
|
||||
spineColor: '#3f5c33',
|
||||
background: '이 지역이 겪은 시간을 인물들의 이동으로 따라갑니다.',
|
||||
whyHere: '스탬프투어 아리랑길이 소설과 같은 자리를 지납니다.',
|
||||
verified: '확인필요',
|
||||
source: {name: '군산 스탬프투어', url: 'https://www.gunsanstamp.kr/'},
|
||||
},
|
||||
],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
task: `[해야 할 일]
|
||||
[지역]을 배경으로 하거나 [지역]에서 쓰인 문학 작품을 8편까지 찾는다.
|
||||
소설·시·수필을 고루 섞고, 작품이 그 지역과 어떻게 닿는지 한 문장으로 적는다.
|
||||
|
||||
[스키마]
|
||||
{ "kind":"literature", "version":1, "title":"문학 서가", "items":[
|
||||
{ "workTitle":"작품명", "author":"작가", "year":"1937", "genre":"장편소설",
|
||||
"spineColor":"#7d3320", "background":"작품 배경 두 문장 이내",
|
||||
"whyHere":"[지역]과 잇는 한 문장",
|
||||
"verified":"확인|확인필요",
|
||||
"source":{"name":"출처명","url":"https://..."} } ] }`,
|
||||
rules: `
|
||||
[이 아이템만의 규칙]
|
||||
· 작품 원문(구절·시행·문장)을 옮기지 않는다. 줄거리와 배경만 쓴다.
|
||||
· 저작권이 살아 있는 작품일수록 짧게 쓴다.
|
||||
· spineColor 는 책등 색이다. 작품 분위기에 맞는 어두운 색 하나를 hex 로 고른다.`,
|
||||
fields: [
|
||||
{key: 'year', label: '연도', type: 'number', half: true},
|
||||
{key: 'place', label: '지금 이 자리', half: true},
|
||||
{key: 'title', label: '무슨 일'},
|
||||
{key: 'summary', label: '한 줄 설명', type: 'area'},
|
||||
{key: 'turning', label: '전환점', options: ['예', '아니오'], hint: '붉은 점으로 표시됩니다'},
|
||||
...SOURCE_FIELDS,
|
||||
],
|
||||
},
|
||||
|
||||
postcard: {
|
||||
@@ -542,6 +458,13 @@ export const SECTION_DATA_SPEC: Record<string, SectionDataSpec> = {
|
||||
· 한 문장은 40자 안쪽이다. 두 문장으로 쓰지 않는다.
|
||||
· 느낌표와 이모지를 쓰지 않는다. 광고 문구처럼 들리면 실패다.
|
||||
· 해시태그는 3개까지. 지역명 하나는 반드시 넣는다.`,
|
||||
fields: [
|
||||
{key: 'line', label: '엽서 문장', type: 'area'},
|
||||
{key: 'place', label: '장소', half: true},
|
||||
{key: 'postmark', label: '소인 지명', half: true},
|
||||
{key: 'hashtags', label: '해시태그', type: 'tags', hint: '쉼표로 끊습니다 · 3개까지'},
|
||||
...SOURCE_FIELDS,
|
||||
],
|
||||
},
|
||||
|
||||
quiz: {
|
||||
@@ -598,95 +521,154 @@ export const SECTION_DATA_SPEC: Record<string, SectionDataSpec> = {
|
||||
· answer 필드는 스키마에 없다. 정답을 단정하지 않는다 — 힌트까지만 준다.
|
||||
· 힌트에 사실을 넣되, 확실하지 않으면 그 항목을 통째로 뺀다.
|
||||
· 질문에 지역 이름을 넣어 어디 이야기인지 알 수 있게 한다.`,
|
||||
fields: [
|
||||
{key: 'question', label: '질문', type: 'area'},
|
||||
{key: 'hint', label: '힌트', type: 'area', hint: '정답은 두지 않습니다'},
|
||||
{key: 'topic', label: '주제', half: true},
|
||||
{key: 'level', label: '난이도', half: true},
|
||||
...SOURCE_FIELDS,
|
||||
],
|
||||
},
|
||||
|
||||
planner: {
|
||||
kind: 'planner',
|
||||
label: '계절별 추천 하루',
|
||||
video: {
|
||||
kind: 'video',
|
||||
label: '영상',
|
||||
sample: JSON.stringify(
|
||||
{
|
||||
kind: 'planner',
|
||||
kind: 'video',
|
||||
version: 1,
|
||||
title: '계절별 추천 하루',
|
||||
subtitle: '계절을 고르면 시각까지 짜 드립니다',
|
||||
title: '영상으로 보기',
|
||||
subtitle: '사진으로 다 안 보이는 것',
|
||||
items: [
|
||||
{
|
||||
name: '개항장 골목 한 바퀴',
|
||||
season: '가을',
|
||||
rank: 1,
|
||||
startTime: '09:30',
|
||||
audience: '처음 온 손님',
|
||||
why: '해가 낮아지는 계절이라 골목 그림자가 길어집니다. 걷는 거리가 가장 짧은 코스이기도 합니다.',
|
||||
stops: [
|
||||
{name: '군산근대역사박물관', minutes: 90, moveMinutes: 15, note: '항구 도시가 어떻게 만들어졌는지 먼저 봅니다.', searchQuery: '군산근대역사박물관'},
|
||||
{name: '초원사진관', minutes: 30, moveMinutes: 10, note: '영화가 남기고 간 자리입니다.', searchQuery: '군산 초원사진관'},
|
||||
{name: '이성당', minutes: 40, moveMinutes: 8, note: '단팥빵 하나로 오후를 엽니다.', searchQuery: '군산 이성당'},
|
||||
{name: '경암동 철길마을', minutes: 60, moveMinutes: 20, note: '해 질 무렵 빛이 가장 좋습니다.', searchQuery: '군산 경암동 철길마을'},
|
||||
],
|
||||
url: 'https://youtube.com/shorts/c2ZdwhaB7S4',
|
||||
caption: '마당에서 본 저녁 무렵',
|
||||
verified: '확인',
|
||||
source: {name: '군산시 문화관광', url: 'https://www.gunsan.go.kr/tour/'},
|
||||
},
|
||||
{
|
||||
name: '섬으로 건너가는 날',
|
||||
season: '가을',
|
||||
rank: 2,
|
||||
startTime: '10:00',
|
||||
audience: '차를 가져온 손님',
|
||||
why: '바람이 차기 전 마지막으로 바다가 열리는 계절입니다.',
|
||||
stops: [
|
||||
{name: '고군산군도 선유도', minutes: 150, moveMinutes: 50, note: '다리로 건너갑니다. 차로 이동.', searchQuery: '군산 선유도'},
|
||||
{name: '장자도', minutes: 60, moveMinutes: 15, note: '섬과 섬 사이를 걸어 넘습니다.', searchQuery: '군산 장자도'},
|
||||
],
|
||||
verified: '확인필요',
|
||||
source: {name: '대한민국 구석구석', url: 'https://korean.visitkorea.or.kr/'},
|
||||
},
|
||||
{
|
||||
name: '비 오면 여기로',
|
||||
season: '여름',
|
||||
rank: 1,
|
||||
startTime: '10:30',
|
||||
audience: '혼자 온 손님',
|
||||
why: '장마철에 실내로만 이어지는 코스입니다. 우산을 접었다 폈다 하지 않아도 됩니다.',
|
||||
stops: [
|
||||
{name: '군산근대건축관', minutes: 60, moveMinutes: 12, note: '옛 은행 건물 안이 통째로 전시입니다.', searchQuery: '군산근대건축관'},
|
||||
{name: '한일옥', minutes: 60, moveMinutes: 8, note: '무국 한 그릇으로 몸을 데웁니다.', searchQuery: '군산 한일옥'},
|
||||
{name: '째보선창 근처 카페', minutes: 90, moveMinutes: 10, note: '비 그칠 때까지 앉아 있기 좋습니다.', searchQuery: '군산 째보선창 카페'},
|
||||
],
|
||||
verified: '확인필요',
|
||||
source: {name: '군산시 문화관광', url: 'https://www.gunsan.go.kr/tour/'},
|
||||
},
|
||||
],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
task: `[해야 할 일]
|
||||
[업소]에 묵는 손님을 위한 [지역] 하루 코스를 **계절마다 1~3위**로 추천한다.
|
||||
계절 넷(봄·여름·가을·겨울)을 모두 채우고, 계절마다 성격이 다른 코스 세 개를 1·2·3위로 매긴다.
|
||||
코스마다 정거장 3~5곳을 **도는 순서대로** 적는다.
|
||||
task: `
|
||||
[해야 할 일]
|
||||
[업소]의 유튜브 영상 주소를 1~3개 고른다.
|
||||
|
||||
★ 시각은 적지 않는다. 출발 시각(startTime)과 각 정거장의 머무는 시간(minutes)·이동 시간(moveMinutes)만
|
||||
적으면 화면이 시각을 계산해 채운다.
|
||||
|
||||
[스키마]
|
||||
{ "kind":"planner", "version":1, "title":"계절별 추천 하루", "items":[
|
||||
{ "name":"코스 이름", "season":"봄|여름|가을|겨울", "rank":1,
|
||||
"startTime":"09:30", "audience":"누구에게 맞는 하루",
|
||||
"why":"왜 이 계절에 이 코스인가 (한 문장)",
|
||||
"stops":[ {"name":"장소","minutes":90,"moveMinutes":15,
|
||||
"note":"한 문장","searchQuery":"지도 검색어"} ],
|
||||
"verified":"확인|확인필요",
|
||||
"source":{"name":"출처명","url":"https://..."} } ] }`,
|
||||
· 이미 올라가 있는 영상의 **주소만** 옮긴다. 영상을 만들라는 것이 아니다.
|
||||
· 손님이 사진으로는 알 수 없는 것을 보여주는 영상이 좋다 — 공간의 크기, 빛, 소리, 가는 길.`,
|
||||
rules: `
|
||||
[이 아이템만의 규칙]
|
||||
· rank 는 계절마다 1·2·3 만 쓴다. 4위는 만들지 않는다 — 아무도 안 고른다.
|
||||
· 같은 계절의 세 코스가 서로 달라야 한다. 정거장이 겹치면 순위가 아니라 중복이다.
|
||||
· moveMinutes 는 앞 정거장에서 오는 시간이다. 첫 정거장은 [업소]에서 나서는 시간이다.
|
||||
· 걸어서 못 가는 곳은 note 에 "차로 이동" 이라고 적는다.
|
||||
· 영업시간·휴무일·요금은 넣지 않는다. 바뀌면 짜 준 일정이 손님을 헛걸음시킨다.
|
||||
· 장소에 url 을 넣지 않는다. searchQuery(지도 검색어)만 넣는다.`,
|
||||
· url 은 유튜브만 받는다. watch · youtu.be · shorts 어느 형식이든 된다.
|
||||
· 다른 사이트 영상 주소를 넣으면 재생되지 않고 링크로만 남는다.
|
||||
· caption 은 한 줄이다. 영상 제목을 그대로 옮기지 않는다 — 왜 볼 만한지를 적는다.
|
||||
· 남의 영상을 넣지 않는다. 업소가 올렸거나 업소를 찍은 영상만.`,
|
||||
fields: [
|
||||
{key: 'url', label: '유튜브 주소', hint: 'watch · youtu.be · shorts 다 됩니다'},
|
||||
{key: 'caption', label: '한 줄 설명', hint: '제목 말고 왜 볼 만한지'},
|
||||
...SOURCE_FIELDS,
|
||||
],
|
||||
},
|
||||
|
||||
itinerary: {
|
||||
kind: 'itinerary',
|
||||
label: '추천 일정',
|
||||
sample: JSON.stringify(
|
||||
{
|
||||
kind: 'itinerary',
|
||||
version: 1,
|
||||
title: '추천 일정',
|
||||
subtitle: '며칠 묵느냐에 따라',
|
||||
items: [
|
||||
{
|
||||
name: '개항장 골목 한 바퀴',
|
||||
duration: '반나절',
|
||||
audience: '처음 온 손님',
|
||||
why: '걷는 거리가 가장 짧고, 군산이 어떤 도시였는지 먼저 보게 됩니다.',
|
||||
startTime: '09:30',
|
||||
stops: [
|
||||
{name: '군산근대역사박물관', minutes: 90, moveMinutes: 12, note: '항구 도시가 어떻게 만들어졌는지 먼저 봅니다.', searchQuery: '군산근대역사박물관', latitude: 35.9908197098, longitude: 126.7121231556},
|
||||
{name: '초원사진관', minutes: 30, moveMinutes: 10, note: '영화가 남기고 간 자리입니다.', searchQuery: '군산 초원사진관', latitude: 35.9877369536, longitude: 126.7083826065},
|
||||
{name: '이성당', minutes: 40, moveMinutes: 8, note: '단팥빵 하나로 오후를 엽니다.', searchQuery: '군산 이성당', latitude: 35.9870443303, longitude: 126.7111681428},
|
||||
],
|
||||
verified: '확인',
|
||||
source: {name: '군산시 문화관광', url: 'https://www.gunsan.go.kr/tour/'},
|
||||
},
|
||||
{
|
||||
name: '섬까지 다녀오는 1박 2일',
|
||||
duration: '1박 2일',
|
||||
audience: '차를 가져온 손님',
|
||||
why: '첫날은 도심, 이튿날은 바다. 하루씩 성격이 다릅니다.',
|
||||
days: [
|
||||
{
|
||||
label: '첫째 날',
|
||||
startTime: '14:00',
|
||||
stops: [
|
||||
{name: '경암동 철길마을', minutes: 40, moveMinutes: 15, searchQuery: '군산 경암동 철길마을', latitude: 35.9813520474, longitude: 126.7362330582},
|
||||
{name: '째보선창', minutes: 40, moveMinutes: 12, note: '해 지는 시간에 맞추면 좋습니다.', searchQuery: '군산 째보선창', latitude: 35.9875345, longitude: 126.7199875},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '둘째 날',
|
||||
startTime: '09:30',
|
||||
stops: [
|
||||
{name: '고군산군도 선유도', minutes: 180, moveMinutes: 45, note: '다리로 건너갑니다. 차로 이동.', searchQuery: '군산 선유도', latitude: 35.8102049733, longitude: 126.4124052922},
|
||||
{name: '장자도', minutes: 60, moveMinutes: 12, searchQuery: '군산 장자도', latitude: 35.8101, longitude: 126.3973},
|
||||
],
|
||||
},
|
||||
],
|
||||
verified: '확인필요',
|
||||
source: {name: '대한민국 구석구석', url: 'https://korean.visitkorea.or.kr/'},
|
||||
},
|
||||
],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
task: `
|
||||
[해야 할 일]
|
||||
[업소]에서 출발하는 추천 일정을 3~5개 만든다. **반나절 · 1박 2일 · 2박 3일** 을 섞는다.
|
||||
|
||||
· 하루짜리는 stops 만 쓴다. 여러 날이면 days 로 날짜를 나눈다.
|
||||
· 정거장은 하루에 3~5곳. 여섯 곳부터는 아무도 그대로 못 돈다.
|
||||
· minutes 는 거기서 머무는 시간, moveMinutes 는 앞 칸에서 오는 데 걸리는 시간이다.
|
||||
· 첫 정거장의 moveMinutes 는 **업소에서 나서는 시간**이다.`,
|
||||
rules: `
|
||||
[이 아이템만의 규칙]
|
||||
· 순위를 매기지 않는다. rank 같은 칸은 없다 — 어느 일정이 1위인지는 정할 일이 아니다.
|
||||
· duration 은 "반나절" · "1박 2일" · "2박 3일" 중 하나로 적는다. 목록이 이 값으로 갈린다.
|
||||
· season 은 **꼭 필요할 때만** 적는다. 적으면 그 계절에만 손님 화면에 나간다
|
||||
(벚꽃·해수욕처럼 계절을 타는 일정에만).
|
||||
· 링크를 만들지 않는다. searchQuery 에 지도 검색어만 적는다.
|
||||
· latitude · longitude 는 **아는 곳만** 적는다. 지도에 번호 핀이 찍히는 값이다 —
|
||||
지어내면 엉뚱한 동네에 핀이 찍히고, 비워 두면 그 칸은 시간표에만 선다(그게 낫다).
|
||||
· 밤 9시를 넘기는 칸은 화면에서 빠진다 — 시각을 계산해 보고 넣는다.`,
|
||||
fields: [
|
||||
{key: 'name', label: '일정 이름'},
|
||||
{key: 'duration', label: '기간', options: ['반나절', '1박 2일', '2박 3일'], half: true},
|
||||
{key: 'startTime', label: '출발 시각', hint: 'HH:MM · 하루짜리만', half: true},
|
||||
{key: 'audience', label: '누구에게 맞는 일정', half: true},
|
||||
{
|
||||
key: 'season',
|
||||
label: '계절',
|
||||
half: true,
|
||||
options: ['봄', '여름', '가을', '겨울'],
|
||||
hint: '적으면 그 계절에만 나갑니다',
|
||||
},
|
||||
{key: 'why', label: '왜 이 일정인가', type: 'area'},
|
||||
...SOURCE_FIELDS,
|
||||
],
|
||||
child: {
|
||||
key: 'stops',
|
||||
label: '정거장',
|
||||
fields: [
|
||||
{key: 'name', label: '장소'},
|
||||
{key: 'minutes', label: '머무는 시간(분)', type: 'number', half: true},
|
||||
{key: 'moveMinutes', label: '오는 데 걸리는 시간(분)', type: 'number', half: true},
|
||||
{key: 'searchQuery', label: '지도 검색어'},
|
||||
{key: 'note', label: '한 줄', type: 'area'},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export function dataSpecFor(sectionType: string): SectionDataSpec | undefined {
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
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)}`;
|
||||
|
||||
/**
|
||||
* 가이드 카드 한 장 — 사진(좌하단 "도보 약 N분 850m" 배지) · 이름 · 설명 2줄 · "검색으로 열기".
|
||||
*
|
||||
* ★ 사진이 없으면 회색 판에 이름을 크게 쓴다(스크린샷의 '군산복집' 카드). 자리를 비우거나
|
||||
* 남의 사진을 채우지 않는다 — 카드 폭이 들쭉날쭉해지면 캐러셀이 흔들린다.
|
||||
* ★ 거리를 모르면 배지를 생략한다. "도보 N분"은 업장 기준 직선거리에서만 계산한다.
|
||||
*/
|
||||
function GuideCardView({card, colors, leading}: {card: GuideCard; colors: TemplateItem['colors']; leading?: ReactNode}) {
|
||||
const minutes = card.distanceMeters !== undefined ? walkMinutes(card.distanceMeters) : undefined;
|
||||
return (
|
||||
<a
|
||||
href={naverSearch(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,
|
||||
}: {
|
||||
cards: GuideCard[];
|
||||
colors: TemplateItem['colors'];
|
||||
/** 카드 이름 위에 얹을 배지(축제의 "10월" 등). */
|
||||
renderLeading?: (card: GuideCard) => ReactNode;
|
||||
}) {
|
||||
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)}
|
||||
/>
|
||||
))}
|
||||
</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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
/**
|
||||
* 캔버스의 가로 슬라이더.
|
||||
*
|
||||
* ★ 왜 라이브러리인가 (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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -17,3 +17,7 @@ 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} from './PlaceCarousel';
|
||||
export {WalkFilterTabs} from './WalkFilterTabs';
|
||||
@@ -7,10 +7,8 @@
|
||||
import type {IndustryType, SectionItem} from '@o2o/shared';
|
||||
import type {SectionVariant} from './types';
|
||||
|
||||
import {HeroEditorial} from './variants/hero/HeroEditorial';
|
||||
import {HeroCover} from './variants/hero/HeroCover';
|
||||
import {HeroSplit} from './variants/hero/HeroSplit';
|
||||
import {HeroFullBleed} from './variants/hero/HeroFullBleed';
|
||||
import {HeroTypeOnly} from './variants/hero/HeroTypeOnly';
|
||||
|
||||
import {IntroStory} from './variants/intro/IntroStory';
|
||||
import {IntroCentered} from './variants/intro/IntroCentered';
|
||||
@@ -28,9 +26,9 @@ import {PhotosWithVideos} from './variants/photos/PhotosWithVideos';
|
||||
import {MapDetailed} from './variants/map/MapDetailed';
|
||||
import {MapCompact} from './variants/map/MapCompact';
|
||||
|
||||
import {LocalFull} from './variants/local/LocalFull';
|
||||
import {LocalTabs} from './variants/local/LocalTabs';
|
||||
import {LocalCompact} from './variants/local/LocalCompact';
|
||||
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';
|
||||
@@ -41,8 +39,6 @@ import {RoomsCarousel} from './variants/rooms/RoomsCarousel';
|
||||
import {RoomsGrid} from './variants/rooms/RoomsGrid';
|
||||
import {RoomsList} from './variants/rooms/RoomsList';
|
||||
|
||||
import {RulesList} from './variants/rules/RulesList';
|
||||
import {RulesCards} from './variants/rules/RulesCards';
|
||||
|
||||
import {BookingCard} from './variants/booking/BookingCard';
|
||||
import {BookingBanner} from './variants/booking/BookingBanner';
|
||||
@@ -66,23 +62,27 @@ import {ExhibitionNotice} from './variants/exhibition/ExhibitionNotice';
|
||||
// 붙여넣기 아이템 — 데이터가 fact 가 아니라 사장님이 넣은 JSON 에서 온다(dataSpec.ts).
|
||||
import {SongsTurntable} from './variants/songs/SongsTurntable';
|
||||
import {DailyCalendar} from './variants/daily/DailyCalendar';
|
||||
import {CourseTickets} from './variants/course/CourseTickets';
|
||||
import {ScheduleTimetable} from './variants/schedule/ScheduleTimetable';
|
||||
import {PeopleFilmstrip} from './variants/people/PeopleFilmstrip';
|
||||
import {ChronicleRail} from './variants/chronicle/ChronicleRail';
|
||||
import {LiteratureShelf} from './variants/literature/LiteratureShelf';
|
||||
import {PostcardStack} from './variants/postcard/PostcardStack';
|
||||
import {QuizFlip} from './variants/quiz/QuizFlip';
|
||||
import {PlannerPodium} from './variants/planner/PlannerPodium';
|
||||
|
||||
export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
/*
|
||||
* 히어로.
|
||||
*
|
||||
* ★ 발행본이 실제로 해석하는 것과 **1:1 이어야 한다**(`site/src/sections/HeroSection.tsx`).
|
||||
* 예전에는 에디토리얼·풀스크린·타이포 셋을 더 보여줬는데 발행본에 짝이 없어서,
|
||||
* 무엇을 골라도 발행본은 기본(표지)으로 나왔다 — 고르는 의미가 없는 선택지였다.
|
||||
* 여기 늘릴 때는 발행본 쪽 분기도 같이 늘린다.
|
||||
*/
|
||||
hero: [
|
||||
{
|
||||
id: 'hero.editorial',
|
||||
name: '에디토리얼',
|
||||
description: '상호 바 + 큰 사진 + 가운데 문구. 분위기부터 보여준다.',
|
||||
id: 'hero.cover',
|
||||
name: '표지',
|
||||
description: '사진 한 장 위, 상호는 좌하단. 사진의 피사체를 글자가 가리지 않는다.',
|
||||
thumb: 'fullbleed',
|
||||
Component: HeroEditorial,
|
||||
Component: HeroCover,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
@@ -92,20 +92,6 @@ export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
thumb: 'split',
|
||||
Component: HeroSplit,
|
||||
},
|
||||
{
|
||||
id: 'hero.full-bleed',
|
||||
name: '풀스크린 사진',
|
||||
description: '사진을 화면 끝까지. 사진 한 장의 힘이 강할 때.',
|
||||
thumb: 'fullbleed',
|
||||
Component: HeroFullBleed,
|
||||
},
|
||||
{
|
||||
id: 'hero.type-only',
|
||||
name: '타이포 중심',
|
||||
description: '사진 없이 여백과 글자만. 쓸 사진이 없거나 조용한 인상을 원할 때.',
|
||||
thumb: 'centered',
|
||||
Component: HeroTypeOnly,
|
||||
},
|
||||
],
|
||||
|
||||
intro: [
|
||||
@@ -208,29 +194,17 @@ export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
},
|
||||
],
|
||||
|
||||
// ★ 전체/탭/요약 세 개를 하나로 통일했다(2026-09-07). 저장된 옛 id(local.tabs·local.compact)는
|
||||
// resolveVariant 가 기본값으로 떨어뜨리므로 기존 사이트가 깨지지 않는다.
|
||||
local: [
|
||||
{
|
||||
id: 'local.full',
|
||||
name: '전체',
|
||||
description: '날씨 + 맛집 + 명소 + 축제를 전부 세로로.',
|
||||
id: 'local.guide',
|
||||
name: '가이드',
|
||||
description: '맛집 · 명소 · 축제를 도보 시간으로 걸러 카드로 넘겨 본다.',
|
||||
thumb: 'stack',
|
||||
Component: LocalFull,
|
||||
Component: LocalGuide,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'local.tabs',
|
||||
name: '탭 전환',
|
||||
description: '맛집/명소/축제를 탭으로. 화면 길이를 1/3 로 줄인다.',
|
||||
thumb: 'accordion',
|
||||
Component: LocalTabs,
|
||||
},
|
||||
{
|
||||
id: 'local.compact',
|
||||
name: '요약',
|
||||
description: '날씨 한 줄과 추천 6곳만. 주인공이 아닐 때.',
|
||||
thumb: 'compact',
|
||||
Component: LocalCompact,
|
||||
},
|
||||
],
|
||||
|
||||
weather: [
|
||||
@@ -294,23 +268,6 @@ export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
},
|
||||
],
|
||||
|
||||
rules: [
|
||||
{
|
||||
id: 'rules.list',
|
||||
name: '목록',
|
||||
description: '한 덩어리로 짧게. 가장 눈에 덜 띈다.',
|
||||
thumb: 'compact',
|
||||
Component: RulesList,
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
id: 'rules.cards',
|
||||
name: '번호 카드',
|
||||
description: '규정 하나에 칸 하나. 클레임이 잦은 곳에.',
|
||||
thumb: 'cards',
|
||||
Component: RulesCards,
|
||||
},
|
||||
],
|
||||
|
||||
booking: [
|
||||
{
|
||||
@@ -431,27 +388,7 @@ export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
},
|
||||
],
|
||||
|
||||
course: [
|
||||
{
|
||||
id: 'course.tickets',
|
||||
name: '승차권',
|
||||
description: '정거장 하나가 표 한 장. 마지막 표에 완주 도장이 찍힌다.',
|
||||
thumb: 'carousel',
|
||||
Component: CourseTickets,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
schedule: [
|
||||
{
|
||||
id: 'schedule.timetable',
|
||||
name: '대합실 시간표',
|
||||
description: '칸 하나가 시간대 하나. 검은 플립보드에 시각이 먼저 뜬다.',
|
||||
thumb: 'carousel',
|
||||
Component: ScheduleTimetable,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
people: [
|
||||
{
|
||||
@@ -475,16 +412,6 @@ export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
},
|
||||
],
|
||||
|
||||
literature: [
|
||||
{
|
||||
id: 'literature.shelf',
|
||||
name: '책등 서가',
|
||||
description: '책등이 가로로 흐르고 고른 책만 세로쓰기로 펼쳐진다.',
|
||||
thumb: 'carousel',
|
||||
Component: LiteratureShelf,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
postcard: [
|
||||
{
|
||||
@@ -508,16 +435,6 @@ export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
},
|
||||
],
|
||||
|
||||
planner: [
|
||||
{
|
||||
id: 'planner.podium',
|
||||
name: '시즌 랭킹',
|
||||
description: '계절을 고르면 1·2·3위 하루가 뜬다. 시각은 계산해서 채운다.',
|
||||
thumb: 'timeline',
|
||||
Component: PlannerPodium,
|
||||
isDefault: true,
|
||||
},
|
||||
],
|
||||
|
||||
exhibition: [
|
||||
{
|
||||
@@ -536,6 +453,28 @@ export const SECTION_VARIANTS: Record<string, SectionVariant[]> = {
|
||||
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,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/** 그 업종에서 고를 수 있는 배리에이션. 업종 제한이 걸린 건 걸러낸다. */
|
||||
|
||||
+11
-19
@@ -6,11 +6,10 @@
|
||||
* ★ 연도가 없는 항목은 지어내 끼우지 않고 레일 끝으로 민다. 연표에서 틀린 순서는 바로 들킨다.
|
||||
*/
|
||||
import {useMemo} from 'react';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type ChronicleItem} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
@@ -20,7 +19,6 @@ import {
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
useCarousel,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
@@ -73,7 +71,6 @@ function Milestone({item, isLast}: {item: ChronicleItem; isLast: boolean}) {
|
||||
export function ChronicleRail(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<ChronicleItem>(section.type, section.data);
|
||||
const {ref, scrollBy} = useCarousel<HTMLDivElement>();
|
||||
|
||||
// 연도가 있는 것부터 오름차순, 없는 것은 뒤로. 붙여넣은 순서를 믿지 않는다.
|
||||
const items = useMemo(
|
||||
@@ -108,21 +105,16 @@ export function ChronicleRail(props: SectionRenderProps) {
|
||||
<PasteHint label="시간의 골목" />
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<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>
|
||||
{items.length > 3 && (
|
||||
<CarouselNav onPrev={() => scrollBy(-1)} onNext={() => scrollBy(1)} label="연표" />
|
||||
)}
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<div ref={ref} className="w4-scroll flex snap-x snap-mandatory overflow-x-auto pb-3">
|
||||
<Rail label="연표" gap={0}>
|
||||
{items.map((item, index) => (
|
||||
<Milestone
|
||||
key={`${item.year ?? 'x'}-${item.title}-${index}`}
|
||||
@@ -130,7 +122,7 @@ export function ChronicleRail(props: SectionRenderProps) {
|
||||
isLast={index === items.length - 1}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</Rail>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
/**
|
||||
* 반나절 산책 — 승차권 캐러셀.
|
||||
*
|
||||
* 표 한 장이 정거장 하나다. 절취선·펀치 구멍·완주 도장은 스탬프투어라는 실제 형식을 그대로 옮긴 것.
|
||||
* ★ 링크는 만들지 않는다. searchQuery 만 보여준다 — 지어낸 주소를 링크하지 않는 이 레포의 규약.
|
||||
*/
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type CourseItem, type CourseStop} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ITEM_INK,
|
||||
ITEM_SURFACE,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
useCarousel,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
function Ticket({
|
||||
stop,
|
||||
courseName,
|
||||
index,
|
||||
isLast,
|
||||
}: {
|
||||
stop: CourseStop;
|
||||
courseName: string;
|
||||
index: number;
|
||||
isLast: boolean;
|
||||
}) {
|
||||
const no = String(stop.order ?? index + 1).padStart(2, '0');
|
||||
|
||||
return (
|
||||
<div
|
||||
className="relative w-[236px] shrink-0 snap-center border shadow-[4px_4px_0_rgba(27,26,21,.13)]"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
|
||||
>
|
||||
<div
|
||||
className="flex justify-between border-b border-dashed px-4 py-2.5 text-[10px] tracking-[0.12em] opacity-75"
|
||||
style={{borderColor: ITEM_INK}}
|
||||
>
|
||||
<span className="truncate">{courseName}</span>
|
||||
<span className="shrink-0">NO.{no}</span>
|
||||
</div>
|
||||
|
||||
<p className="px-4 pt-4 leading-none" style={{fontFamily: ITEM_HEADING, fontSize: 32, color: ITEM_ACCENT}}>
|
||||
{no}
|
||||
</p>
|
||||
<h4 className="px-4 pt-1.5 text-base font-bold" style={{fontFamily: ITEM_BODY}}>
|
||||
{stop.name}
|
||||
</h4>
|
||||
{stop.note && (
|
||||
<p className="px-4 pt-2 text-[13px] leading-relaxed opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{stop.note}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div
|
||||
className="mt-3 flex justify-between gap-2 border-t border-dashed px-4 py-2.5 text-[10px] opacity-60"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<span>{stop.minutes ? `도보 ${stop.minutes}분` : '이동 시간 미정'}</span>
|
||||
{stop.searchQuery && <span className="truncate">지도 검색 · {stop.searchQuery}</span>}
|
||||
</div>
|
||||
|
||||
{/* 펀치 구멍 — 표를 표로 만드는 자리 */}
|
||||
<i
|
||||
className="absolute -left-[7px] top-1/2 size-3 rounded-full border"
|
||||
style={{backgroundColor: ITEM_SURFACE, borderColor: ITEM_INK}}
|
||||
/>
|
||||
<i
|
||||
className="absolute -right-[7px] top-1/2 size-3 rounded-full border"
|
||||
style={{backgroundColor: ITEM_SURFACE, borderColor: ITEM_INK}}
|
||||
/>
|
||||
|
||||
{isLast && (
|
||||
<span
|
||||
className="absolute bottom-3 right-3 grid size-14 -rotate-12 place-items-center rounded-full border-2 text-center text-[11px] leading-tight opacity-75"
|
||||
style={{fontFamily: ITEM_HEADING, borderColor: ITEM_ACCENT, color: ITEM_ACCENT}}
|
||||
>
|
||||
완주
|
||||
<br />
|
||||
도장
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CourseRow({course}: {course: CourseItem}) {
|
||||
const {ref, scrollBy} = useCarousel<HTMLDivElement>();
|
||||
const stops = course.stops ?? [];
|
||||
|
||||
return (
|
||||
<div className="space-y-2.5">
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-2">
|
||||
<div className="flex flex-wrap items-baseline gap-2.5">
|
||||
<h3 className="text-lg" style={{fontFamily: ITEM_HEADING}}>
|
||||
{course.name}
|
||||
</h3>
|
||||
<span className="text-[11px] opacity-60">
|
||||
{[course.duration, course.startsFrom ? `${course.startsFrom} 출발` : undefined, `${stops.length}곳`]
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
</span>
|
||||
</div>
|
||||
{stops.length > 2 && (
|
||||
<CarouselNav onPrev={() => scrollBy(-1)} onNext={() => scrollBy(1)} label={course.name} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{stops.length === 0 ? (
|
||||
<p className="border border-dashed px-4 py-5 text-center text-[11px] opacity-60" style={{borderColor: ITEM_BORDER}}>
|
||||
정거장이 아직 없습니다. JSON 의 stops 배열을 채워 주세요.
|
||||
</p>
|
||||
) : (
|
||||
<div ref={ref} className="w4-scroll flex snap-x snap-mandatory gap-4 overflow-x-auto pb-3">
|
||||
{stops.map((stop, index) => (
|
||||
<Ticket
|
||||
key={`${stop.name}-${index}`}
|
||||
stop={stop}
|
||||
courseName={course.name}
|
||||
index={index}
|
||||
isLast={index === stops.length - 1}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<SourceLine source={course.source} verified={course.verified} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CourseTickets(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<CourseItem>(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-8">
|
||||
{parsed.items.map((course, index) => (
|
||||
<CourseRow key={`${course.name}-${index}`} course={course} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* 히어로 · 표지 — 사진 한 장 위, 글은 좌하단.
|
||||
*
|
||||
* ★ 왜 가운데가 아닌가
|
||||
* 사진이 주인공인 화면에서 글자를 한가운데 얹으면 피사체를 정확히 가린다. 숙소 사진은
|
||||
* 가운데에 방이나 사람이 오는데, 상호가 그 위에 앉으면 둘 다 못 읽는다. 아래로 내리고
|
||||
* 그쪽만 어둡게 덮으면 사진은 사진대로 남고 글자는 글자대로 읽힌다.
|
||||
*
|
||||
* ★ 버튼을 세우지 않는다
|
||||
* 첫 화면에서 물어볼 것은 "방을 보겠는가" 하나다. 예약 버튼은 아래 예약 섹션이 맡고,
|
||||
* 여기서는 다음 섹션으로 눈을 내려보내기만 한다.
|
||||
*
|
||||
* ★ 색을 직접 쓰지 않는다
|
||||
* `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,66 +0,0 @@
|
||||
/**
|
||||
* 히어로 · 에디토리얼 — 상단 브랜드 바 + 큰 사진 + 가운데 세리프 카피.
|
||||
* 감성 숙소/공방처럼 "분위기부터 보여주고 싶은" 곳의 기본값.
|
||||
*/
|
||||
import {Calendar} from 'lucide-react';
|
||||
import {SectionFrame} from '../../primitives';
|
||||
import {CtaLink} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {bookingHref, primaryPhoto} from '../common';
|
||||
|
||||
export function HeroEditorial(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, location, template, photos} = props;
|
||||
const cover = primaryPhoto(photos);
|
||||
// 사진이 없으면 <img> 없이 어두운 판만 남긴다 — 시연용 사진으로 자리를 메우지 않는다.
|
||||
const coverUrl = cover?.url;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} padded={false}>
|
||||
<div
|
||||
className="flex w-full select-none flex-col"
|
||||
style={{backgroundColor: template.colors.bg}}
|
||||
>
|
||||
<div className="mx-auto flex w-full max-w-[1120px] items-center justify-between border-b border-stone-200/60 bg-white/90 px-4 py-4 backdrop-blur-xs sm:px-6">
|
||||
<span
|
||||
className="serif-title text-base font-bold uppercase tracking-widest text-stone-800 sm:text-lg"
|
||||
style={{color: template.colors.text}}
|
||||
>
|
||||
{storeName}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="relative flex h-[50vh] w-full items-center justify-center overflow-hidden bg-stone-900 sm:h-[65vh]">
|
||||
{coverUrl && (
|
||||
<img
|
||||
src={coverUrl}
|
||||
alt={storeName}
|
||||
className="absolute inset-0 size-full object-cover opacity-75"
|
||||
/>
|
||||
)}
|
||||
<div className="absolute inset-0 bg-black/45" />
|
||||
|
||||
<div className="relative z-10 mx-auto w-full max-w-xl space-y-4 px-6 text-center text-white">
|
||||
<h1 className="serif-title text-2xl font-bold leading-tight tracking-tight drop-shadow-xs sm:text-4xl md:text-5xl">
|
||||
{storeName}
|
||||
</h1>
|
||||
|
||||
<p className="text-xs font-light tracking-wide text-stone-200 sm:text-sm md:text-base">
|
||||
{section.description || location}
|
||||
</p>
|
||||
|
||||
<div className="flex items-center justify-center gap-2 pt-2">
|
||||
<CtaLink
|
||||
href={bookingHref(industryId, storeName)}
|
||||
variant="pill"
|
||||
colors={template.colors}
|
||||
>
|
||||
<Calendar className="size-3.5" />
|
||||
<span>예약 안내</span>
|
||||
</CtaLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/**
|
||||
* 히어로 · 풀블리드 — 화면을 꽉 채운 사진 위에 왼쪽 아래로 붙는 큰 타이포.
|
||||
* 사진 한 장의 힘이 강한 곳(뷰 좋은 스테이, 플레이팅이 강한 다이닝)에 맞는다.
|
||||
*/
|
||||
import {Calendar, MapPin} from 'lucide-react';
|
||||
import {CtaLink, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {bookingHref, primaryPhoto} from '../common';
|
||||
|
||||
export function HeroFullBleed(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, location, template, photos} = props;
|
||||
const cover = primaryPhoto(photos);
|
||||
// 사진이 없으면 <img> 를 아예 렌더하지 않고 어두운 배경만 남긴다.
|
||||
const coverUrl = cover?.url;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} padded={false}>
|
||||
<div className="relative h-[62vh] min-h-[380px] w-full select-none overflow-hidden bg-stone-900 sm:h-[78vh]">
|
||||
{coverUrl && (
|
||||
<img
|
||||
src={coverUrl}
|
||||
alt={storeName}
|
||||
className="absolute inset-0 size-full object-cover"
|
||||
/>
|
||||
)}
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/25 to-black/10" />
|
||||
|
||||
<div className="absolute inset-x-0 bottom-0 px-6 pb-10 sm:px-10 sm:pb-14">
|
||||
<div className="mx-auto max-w-[1120px] space-y-3 text-white">
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full border border-white/25 bg-white/10 px-3 py-1 text-[11px] font-medium backdrop-blur-xs">
|
||||
<MapPin className="size-3" />
|
||||
{section.description || location}
|
||||
</span>
|
||||
|
||||
<h1 className="serif-title max-w-2xl text-3xl font-bold leading-[1.15] tracking-tight drop-shadow-sm sm:text-5xl md:text-6xl">
|
||||
{storeName}
|
||||
</h1>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2 pt-2">
|
||||
<CtaLink
|
||||
href={bookingHref(industryId, storeName)}
|
||||
variant="brand"
|
||||
colors={template.colors}
|
||||
>
|
||||
<Calendar className="size-3.5" />
|
||||
<span>지금 예약하기</span>
|
||||
</CtaLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* 히어로 · 타이포 중심 — 사진 없이 여백과 글자만.
|
||||
* 쓸 만한 사진이 아직 없거나, 조용한 인상을 주고 싶을 때 고른다.
|
||||
*/
|
||||
import {ArrowUpRight} from 'lucide-react';
|
||||
import {CtaLink, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {bookingHref, industryConfig} from '../common';
|
||||
|
||||
export function HeroTypeOnly(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, storeName, location, template} = props;
|
||||
const config = industryConfig(industryId);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} padded={false}>
|
||||
<div
|
||||
className="px-6 py-20 sm:px-10 sm:py-28"
|
||||
style={{backgroundColor: template.colors.bg}}
|
||||
>
|
||||
<div className="mx-auto max-w-2xl space-y-6 text-center">
|
||||
<span
|
||||
className="text-[11px] font-semibold uppercase tracking-[0.35em]"
|
||||
style={{color: template.colors.accent}}
|
||||
>
|
||||
{section.description || `${config.name} · ${location}`}
|
||||
</span>
|
||||
|
||||
<h1
|
||||
className="serif-title text-3xl font-bold leading-[1.2] tracking-tight sm:text-5xl"
|
||||
style={{color: template.colors.text}}
|
||||
>
|
||||
{storeName}
|
||||
</h1>
|
||||
|
||||
<div className="mx-auto h-px w-12" style={{backgroundColor: template.colors.primary}} />
|
||||
|
||||
<div className="flex justify-center pt-2">
|
||||
<CtaLink href={bookingHref(industryId, storeName)} variant="outline">
|
||||
<span>{storeName} 둘러보기</span>
|
||||
<ArrowUpRight className="size-3.5" />
|
||||
</CtaLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
* ★ 질감(도넛판 홈·톱니·펀치 구멍)은 남긴다 — 그건 색이 아니라 물건의 생김새다.
|
||||
* 질감의 색도 토큰을 따라가게 `items.css` 에서 var() 로 받는다.
|
||||
*/
|
||||
import {useCallback, useRef} from 'react';
|
||||
import {ChevronLeft, ChevronRight, MousePointerClick} from 'lucide-react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import type {DataSource, DataVerified} from '@o2o/shared';
|
||||
@@ -102,17 +101,12 @@ export function SourceLine({
|
||||
);
|
||||
}
|
||||
|
||||
/** 가로 스크롤 + 화살표. 스크롤 컨테이너를 ref 로 잡아 한 화면의 80%씩 민다. */
|
||||
export function useCarousel<T extends HTMLElement>() {
|
||||
const ref = useRef<T>(null);
|
||||
const scrollBy = useCallback((dir: -1 | 1) => {
|
||||
const box = ref.current;
|
||||
if (!box) return;
|
||||
box.scrollBy({left: box.clientWidth * 0.8 * dir, behavior: 'smooth'});
|
||||
}, []);
|
||||
return {ref, scrollBy};
|
||||
}
|
||||
|
||||
/**
|
||||
* 앞뒤 버튼 한 쌍.
|
||||
*
|
||||
* ★ 가로 슬라이더에는 쓰지 않는다 — 그건 `Rail`(embla)이 자기 화살표를 갖는다.
|
||||
* 여기 남은 쓰임은 **스크롤이 아닌 이동**이다(일력: 장을 넘겨 오늘 자리를 바꾼다).
|
||||
*/
|
||||
export function CarouselNav({
|
||||
onPrev,
|
||||
onNext,
|
||||
|
||||
@@ -91,12 +91,30 @@
|
||||
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 {
|
||||
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* 추천 일정 — 캔버스. 승차권 한 장이 정거장 하나다.
|
||||
*
|
||||
* ★ 셋을 합친 자리다(반나절 산책 · 여행 스케줄 · 계절별 추천 하루). 축이 계절이 아니라 **기간**이다.
|
||||
* ★ 순위를 매기지 않는다 — 어느 일정이 1위인지는 우리가 정할 일이 아니다.
|
||||
* ★ 시각은 사장님이 적는 게 아니라 **계산한다**. 출발 시각 + 이동 + 머무는 시간.
|
||||
* 출발을 당기면 하루가 통째로 밀린다.
|
||||
*/
|
||||
import {
|
||||
currentSeasons,
|
||||
inSeason,
|
||||
itineraryDays,
|
||||
itineraryDurations,
|
||||
parseSectionData,
|
||||
type ItineraryItem,
|
||||
type PlannedStop,
|
||||
} from '@o2o/shared';
|
||||
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 live = currentSeasons();
|
||||
const durations = itineraryDurations(parsed.items);
|
||||
const groups: (string | undefined)[] =
|
||||
durations.length > 0
|
||||
? [...durations, ...(parsed.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} />
|
||||
) : parsed.items.length === 0 ? (
|
||||
<PasteHint label="추천 일정" />
|
||||
) : (
|
||||
<div className="space-y-7">
|
||||
{groups.map((duration) => {
|
||||
const items = parsed.items.filter((item) =>
|
||||
duration === undefined
|
||||
? !item.duration?.trim()
|
||||
: item.duration?.trim() === duration,
|
||||
);
|
||||
if (items.length === 0) return null;
|
||||
return (
|
||||
<div key={duration ?? 'etc'} className="space-y-4">
|
||||
{duration && (
|
||||
<h3 className="text-lg" style={{fontFamily: ITEM_HEADING}}>
|
||||
{duration}
|
||||
</h3>
|
||||
)}
|
||||
{items.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">
|
||||
{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>
|
||||
);
|
||||
}
|
||||
-149
@@ -1,149 +0,0 @@
|
||||
/**
|
||||
* 문학 서가 — 책등 캐러셀 + 세로쓰기 펼침면.
|
||||
*
|
||||
* 책등이 가로로 흐르고, 하나를 고르면 그 책만 앞으로 나와 펼쳐진다.
|
||||
* 펼친 면의 제목은 **세로쓰기**다 — 원문을 못 싣는 대신(DB_Guide: 원문 전재 금지)
|
||||
* 활자의 결로 문학을 느끼게 하는 자리다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type LiteratureItem} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ITEM_INVERSE_INK,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
useCarousel,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
/** 책등 색을 안 줬을 때. 템플릿 강조색으로 떨어뜨린다 — 색을 박으면 팔레트를 바꿔도 서가만 남는다. */
|
||||
const FALLBACK_SPINE = ITEM_ACCENT;
|
||||
|
||||
export function LiteratureShelf(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<LiteratureItem>(section.type, section.data);
|
||||
const [opened, setOpened] = useState(0);
|
||||
const {ref, scrollBy} = useCarousel<HTMLDivElement>();
|
||||
|
||||
// 항목이 줄어 인덱스가 범위를 벗어나도 첫 책으로 떨어진다 — 빈 화면을 만들지 않는다.
|
||||
const current = parsed.items[opened] ?? parsed.items[0];
|
||||
|
||||
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} />
|
||||
) : !current ? (
|
||||
<PasteHint label="문학 서가" />
|
||||
) : (
|
||||
<div className="space-y-5">
|
||||
{/* 서가 — 아래 선반이 있어야 책이 '꽂혀 있다'로 읽힌다 */}
|
||||
<div className="space-y-2">
|
||||
<div
|
||||
ref={ref}
|
||||
className="w4-scroll flex items-end gap-1.5 overflow-x-auto border-b-4 px-2 pt-4"
|
||||
// 선반 널. 글자색을 섞어 만들면 어떤 팔레트에서도 '받치는 판'으로 읽힌다.
|
||||
style={{borderColor: 'color-mix(in oklab, currentColor 45%, transparent)'}}
|
||||
>
|
||||
{parsed.items.map((book, index) => (
|
||||
<button
|
||||
key={`${book.workTitle}-${index}`}
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setOpened(index);
|
||||
}}
|
||||
aria-current={index === opened}
|
||||
className="h-[184px] w-[40px] shrink-0 snap-center px-1 py-3 text-center transition-all"
|
||||
style={{
|
||||
backgroundColor: book.spineColor || FALLBACK_SPINE,
|
||||
// 책등 색은 사장님이 정하므로 그 위 글자는 밝은 면 색으로 고정한다.
|
||||
color: ITEM_INVERSE_INK,
|
||||
// 고른 책만 한 칸 튀어나온다 — 뽑아 든 자리
|
||||
transform: index === opened ? 'translateY(-12px)' : undefined,
|
||||
boxShadow: index === opened ? '0 6px 14px rgba(27,26,21,.35)' : undefined,
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className="mx-auto block h-full overflow-hidden text-[13px] leading-tight"
|
||||
style={{fontFamily: ITEM_BODY, writingMode: 'vertical-rl'}}
|
||||
>
|
||||
{book.workTitle}
|
||||
{book.author ? ` · ${book.author}` : ''}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{parsed.items.length > 6 && (
|
||||
<CarouselNav onPrev={() => scrollBy(-1)} onNext={() => scrollBy(1)} label="책" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 펼친 면 */}
|
||||
<div
|
||||
className="w4-paper grid gap-5 border p-5 sm:p-6 md:grid-cols-[auto_minmax(0,1fr)]"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<p
|
||||
className="mx-auto h-fit w-fit max-h-[240px] overflow-hidden border-r pr-4 leading-tight md:mx-0"
|
||||
style={{
|
||||
fontFamily: ITEM_HEADING,
|
||||
fontSize: 30,
|
||||
writingMode: 'vertical-rl',
|
||||
borderColor: ITEM_BORDER,
|
||||
}}
|
||||
>
|
||||
{current.workTitle}
|
||||
</p>
|
||||
|
||||
<div className="min-w-0 space-y-3">
|
||||
<p className="text-xs opacity-60">
|
||||
{[current.author, current.year, current.genre].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
{current.background && (
|
||||
<p
|
||||
className="text-sm leading-relaxed opacity-85"
|
||||
style={{fontFamily: ITEM_BODY}}
|
||||
>
|
||||
{current.background}
|
||||
</p>
|
||||
)}
|
||||
{current.whyHere && (
|
||||
<p
|
||||
className="border-l-2 pl-3 text-sm leading-relaxed opacity-75"
|
||||
style={{fontFamily: ITEM_BODY, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{current.whyHere}
|
||||
</p>
|
||||
)}
|
||||
<span className="inline-block border border-dashed px-2 py-1 text-[10px] opacity-60" style={{borderColor: ITEM_BORDER}}>
|
||||
◎ 원문 대신 배경 — 작품 문장은 싣지 않습니다
|
||||
</span>
|
||||
<SourceLine source={current.source} verified={current.verified} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
|
||||
/** "실시간 업데이트: 오후 4:41:56" 표시. 1초마다 갱신된다. */
|
||||
export function LiveClock() {
|
||||
const [clock, setClock] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
const update = () => {
|
||||
const now = new Date();
|
||||
const period = now.getHours() >= 12 ? '오후' : '오전';
|
||||
const hours = now.getHours() % 12 || 12;
|
||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
||||
setClock(`${period} ${hours}:${minutes}:${seconds}`);
|
||||
};
|
||||
update();
|
||||
const timer = setInterval(update, 1000);
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<span className="flex items-center gap-1.5 rounded-full border border-stone-200/80 bg-white px-2.5 py-1 text-[11px] text-stone-500 shadow-2xs">
|
||||
<span className="size-1.5 animate-pulse rounded-full bg-emerald-500" />
|
||||
<span>실시간 업데이트: {clock}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 지역 가이드 · 카테고리 한 묶음 — 제목(아이콘) → 도보 시간 필터 → 카드 캐러셀.
|
||||
*
|
||||
* 맛집·명소·축제가 전부 이 모양이다. 필터 상태는 묶음마다 따로 든다 —
|
||||
* 맛집을 "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,
|
||||
}: {
|
||||
icon: LucideIcon;
|
||||
title: string;
|
||||
cards: GuideCard[];
|
||||
emptyText: string;
|
||||
colors: TemplateItem['colors'];
|
||||
renderLeading?: (card: GuideCard) => ReactNode;
|
||||
}) {
|
||||
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} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* 지역 가이드 · 요약 — 날씨 한 줄과 추천 6곳만.
|
||||
* 지역 정보가 주인공이 아닌 사이트에서 "있긴 하다" 정도로 둘 때.
|
||||
*/
|
||||
import {
|
||||
EmptyStateNotice,
|
||||
ListCard,
|
||||
PlaceRow,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
|
||||
const naverSearch = (q: string) =>
|
||||
`https://search.naver.com/search.naver?query=${encodeURIComponent(q)}`;
|
||||
|
||||
export function LocalCompact(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, location, template} = props;
|
||||
|
||||
// 맛집·명소를 섞어 딱 6개만. 목록이 길어지면 요약이 아니게 된다.
|
||||
// ★ 지역 정보는 서버(local.local_contents)가 소유하고 캔버스 계약(SectionRenderProps)에 없다.
|
||||
// 시연용 목록(제주 애월)으로 자리를 메우지 않는다 — 남의 동네 맛집이 사장님 사이트에 붙는다.
|
||||
const picks: {name: string; meta: string; description: string; q: string}[] = [];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody width="narrow">
|
||||
<SectionHeading variant="minimal" title="주변 안내" colors={template.colors} />
|
||||
{picks.length === 0 ? (
|
||||
<EmptyStateNotice>주변 추천은 아직 준비 중입니다.</EmptyStateNotice>
|
||||
) : (
|
||||
<ListCard>
|
||||
{picks.map((p) => (
|
||||
<PlaceRow
|
||||
key={p.name}
|
||||
name={p.name}
|
||||
meta={p.meta}
|
||||
description={p.description}
|
||||
href={naverSearch(p.q)}
|
||||
actionLabel="보기"
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</ListCard>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
/**
|
||||
* 지역 가이드 · 전체 — 날씨 카드 + 맛집 + 명소 + 월별 축제를 세로로 전부.
|
||||
* "여기 오면 근처에 뭐가 있나"를 한 화면에서 다 보여주고 싶을 때.
|
||||
*/
|
||||
import {Calendar, MapPin, Sparkles, Utensils} from 'lucide-react';
|
||||
import type {TemplateItem} from '@o2o/shared';
|
||||
import {
|
||||
EmptyStateNotice,
|
||||
ListCard,
|
||||
PlaceRow,
|
||||
Pill,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {LiveClock} from './LiveClock';
|
||||
import type {FestivalItem, NearbyPlace} from './types';
|
||||
|
||||
const naverSearch = (q: string) =>
|
||||
`https://search.naver.com/search.naver?query=${encodeURIComponent(q)}`;
|
||||
|
||||
function GroupHeading({
|
||||
icon: Icon,
|
||||
title,
|
||||
note,
|
||||
colors,
|
||||
}: {
|
||||
icon: typeof Utensils;
|
||||
title: string;
|
||||
note: string;
|
||||
colors: TemplateItem['colors'];
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-center justify-between">
|
||||
<h3
|
||||
className="serif-title flex items-center gap-2 text-base font-bold text-stone-900 sm:text-lg"
|
||||
style={{color: colors.text}}
|
||||
>
|
||||
<Icon className="size-4 text-stone-600" style={{color: colors.primary}} />
|
||||
<span>{title}</span>
|
||||
</h3>
|
||||
{/* 오른쪽 출처 문구는 부가 정보라 중립 회색 그대로 둔다. */}
|
||||
<span className="text-[11px] text-stone-400">{note}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function LocalFull(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, location, template} = props;
|
||||
const isStay = industryId === 'stay';
|
||||
const locName = location.split(' ')[0] || '주변';
|
||||
// ★ 맛집·명소·축제는 전부 제주 애월 시연용 목록이다 — 실사업장은 빈 목록으로 떨어진다.
|
||||
// (지역 큐레이션을 읽어올 백엔드 창구가 아직 없어 당분간 계속 빈다.)
|
||||
// 지역 정보는 서버(local.local_contents)가 소유하고 캔버스 계약에 없다 — 시연용 목록을 깔지 않는다.
|
||||
const foods: NearbyPlace[] = [];
|
||||
const spots: NearbyPlace[] = [];
|
||||
const festivals: FestivalItem[] = [];
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody className="space-y-8">
|
||||
<SectionHeading
|
||||
variant="eyebrow"
|
||||
eyebrow="AI Local Guide"
|
||||
title={`AI ${locName} 실시간 가이드`}
|
||||
subtitle="실시간 날씨와 인근 미식·명소·축제를 AI가 큐레이션합니다"
|
||||
trailing={<LiveClock />}
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="space-y-3.5">
|
||||
<GroupHeading
|
||||
icon={Utensils}
|
||||
title="숙소 인근 엄선 맛집 & 카페"
|
||||
note="호스트 & 네이버 플레이스 연동"
|
||||
colors={template.colors}
|
||||
/>
|
||||
{foods.length === 0 ? (
|
||||
<EmptyStateNotice>주변 맛집·카페 추천은 아직 준비 중입니다.</EmptyStateNotice>
|
||||
) : (
|
||||
<ListCard>
|
||||
{foods.map((place) => (
|
||||
<PlaceRow
|
||||
key={place.name}
|
||||
name={place.name}
|
||||
meta={place.distance}
|
||||
description={place.description}
|
||||
href={naverSearch(place.searchQuery)}
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</ListCard>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="space-y-3.5">
|
||||
<GroupHeading
|
||||
icon={MapPin}
|
||||
title="주변 힐링 명소 & 해변"
|
||||
note="차량 5~20분 거리"
|
||||
colors={template.colors}
|
||||
/>
|
||||
{spots.length === 0 ? (
|
||||
<EmptyStateNotice>주변 명소 추천은 아직 준비 중입니다.</EmptyStateNotice>
|
||||
) : (
|
||||
<ListCard>
|
||||
{spots.map((spot) => (
|
||||
<PlaceRow
|
||||
key={spot.name}
|
||||
name={spot.name}
|
||||
meta={spot.duration}
|
||||
description={spot.description}
|
||||
href={naverSearch(spot.searchQuery)}
|
||||
actionLabel="상세정보"
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</ListCard>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isStay && (
|
||||
<div className="space-y-3.5">
|
||||
<GroupHeading
|
||||
icon={Calendar}
|
||||
title="월별 축제 & 문화 행사"
|
||||
note="사계절 캘린더"
|
||||
colors={template.colors}
|
||||
/>
|
||||
{festivals.length === 0 ? (
|
||||
<EmptyStateNotice>월별 축제 안내는 아직 준비 중입니다.</EmptyStateNotice>
|
||||
) : (
|
||||
<ListCard>
|
||||
{festivals.map((fest) => (
|
||||
<PlaceRow
|
||||
key={fest.name}
|
||||
name={fest.name}
|
||||
description={fest.description || fest.period}
|
||||
href={naverSearch(fest.searchQuery)}
|
||||
actionLabel="검색"
|
||||
leading={
|
||||
<>
|
||||
<Pill tone="accent">{fest.month}</Pill>
|
||||
{fest.isFeatured && (
|
||||
<Pill tone="good">
|
||||
<Sparkles className="size-2.5" />
|
||||
대표축제
|
||||
</Pill>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</ListCard>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* 지역 가이드 — 맛집 · 명소 · 축제를 카테고리별 "도보 시간 필터 + 카드 캐러셀"로 세로 나열.
|
||||
*
|
||||
* ★ 2026-09-07 결정으로 전체/탭/요약 세 배리에이션을 이 하나로 통일했다.
|
||||
* 데이터가 이미 카테고리별로 나뉘어 있어 "탭으로 갈아끼우기"라는 구분이 캐러셀 구조에서는
|
||||
* 의미가 없어졌고, 요약(6곳)은 필터가 그 역할을 대신한다.
|
||||
* ★ 값은 서버(local.place_contents)가 소유한다 — 업장 좌표 반경으로 받은 것만 그린다.
|
||||
* 시연용 목록으로 자리를 메우지 않는다(남의 동네 맛집이 사장님 사이트에 붙는다).
|
||||
*/
|
||||
import {Calendar, MapPin, Utensils} from 'lucide-react';
|
||||
import {useLocalGuide} from '@/hooks/useLocalGuide';
|
||||
import {Pill, SectionBody, SectionFrame, SectionHeading} 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}
|
||||
/>
|
||||
|
||||
<LocalCategorySection
|
||||
icon={Utensils}
|
||||
title="주변 맛집"
|
||||
cards={foods}
|
||||
emptyText="주변 맛집·카페 추천은 아직 준비 중입니다."
|
||||
colors={colors}
|
||||
/>
|
||||
|
||||
<LocalCategorySection
|
||||
icon={MapPin}
|
||||
title="주변 명소"
|
||||
cards={spots}
|
||||
emptyText="주변 명소 추천은 아직 준비 중입니다."
|
||||
colors={colors}
|
||||
/>
|
||||
|
||||
{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,124 +0,0 @@
|
||||
/**
|
||||
* 지역 가이드 · 탭 — 맛집/명소/축제를 탭으로 갈아 끼운다.
|
||||
* 목록이 길어 스크롤이 부담스러울 때 화면 길이를 1/3 로 줄인다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {Calendar, MapPin, Utensils} from 'lucide-react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {
|
||||
EmptyStateNotice,
|
||||
ListCard,
|
||||
Pill,
|
||||
PlaceRow,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import type {FestivalItem, NearbyPlace} from './types';
|
||||
|
||||
const naverSearch = (q: string) =>
|
||||
`https://search.naver.com/search.naver?query=${encodeURIComponent(q)}`;
|
||||
|
||||
type TabKey = 'food' | 'spots' | 'festivals';
|
||||
|
||||
const TABS: {key: TabKey; label: string; icon: typeof Utensils}[] = [
|
||||
{key: 'food', label: '맛집 · 카페', icon: Utensils},
|
||||
{key: 'spots', label: '명소', icon: MapPin},
|
||||
{key: 'festivals', label: '축제', icon: Calendar},
|
||||
];
|
||||
|
||||
export function LocalTabs(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, industryId, location, template} = props;
|
||||
const [tab, setTab] = useState<TabKey>('food');
|
||||
const isStay = industryId === 'stay';
|
||||
const tabs = isStay ? TABS : TABS.filter((t) => t.key !== 'festivals');
|
||||
const locName = location.split(' ')[0] || '주변';
|
||||
// ★ 세 탭 모두 제주 애월 시연용 목록이다 — 실사업장은 빈 목록으로 떨어진다.
|
||||
// 지역 정보는 서버(local.local_contents)가 소유하고 캔버스 계약에 없다 — 시연용 목록을 깔지 않는다.
|
||||
const foods: NearbyPlace[] = [];
|
||||
const spots: NearbyPlace[] = [];
|
||||
const festivals: FestivalItem[] = [];
|
||||
// 탭을 눌렀는데 아무것도 없으면 섹션이 사라진 것처럼 보인다 — 자리는 지키고 상태만 알린다.
|
||||
const isEmpty = (tab === 'food' ? foods : tab === 'spots' ? spots : festivals).length === 0;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
variant="eyebrow"
|
||||
eyebrow="AI Local Guide"
|
||||
title={`AI ${locName} 실시간 가이드`}
|
||||
subtitle="탭을 눌러 원하는 정보만 보세요"
|
||||
colors={template.colors}
|
||||
/>
|
||||
|
||||
<div className="flex items-center gap-1 rounded-xl border border-stone-200/80 bg-white p-1">
|
||||
{tabs.map(({key, label, icon: Icon}) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setTab(key);
|
||||
}}
|
||||
aria-pressed={tab === key}
|
||||
style={tab === key ? {backgroundColor: template.colors.primary} : undefined}
|
||||
className={cn(
|
||||
'flex flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-lg py-2 text-xs font-semibold transition-colors',
|
||||
tab === key ? 'text-white' : 'text-stone-500 hover:bg-stone-100',
|
||||
)}
|
||||
>
|
||||
<Icon className="size-3.5" />
|
||||
<span>{label}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{isEmpty ? (
|
||||
<EmptyStateNotice>주변 정보는 아직 준비 중입니다.</EmptyStateNotice>
|
||||
) : (
|
||||
<ListCard>
|
||||
{tab === 'food' &&
|
||||
foods.map((place) => (
|
||||
<PlaceRow
|
||||
key={place.name}
|
||||
name={place.name}
|
||||
meta={place.distance}
|
||||
description={place.description}
|
||||
href={naverSearch(place.searchQuery)}
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
|
||||
{tab === 'spots' &&
|
||||
spots.map((spot) => (
|
||||
<PlaceRow
|
||||
key={spot.name}
|
||||
name={spot.name}
|
||||
meta={spot.duration}
|
||||
description={spot.description}
|
||||
href={naverSearch(spot.searchQuery)}
|
||||
actionLabel="상세정보"
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
|
||||
{tab === 'festivals' &&
|
||||
festivals.map((fest) => (
|
||||
<PlaceRow
|
||||
key={fest.name}
|
||||
name={fest.name}
|
||||
description={fest.description || fest.period}
|
||||
href={naverSearch(fest.searchQuery)}
|
||||
actionLabel="검색"
|
||||
leading={<Pill tone="accent">{fest.month}</Pill>}
|
||||
colors={template.colors}
|
||||
/>
|
||||
))}
|
||||
</ListCard>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,32 +1,26 @@
|
||||
/**
|
||||
* 지역 정보 항목의 모양.
|
||||
* 지역 가이드 카드 한 장의 모양(맛집·명소·축제 공통).
|
||||
*
|
||||
* ★ 원래 이 타입들은 시연용 데이터 파일(data/stayData.ts)이 소유했다. 그 파일을 지우면서
|
||||
* 실제로 쓰는 쪽인 여기로 옮겼다 — 타입이 데이터 시드에 매여 있을 이유가 없다.
|
||||
*
|
||||
* ★ 값은 서버(local.local_contents)가 소유한다. 지금은 캔버스 계약(SectionRenderProps)에
|
||||
* 지역 정보가 없어서 배리에이션들이 빈 목록을 그린다. 흘려보낼 창구가 생기면
|
||||
* 이 모양에 맞춰 매핑하면 된다.
|
||||
* ★ 값은 서버(local.place_contents)가 소유한다. hooks/useLocalGuide 가 GET /v1/local/guide
|
||||
* 응답(발행 payload 와 같은 모양)을 이 타입으로 매핑한다.
|
||||
* ★ 도보 시간 배지·필터는 distanceMeters 로 계산한다(walking.ts::walkMinutes, 분속 80m).
|
||||
* distanceMeters 가 없으면(지역 캐시에서 온 수기 항목 등) 배지·필터 대상에서 빠진다 —
|
||||
* 업장 기준 거리를 모르는 값으로 "도보 N분"을 지어내지 않는다.
|
||||
*/
|
||||
export interface NearbyPlace {
|
||||
export interface GuideCard {
|
||||
name: string;
|
||||
category: string;
|
||||
/** 거리 표기("차로 5분", "1.2km") — 원문 그대로 옮긴다. */
|
||||
distance: string;
|
||||
duration: string;
|
||||
description: string;
|
||||
/** 상세 페이지 대신 검색으로 보낸다 — 없는 주소를 지어내지 않기 위해서다. */
|
||||
searchQuery: string;
|
||||
tag: string;
|
||||
imageUrl?: string;
|
||||
distanceMeters?: number;
|
||||
/** 화면 배지에 그대로 쓰는 거리 문자열("850m"/"1.2km"). */
|
||||
distanceText?: string;
|
||||
}
|
||||
|
||||
export interface FestivalItem {
|
||||
/** 축제는 기간·월 배지가 더 붙는다. */
|
||||
export interface FestivalCard extends GuideCard {
|
||||
month: string;
|
||||
name: string;
|
||||
period: string;
|
||||
location: string;
|
||||
description: string;
|
||||
isFeatured?: boolean;
|
||||
officialUrl?: string;
|
||||
searchQuery: string;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 도보 시간 환산 — 직선거리(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;
|
||||
}
|
||||
@@ -8,11 +8,10 @@
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type PeopleItem} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_HEADING,
|
||||
@@ -20,7 +19,6 @@ import {
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
useCarousel,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
@@ -33,7 +31,6 @@ export function PeopleFilmstrip(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<PeopleItem>(section.type, section.data);
|
||||
const [picked, setPicked] = useState(0);
|
||||
const {ref, scrollBy} = useCarousel<HTMLDivElement>();
|
||||
|
||||
// 항목이 줄어 인덱스가 범위를 벗어나도 첫 사람으로 떨어진다 — 빈 화면을 만들지 않는다.
|
||||
const current = parsed.items[picked] ?? parsed.items[0];
|
||||
@@ -70,10 +67,7 @@ export function PeopleFilmstrip(props: SectionRenderProps) {
|
||||
}}
|
||||
>
|
||||
<div className="w4-film-perf h-2.5 opacity-70" />
|
||||
<div
|
||||
ref={ref}
|
||||
className="w4-scroll flex snap-x snap-mandatory gap-3 overflow-x-auto px-3 py-3"
|
||||
>
|
||||
<Rail label="인물" tone="dark" nav="overlay" gap={0.75} viewportClassName="px-3 py-3">
|
||||
{parsed.items.map((person, index) => (
|
||||
<button
|
||||
key={`${person.name}-${index}`}
|
||||
@@ -110,14 +104,10 @@ export function PeopleFilmstrip(props: SectionRenderProps) {
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</Rail>
|
||||
<div className="w4-film-perf h-2.5 opacity-70" />
|
||||
</div>
|
||||
|
||||
{parsed.items.length > 4 && (
|
||||
<CarouselNav onPrev={() => scrollBy(-1)} onNext={() => scrollBy(1)} tone="dark" label="인물" />
|
||||
)}
|
||||
|
||||
{/* 고른 프레임의 자막 — 프레임 안에 넣으면 이름조차 안 읽힌다 */}
|
||||
<div className="space-y-2 border-l-2 pl-4" style={{borderColor: ITEM_ACCENT}}>
|
||||
<h3 className="text-xl" style={{fontFamily: ITEM_HEADING}}>
|
||||
|
||||
@@ -6,6 +6,7 @@ import {useState} from 'react';
|
||||
import {
|
||||
Lightbox,
|
||||
PhotoTile,
|
||||
Rail,
|
||||
SectionBody,
|
||||
SectionFrame,
|
||||
SectionHeading,
|
||||
@@ -23,27 +24,19 @@ export function PhotosCarousel(props: SectionRenderProps) {
|
||||
<SectionBody width="wide">
|
||||
<SectionHeading title={section.name} subtitle={section.description} colors={template.colors} />
|
||||
|
||||
<div className="scrollbar-none flex snap-x snap-mandatory gap-3 overflow-x-auto px-1 pb-3">
|
||||
{/* ★ 예전엔 점이 그려져 있기만 하고 아무것도 가리키지 않았다(전부 같은 색·클릭 불가).
|
||||
지금 몇 번째인지는 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 snap-center"
|
||||
className="w-[78vw] max-w-[420px] shrink-0"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-center gap-1.5">
|
||||
{items.map((photo) => (
|
||||
<span
|
||||
key={photo.id}
|
||||
className="size-1.5 rounded-full"
|
||||
style={{backgroundColor: `${template.colors.primary}40`}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</Rail>
|
||||
</SectionBody>
|
||||
|
||||
<Lightbox photos={items} index={openIndex} onClose={() => setOpenIndex(null)} onMove={setOpenIndex} />
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
/**
|
||||
* 계절별 추천 하루 — 계절 탭 + 순위 카드.
|
||||
*
|
||||
* ★ 여행 스케줄(schedule)과 축이 다르다. 저쪽은 사장님이 시각을 적어 둔 시간표고,
|
||||
* 여기는 **시각을 계산해 준다** — 사장님은 "몇 분 걸리나"만 적고, 출발 시각을 바꾸면 하루가 밀린다.
|
||||
* 조립 규칙은 `@o2o/shared` 의 planDay 한 벌이다(빌더와 발행본이 같은 시각을 내야 한다).
|
||||
* ★ 순위는 셋에서 끊는다. 넷째부터는 추천이 아니라 목록이 된다.
|
||||
* ★ 손님 화면에는 **지금 계절만** 나간다(간절기에는 둘). 여기 탭은 사장님이 나머지 계절을
|
||||
* 확인하려고 있는 것이라, 처음 열면 지금 계절에 맞춰 두고 그 사실을 아래에 적어 둔다 —
|
||||
* 안 적으면 사장님은 손님도 네 계절을 다 본다고 오해한다.
|
||||
*/
|
||||
import {useMemo, useState} from 'react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {
|
||||
currentSeasons,
|
||||
parseSectionData,
|
||||
planDay,
|
||||
plannerSeasons,
|
||||
plannerTop,
|
||||
type PlannerItem,
|
||||
} from '@o2o/shared';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ITEM_INK,
|
||||
ITEM_INVERSE_INK,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
const RANK_LABEL = ['1위', '2위', '3위'];
|
||||
|
||||
/** 총 소요를 "7시간 10분"으로. 분만 쓰면 430분이 얼마인지 아무도 모른다. */
|
||||
function spanText(minutes: number): string {
|
||||
const hour = Math.floor(minutes / 60);
|
||||
const rest = minutes % 60;
|
||||
return [hour > 0 ? `${hour}시간` : '', rest > 0 ? `${rest}분` : ''].filter(Boolean).join(' ') || '0분';
|
||||
}
|
||||
|
||||
function PlanCard({item, rank}: {item: PlannerItem; rank: number}) {
|
||||
const day = planDay(item);
|
||||
|
||||
return (
|
||||
<article
|
||||
className="w4-paper w-[320px] shrink-0 snap-center border shadow-[4px_4px_0_rgba(0,0,0,.08)]"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<div
|
||||
className="flex items-center justify-between gap-2 border-b px-4 py-2.5"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{/* ★ 1위만 채운다. 셋 다 채우면 순위가 안 읽히고, 채움색을 강조색으로 두면
|
||||
팔레트에 따라 글자가 안 보인다(연한 accent 위의 밝은 글자) — 글자색으로 채운다. */}
|
||||
<span
|
||||
className="border px-2 py-0.5 text-[11px] font-bold"
|
||||
style={
|
||||
rank === 0
|
||||
? {backgroundColor: ITEM_INK, color: ITEM_INVERSE_INK, borderColor: ITEM_INK}
|
||||
: {borderColor: ITEM_BORDER}
|
||||
}
|
||||
>
|
||||
{RANK_LABEL[rank] ?? `${rank + 1}위`}
|
||||
</span>
|
||||
<span className="text-[11px] opacity-60">
|
||||
{day.from}–{day.to} · {spanText(day.totalMinutes)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 px-4 pt-3.5">
|
||||
<h4 className="text-lg" style={{fontFamily: ITEM_HEADING}}>
|
||||
{item.name}
|
||||
</h4>
|
||||
{item.audience && <p className="text-[11px] opacity-60">{item.audience}</p>}
|
||||
{item.why && (
|
||||
<p className="text-[13px] leading-relaxed opacity-80" style={{fontFamily: ITEM_BODY}}>
|
||||
{item.why}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{day.stops.length === 0 ? (
|
||||
<p className="px-4 py-5 text-center text-[11px] opacity-60">
|
||||
정거장이 아직 없습니다. JSON 의 stops 배열을 채워 주세요.
|
||||
</p>
|
||||
) : (
|
||||
<ol className="mt-3 px-4 pb-3">
|
||||
{day.stops.map((planned, index) => (
|
||||
<li key={`${planned.stop.name}-${index}`} className="grid grid-cols-[46px_minmax(0,1fr)] gap-2.5">
|
||||
{/* 시각 열 — 왼쪽에 붙어 정렬돼야 '시간표'로 읽힌다 */}
|
||||
<span className="pt-2 text-[12px] tabular-nums opacity-75" style={{fontFamily: ITEM_HEADING}}>
|
||||
{planned.time}
|
||||
</span>
|
||||
<div className="border-l pb-2 pl-3" style={{borderColor: ITEM_BORDER}}>
|
||||
{planned.move > 0 && (
|
||||
<p className="pt-1 text-[10px] opacity-50">↓ {planned.move}분 이동</p>
|
||||
)}
|
||||
<p className="pt-1 text-sm font-bold" style={{fontFamily: ITEM_BODY}}>
|
||||
{planned.stop.name}
|
||||
</p>
|
||||
{planned.stop.note && (
|
||||
<p className="mt-0.5 text-[12px] leading-relaxed opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{planned.stop.note}
|
||||
</p>
|
||||
)}
|
||||
<p className="mt-0.5 text-[10px] opacity-50">
|
||||
{planned.time}–{planned.until}
|
||||
{planned.stop.searchQuery && ` · 지도 검색 ${planned.stop.searchQuery}`}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
)}
|
||||
|
||||
<div className="space-y-1 border-t border-dashed px-4 py-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
{/* ★ 상한에 걸려 뺀 칸을 숨기지 않는다. 숨기면 사장님은 자기가 적은 곳이 왜 없는지 모른다. */}
|
||||
{day.dropped > 0 && (
|
||||
<p className="text-[10px]" style={{color: ITEM_ACCENT}}>
|
||||
밤 9시를 넘겨 {day.dropped}곳을 뺐습니다 — 머무는 시간을 줄이거나 출발을 당겨 보세요.
|
||||
</p>
|
||||
)}
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
export function PlannerPodium(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<PlannerItem>(section.type, section.data);
|
||||
const seasons = useMemo(() => plannerSeasons(parsed.items), [parsed.items]);
|
||||
|
||||
// 지금 계절(간절기면 둘 중 앞선 것)을 처음 탭으로. 손님이 보는 것과 같은 화면에서 시작한다.
|
||||
const live = useMemo(() => currentSeasons().filter((s) => seasons.includes(s)), [seasons]);
|
||||
const [picked, setPicked] = useState<number>();
|
||||
const index = picked ?? Math.max(0, seasons.indexOf(live[0] ?? ''));
|
||||
|
||||
// 계절을 안 적었으면 탭 없이 전체에서 top3 를 뽑는다 — 빈 탭 줄을 그리지 않는다.
|
||||
const season = seasons[index] ?? seasons[0];
|
||||
const top = useMemo(() => plannerTop(parsed.items, season), [parsed.items, season]);
|
||||
|
||||
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-4">
|
||||
{seasons.length > 1 && (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{seasons.map((name, tabIndex) => (
|
||||
<button
|
||||
key={name}
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setPicked(tabIndex);
|
||||
}}
|
||||
aria-current={tabIndex === index}
|
||||
className={cn(
|
||||
'border px-3 py-1 text-xs transition-opacity',
|
||||
tabIndex !== index && 'opacity-55',
|
||||
)}
|
||||
style={
|
||||
tabIndex === index
|
||||
? {backgroundColor: ITEM_INK, color: ITEM_INVERSE_INK, borderColor: ITEM_INK}
|
||||
: {borderColor: ITEM_BORDER}
|
||||
}
|
||||
>
|
||||
{name}
|
||||
{/* 손님 화면에 지금 나가는 계절. 사장님이 '어느 게 실제로 보이나'를 눈으로 안다. */}
|
||||
{live.includes(name) && <span className="ml-1 opacity-70">·지금</span>}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="w4-scroll flex snap-x snap-mandatory items-start gap-4 overflow-x-auto pb-3">
|
||||
{top.map((item, rank) => (
|
||||
<PlanCard key={`${item.name}-${rank}`} item={item} rank={rank} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
<p className="text-[11px] opacity-60">
|
||||
시각은 출발 시각과 머무는 시간으로 계산한 것입니다 · {season ? `${season} 추천 ` : '추천 '}
|
||||
{top.length}개 / 전체 {parsed.items.length}개
|
||||
</p>
|
||||
{live.length > 0 && (
|
||||
<p className="text-[11px] opacity-60">
|
||||
손님 화면에는 지금 계절({live.join(' · ')})만 나갑니다. 간절기에는 두 계절이 함께 보입니다.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -6,11 +6,10 @@
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {Check, Copy} from 'lucide-react';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type PostcardItem} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
@@ -20,7 +19,6 @@ import {
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
useCarousel,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
@@ -98,7 +96,6 @@ function Postcard({item}: {item: PostcardItem}) {
|
||||
export function PostcardStack(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<PostcardItem>(section.type, section.data);
|
||||
const {ref, scrollBy} = useCarousel<HTMLDivElement>();
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
@@ -120,19 +117,14 @@ export function PostcardStack(props: SectionRenderProps) {
|
||||
<PasteHint label="오늘의 엽서" />
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<div ref={ref} className="w4-scroll flex snap-x snap-mandatory gap-4 overflow-x-auto pb-3">
|
||||
<Rail label="엽서">
|
||||
{parsed.items.map((item, index) => (
|
||||
<Postcard key={`${item.line}-${index}`} item={item} />
|
||||
))}
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<p className="text-[11px] opacity-60">
|
||||
[복사] 를 누르면 문장과 해시태그가 함께 복사됩니다 · 총 {parsed.items.length}장
|
||||
</p>
|
||||
{parsed.items.length > 2 && (
|
||||
<CarouselNav onPrev={() => scrollBy(-1)} onNext={() => scrollBy(1)} label="엽서" />
|
||||
)}
|
||||
</div>
|
||||
</Rail>
|
||||
<p className="text-[11px] opacity-60">
|
||||
[복사] 를 누르면 문장과 해시태그가 함께 복사됩니다 · 총 {parsed.items.length}장
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {cn} from '@/lib/utils';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type QuizItem} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
@@ -21,7 +20,6 @@ import {
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
useCarousel,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
@@ -85,7 +83,6 @@ function QuizCard({item, no}: {item: QuizItem; no: number}) {
|
||||
export function QuizFlip(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<QuizItem>(section.type, section.data);
|
||||
const {ref, scrollBy} = useCarousel<HTMLDivElement>();
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="paper">
|
||||
@@ -107,19 +104,14 @@ export function QuizFlip(props: SectionRenderProps) {
|
||||
<PasteHint label="뒤집어 보는 질문" />
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<div ref={ref} className="w4-scroll flex snap-x snap-mandatory gap-4 overflow-x-auto pb-3">
|
||||
<Rail label="질문">
|
||||
{parsed.items.map((item, index) => (
|
||||
<QuizCard key={`${item.question}-${index}`} item={item} no={index + 1} />
|
||||
))}
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<p className="text-[11px] opacity-60">
|
||||
정답은 두지 않습니다 — 힌트와 출처까지만 · 총 {parsed.items.length}문항
|
||||
</p>
|
||||
{parsed.items.length > 2 && (
|
||||
<CarouselNav onPrev={() => scrollBy(-1)} onNext={() => scrollBy(1)} label="질문" />
|
||||
)}
|
||||
</div>
|
||||
</Rail>
|
||||
<p className="text-[11px] opacity-60">
|
||||
정답은 두지 않습니다 — 힌트와 출처까지만 · 총 {parsed.items.length}문항
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* 이용 규정 · 카드 — 규정 하나에 칸 하나. 번호가 붙어 "빠뜨리지 말라"는 인상이 강하다.
|
||||
* 노쇼·소음 클레임이 잦은 곳에 맞는다.
|
||||
*/
|
||||
import {ShieldCheck} from 'lucide-react';
|
||||
import {EmptyStateNotice, SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {ruleItems} from '../common';
|
||||
|
||||
export function RulesCards(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template} = props;
|
||||
// ★ 규정을 지어내지 않는다 — 확인된 fact 에서만 만든다.
|
||||
const items = ruleItems(props.infoFields);
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="tint">
|
||||
<SectionBody>
|
||||
<SectionHeading
|
||||
variant="eyebrow"
|
||||
eyebrow="HOUSE RULES"
|
||||
title={section.name}
|
||||
subtitle="예약 전 꼭 확인해 주세요"
|
||||
trailing={<ShieldCheck className="size-5 text-stone-400" />}
|
||||
/>
|
||||
|
||||
{items.length === 0 && (
|
||||
<EmptyStateNotice>
|
||||
확인된 이용 규정이 아직 없습니다 — 정보 탭에서 확인하면 여기에 나옵니다.
|
||||
</EmptyStateNotice>
|
||||
)}
|
||||
|
||||
<ol className="grid grid-cols-1 gap-2.5 sm:grid-cols-2">
|
||||
{items.map((rule, idx) => (
|
||||
<li
|
||||
key={rule}
|
||||
className="flex items-start gap-3 rounded-xl border border-stone-200/80 bg-white p-4 shadow-2xs"
|
||||
>
|
||||
<span
|
||||
className="flex size-6 shrink-0 items-center justify-center rounded-full text-[11px] font-bold text-white"
|
||||
style={{backgroundColor: template.colors.primary}}
|
||||
>
|
||||
{idx + 1}
|
||||
</span>
|
||||
<span className="text-xs leading-relaxed text-stone-700">{rule}</span>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* 이용 규정 · 목록 — 지켜야 할 것을 한 덩어리로 짧게. 가장 눈에 덜 띄는 형태.
|
||||
*/
|
||||
import {
|
||||
SlateScriptRenderer,
|
||||
type SlateElementNode,
|
||||
type SlateTextNode,
|
||||
} from '../../SlateScriptRenderer';
|
||||
import {SectionBody, SectionFrame, SectionHeading} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {EmptyStateNotice} from '../../primitives';
|
||||
import {ruleItems} from '../common';
|
||||
|
||||
export function RulesList(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect, template} = props;
|
||||
// ★ 규정을 지어내지 않는다. 확인된 fact(체크인·체크아웃·취소규정·취사·반려동물…)에서만 만든다 —
|
||||
// 예전에는 '체크인 16:00 / 체크아웃 11:00' 같은 가공의 규정이 모든 사업장에 똑같이 떴다.
|
||||
const items = ruleItems(props.infoFields);
|
||||
const script: (SlateElementNode | SlateTextNode)[] | undefined = undefined;
|
||||
|
||||
return (
|
||||
<SectionFrame section={section} isSelected={isSelected} onSelect={onSelect} tone="white">
|
||||
<SectionBody>
|
||||
<SectionHeading title={section.name} subtitle="이용 안내 및 규정" />
|
||||
|
||||
{items.length === 0 ? (
|
||||
<EmptyStateNotice>
|
||||
확인된 이용 규정이 아직 없습니다 — 정보 탭에서 확인하면 여기에 나옵니다.
|
||||
</EmptyStateNotice>
|
||||
) : (
|
||||
<div className="space-y-2 rounded-xl border border-stone-200/80 bg-stone-50/60 p-4 text-xs shadow-2xs">
|
||||
<strong className="mb-2 block font-bold text-stone-900">투숙 및 이용 수칙</strong>
|
||||
{items.map((rule) => (
|
||||
<p key={rule} className="text-stone-600">
|
||||
• {rule}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{script && (
|
||||
<div className="space-y-3 rounded-xl border border-stone-200 bg-stone-50 p-4 sm:p-5">
|
||||
<div className="flex items-center justify-between border-b border-stone-200 pb-2">
|
||||
<span className="flex items-center gap-1.5 text-xs font-bold text-stone-800">
|
||||
<span className="size-2 rounded-full bg-stone-900" />
|
||||
호스트-게스트 실시간 문의 & 대화 가이드
|
||||
</span>
|
||||
<span className="rounded border border-stone-200 bg-white px-2 py-0.5 font-mono text-[11px] text-stone-400">
|
||||
Slate editor_script
|
||||
</span>
|
||||
</div>
|
||||
<SlateScriptRenderer nodes={script} primaryColor={template.colors.primary} />
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
-180
@@ -1,180 +0,0 @@
|
||||
/**
|
||||
* 여행 스케줄 — 대합실 시간표 캐러셀.
|
||||
*
|
||||
* 칸 하나가 시간대 하나다. 위쪽 검은 판은 역 대합실의 플립보드(가운데 접힘선)를 그대로 옮긴 것 —
|
||||
* 시각이 먼저 읽히고 무엇을 하는지가 뒤따라야 시간표로 읽힌다.
|
||||
* ★ 승차권(course)과 일부러 다르게 짰다. 저쪽은 '어디를 도는가'(순번), 여기는 '언제 무엇을'(시각)이다.
|
||||
* ★ 링크는 만들지 않는다. searchQuery 만 보여준다 — 지어낸 주소를 링크하지 않는 이 레포의 규약.
|
||||
*/
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type ScheduleItem, type ScheduleSlot} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_HEADING,
|
||||
ITEM_INK,
|
||||
ITEM_INVERSE,
|
||||
ITEM_INVERSE_INK,
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
useCarousel,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
/** "09:30" → 9시 30분. 형식이 어긋나면 원문을 그대로 보여준다(지어내지 않는다). */
|
||||
function splitTime(time: string): {head: string; tail?: string} {
|
||||
const match = /^(\d{1,2}):(\d{2})$/.exec(time.trim());
|
||||
if (!match) return {head: time.trim()};
|
||||
return {head: match[1].padStart(2, '0'), tail: match[2]};
|
||||
}
|
||||
|
||||
function Slot({slot, isLast}: {slot: ScheduleSlot; isLast: boolean}) {
|
||||
const {head, tail} = splitTime(slot.time ?? '');
|
||||
|
||||
return (
|
||||
<div className="flex shrink-0 snap-center items-stretch">
|
||||
<div
|
||||
className="w-[228px] border shadow-[4px_4px_0_rgba(27,26,21,.13)]"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
|
||||
>
|
||||
{/* 플립보드 — 가운데 접힘선이 이 판을 시계로 만든다 */}
|
||||
{/* 플립보드는 템플릿의 어두운 면이다. 위의 글자는 밝은 면 색을 그대로 쓴다. */}
|
||||
<div
|
||||
className="relative px-4 py-3 text-center"
|
||||
style={{backgroundColor: ITEM_INVERSE, color: ITEM_INVERSE_INK}}
|
||||
>
|
||||
<span
|
||||
className="inline-flex items-baseline gap-1 leading-none"
|
||||
style={{fontFamily: ITEM_HEADING, fontSize: 30}}
|
||||
>
|
||||
{head}
|
||||
{tail && <span className="opacity-60">:{tail}</span>}
|
||||
</span>
|
||||
<i
|
||||
aria-hidden
|
||||
className="pointer-events-none absolute inset-x-0 top-1/2 border-t"
|
||||
style={{borderColor: 'color-mix(in oklab, currentColor 25%, transparent)'}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 px-4 pb-3 pt-3.5">
|
||||
<h4 className="text-base font-bold" style={{fontFamily: ITEM_BODY}}>
|
||||
{slot.title}
|
||||
</h4>
|
||||
{slot.place && (
|
||||
<p className="text-[12px] font-semibold" style={{fontFamily: ITEM_BODY, color: ITEM_ACCENT}}>
|
||||
{slot.place}
|
||||
</p>
|
||||
)}
|
||||
{slot.note && (
|
||||
<p className="text-[13px] leading-relaxed opacity-75" style={{fontFamily: ITEM_BODY}}>
|
||||
{slot.note}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="flex justify-between gap-2 border-t border-dashed px-4 py-2 text-[10px] opacity-60"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<span>{slot.minutes ? `${slot.minutes}분 머묾` : '머무는 시간 미정'}</span>
|
||||
{slot.searchQuery && <span className="truncate">지도 검색 · {slot.searchQuery}</span>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 칸과 칸 사이의 시간 — 점선이 이어져야 '흐른다'로 읽힌다 */}
|
||||
{!isLast && (
|
||||
<div aria-hidden className="flex w-8 items-center justify-center">
|
||||
<i className="block h-px w-full border-t border-dashed" style={{borderColor: ITEM_BORDER}} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ScheduleRow({schedule}: {schedule: ScheduleItem}) {
|
||||
const {ref, scrollBy} = useCarousel<HTMLDivElement>();
|
||||
const slots = schedule.slots ?? [];
|
||||
const span =
|
||||
slots.length > 1 ? `${slots[0]?.time ?? ''}–${slots[slots.length - 1]?.time ?? ''}` : undefined;
|
||||
|
||||
return (
|
||||
<div className="space-y-2.5">
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-2">
|
||||
<div className="flex flex-wrap items-baseline gap-2.5">
|
||||
<h3 className="text-lg" style={{fontFamily: ITEM_HEADING}}>
|
||||
{schedule.name}
|
||||
</h3>
|
||||
<span className="text-[11px] opacity-60">
|
||||
{[schedule.audience, schedule.season, span, `${slots.length}칸`]
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
</span>
|
||||
</div>
|
||||
{slots.length > 2 && (
|
||||
<CarouselNav onPrev={() => scrollBy(-1)} onNext={() => scrollBy(1)} label={schedule.name} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{slots.length === 0 ? (
|
||||
<p
|
||||
className="border border-dashed px-4 py-5 text-center text-[11px] opacity-60"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
시간대가 아직 없습니다. JSON 의 slots 배열을 채워 주세요.
|
||||
</p>
|
||||
) : (
|
||||
<div ref={ref} className="w4-scroll flex snap-x snap-mandatory overflow-x-auto pb-3">
|
||||
{slots.map((slot, index) => (
|
||||
<Slot
|
||||
key={`${slot.time}-${slot.title}-${index}`}
|
||||
slot={slot}
|
||||
isLast={index === slots.length - 1}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<SourceLine source={schedule.source} verified={schedule.verified} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ScheduleTimetable(props: SectionRenderProps) {
|
||||
const {section, isSelected, onSelect} = props;
|
||||
const parsed = parseSectionData<ScheduleItem>(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-8">
|
||||
{parsed.items.map((schedule, index) => (
|
||||
<ScheduleRow key={`${schedule.name}-${index}`} schedule={schedule} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</SectionBody>
|
||||
</SectionFrame>
|
||||
);
|
||||
}
|
||||
@@ -5,11 +5,10 @@
|
||||
* 숨기지 않고 라벨 아래 각인으로 드러낸다 — 제약이 곧 이 아이템의 인상이다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {SectionBody, SectionFrame} from '../../primitives';
|
||||
import {Rail, SectionBody, SectionFrame} from '../../primitives';
|
||||
import type {SectionRenderProps} from '../../types';
|
||||
import {parseSectionData, type SongItem} from '@o2o/shared';
|
||||
import {
|
||||
CarouselNav,
|
||||
ITEM_ACCENT,
|
||||
ITEM_BODY,
|
||||
ITEM_HEADING,
|
||||
@@ -17,7 +16,6 @@ import {
|
||||
ParseError,
|
||||
PasteHint,
|
||||
SourceLine,
|
||||
useCarousel,
|
||||
} from '../items/common';
|
||||
import '../items/items.css';
|
||||
|
||||
@@ -28,7 +26,6 @@ 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 {ref, scrollBy} = useCarousel<HTMLDivElement>();
|
||||
|
||||
// 항목이 줄어 인덱스가 범위를 벗어나도 첫 곡으로 떨어진다 — 빈 화면을 만들지 않는다.
|
||||
const current = parsed.items[playing] ?? parsed.items[0];
|
||||
@@ -145,46 +142,36 @@ export function SongsTurntable(props: SectionRenderProps) {
|
||||
</div>
|
||||
|
||||
{/* 판 고르기 */}
|
||||
<div className="space-y-2">
|
||||
<div ref={ref} className="w4-scroll flex snap-x snap-mandatory gap-4 overflow-x-auto pb-2">
|
||||
{parsed.items.map((song, index) => (
|
||||
<button
|
||||
key={`${song.title}-${index}`}
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
setPlaying(index);
|
||||
<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,
|
||||
}}
|
||||
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>
|
||||
))}
|
||||
</div>
|
||||
{parsed.items.length > 3 && (
|
||||
<CarouselNav
|
||||
onPrev={() => scrollBy(-1)}
|
||||
onNext={() => scrollBy(1)}
|
||||
tone="dark"
|
||||
label="곡"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
/>
|
||||
<span className="mt-2 block truncate text-[10px] leading-tight opacity-55">
|
||||
{song.title}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</Rail>
|
||||
</>
|
||||
)}
|
||||
</SectionBody>
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* 영상 — 캔버스.
|
||||
*
|
||||
* ★ **캔버스에서는 재생하지 않는다.** 에디터 미리보기 안에 유튜브 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>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user