feat(supporters): 회복 일정 플래너에 한국관광공사 TourAPI 데이터 합침 + 옛 주소 리다이렉트 + 404 페이지
- src/lib/tour.ts: 사전 수집 JSON(medicalTourismKo/medicalTourism)을 추천 후보로 변환. 관광지·문화시설→관광, 쇼핑, 음식점(일반식 단계에서만), 숙박→숙소. 사우나·스파는 회복기 금지라 제외. 거리로 외출 등급(600m·3km) - 큐레이션(places.json) 1순위, TourAPI 2순위 가점. 타임라인 추천에 이동 시간 라벨과 '관광공사' 표시 - 체류 기간과 겹치는 행사 섹션(가까운 순 6곳, 자유 외출 단계 도달일 표시), 자유 외출(L3) 날에 행사 1건 추가 - 숙소 그리드에 TourAPI 숙박 가까운 순 6곳 추가(예약 검색은 영문 이름으로) - scripts/fetch_medical_tourism.py: Productize 브랜치의 수집 스크립트 가져옴(화면 경로 주석 갱신) - vercel.json: /recovery·/stay·/en/recovery·/en/stay → /plan·/en/plan 영구 리다이렉트. src/pages/404.astro 사이트 스타일 404 - 테스트 14건(어댑터·우선순위·유동식 제외·축제) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
f9e91d3305
commit
83b8343262
11 files changed
+6982
-21
No files matched your search
@@ -6,12 +6,16 @@ import '../styles/plan.css';
|
||||
import strings from '../data/planStrings.json';
|
||||
import P from '../data/procedures.json';
|
||||
import PL from '../data/places.json';
|
||||
import TKO from '../data/medicalTourismKo.json';
|
||||
import TEN from '../data/medicalTourism.json';
|
||||
import { tourToPlaces } from '../lib/tour';
|
||||
interface Props { lang: 'ko' | 'en' }
|
||||
const { lang } = Astro.props;
|
||||
const t = strings[lang];
|
||||
const tour = tourToPlaces((lang === 'en' ? TEN : TKO) as any, lang);
|
||||
const nProcs = P.procedures.length;
|
||||
const nPlaces = PL.places.filter((x) => x.category !== 'hotel').length;
|
||||
const nHotels = PL.places.filter((x) => x.category === 'hotel').length;
|
||||
const nPlaces = PL.places.filter((x) => x.category !== 'hotel').length + tour.filter((x) => x.category !== 'hotel').length;
|
||||
const nHotels = PL.places.filter((x) => x.category === 'hotel').length + tour.filter((x) => x.category === 'hotel').length;
|
||||
---
|
||||
<section class="section dark plan-hero">
|
||||
<div class="wrap-wide">
|
||||
@@ -39,12 +43,19 @@ const nHotels = PL.places.filter((x) => x.category === 'hotel').length;
|
||||
import PL from '../data/places.json';
|
||||
import STR from '../data/planStrings.json';
|
||||
import factSheet from '../data/factSheet.json';
|
||||
import TKO from '../data/medicalTourismKo.json';
|
||||
import TEN from '../data/medicalTourism.json';
|
||||
import { tourToPlaces, festivalsDuring } from '../lib/tour';
|
||||
import { buildPlan, encodeHash, decodeHash, bookingUrl, googleFlightsUrl, mapUrl, buildIcs, summaryText, isIsoDate, addDays } from '../lib/plan';
|
||||
import type { Lang, Procedure, Place, Nationality, Plan, PlanDay } from '../lib/plan';
|
||||
|
||||
type Strings = Record<string, string>;
|
||||
const procedures = P.procedures as unknown as Procedure[];
|
||||
const places = PL.places as unknown as Place[];
|
||||
const curated = (PL.places as unknown as Place[]).map((x) => ({ ...x, source: 'curated' as const }));
|
||||
const root0 = document.getElementById('planner')!;
|
||||
const tourData = ((root0.dataset.lang === 'en' ? TEN : TKO) as any);
|
||||
const places: Place[] = [...curated, ...tourToPlaces(tourData, root0.dataset.lang === 'en' ? 'en' : 'ko')];
|
||||
const tourDate: string = String(tourData?.meta?.fetchedAt ?? '').slice(0, 10);
|
||||
const nationalities = P.nationalities.list as Nationality[];
|
||||
const PREFS = ['sightseeing', 'shopping', 'food', 'kpop', 'care'];
|
||||
const root = document.getElementById('planner')!;
|
||||
@@ -134,7 +145,8 @@ const nHotels = PL.places.filter((x) => x.category === 'hotel').length;
|
||||
}
|
||||
function pickHtml(p: Place): string {
|
||||
const t = T();
|
||||
const meta = `<small>${p.distanceKm <= 0.6 ? esc(t.walk) : esc(t.taxi)} ${esc(fill(t.km, { km: p.distanceKm }))}${p.indoor ? ' · ' + esc(t.indoor) : ''}</small>`;
|
||||
const dist = p.travelLabel ? esc(p.travelLabel) : `${p.distanceKm <= 0.6 ? esc(t.walk) : esc(t.taxi)} ${esc(fill(t.km, { km: p.distanceKm }))}`;
|
||||
const meta = `<small>${dist}${p.indoor ? ' · ' + esc(t.indoor) : ''}${p.source === 'tourapi' ? ' · ' + esc(t.tour_badge) : ''}</small>`;
|
||||
return p.mapQuery ? `<a href="${mapUrl(p.mapQuery)}" rel="noopener" target="_blank" title="${L(p.note)}">${L(p.name)} ${meta}</a>` : `<span class="pick" title="${L(p.note)}">${L(p.name)} ${meta}</span>`;
|
||||
}
|
||||
|
||||
@@ -198,7 +210,8 @@ const nHotels = PL.places.filter((x) => x.category === 'hotel').length;
|
||||
const days = plan.days.map((d) => {
|
||||
const ev = eventLabel(d);
|
||||
const lvl = lv(d.level);
|
||||
const picks = d.picks.length ? `<div class="picks">${d.picks.map(pickHtml).join('')}</div>` : d.level === 0 || d.isSurgery ? `<div class="rest">${esc(t.noPicks)}</div>` : '';
|
||||
const festPicks = d.festivals.map((f) => `<a href="#fest-${esc(f.id)}" class="fest"><span class="tag l3">${esc(t.festival_pick)}</span> ${esc(f.title)}</a>`).join('');
|
||||
const picks = d.picks.length || festPicks ? `<div class="picks">${festPicks}${d.picks.map(pickHtml).join('')}</div>` : d.level === 0 || d.isSurgery ? `<div class="rest">${esc(t.noPicks)}</div>` : '';
|
||||
const dietTag = d.offset >= 0 && d.diet !== 'normal' ? `<span class="tag diet" title="${L(diets[d.diet].desc)}">${esc(t.diet)}: ${L(diets[d.diet].label)}</span>` : '';
|
||||
return `<div class="day ${ev ? 'mark' : ''}"><div class="d"><b>${esc(fmtDate(d.date))}</b><span>${esc(dayLabel(d))}</span>${ev ? `<span class="ev">${esc(ev)}</span>` : ''}</div><div class="body"><div class="tags"><span class="tag l${d.level}">${esc(t.level)}: ${L(lvl.label)}</span>${dietTag}<span class="desc">${L(lvl.desc)}</span></div>${picks}</div></div>`;
|
||||
}).join('');
|
||||
@@ -208,10 +221,19 @@ const nHotels = PL.places.filter((x) => x.category === 'hotel').length;
|
||||
<div class="timeline">${days}</div>
|
||||
</div></section>`;
|
||||
|
||||
// 다크 섹션: 예약과 저장
|
||||
// 라이트 섹션: 체류 기간의 행사 (TourAPI)
|
||||
const firstL3 = plan.days.find((d) => d.level >= 3)?.date ?? null;
|
||||
const festCards = lastFest.map((f) => {
|
||||
const from = firstL3 && firstL3 <= f.end ? fill(t.fest_from, { d: fmtDate(firstL3 < f.start ? f.start : firstL3) }) : t.fest_notYet;
|
||||
return `<div class="card fest-card" id="fest-${esc(f.id)}">${f.image ? `<img src="${esc(f.image)}" alt="${esc(f.title)}" loading="lazy" onerror="this.remove()" />` : ''}<div class="cat">${esc(fill(t.fest_when, { a: f.start.slice(5).replace('-', '.'), b: f.end.slice(5).replace('-', '.') }))} · ${esc(f.travelLabel ?? fill(t.km, { km: f.distanceKm }))}</div><h3>${esc(f.title)}</h3><p>${esc(f.blurb)}</p><p class="fine"><span class="tag ${firstL3 && firstL3 <= f.end ? 'l3' : 'l0'}">${esc(from)}</span> ${f.url ? `<a href="${esc(f.url)}" rel="noopener" target="_blank">${esc(t.readMoreShort)}</a> · ` : ''}<a href="${mapUrl(f.title)}" rel="noopener" target="_blank">${esc(t.map)}</a></p></div>`;
|
||||
}).join('');
|
||||
const festSec = `<section class="section light"><div class="wrap-wide">${secHead('Events', t.h_fest, t.sub_fest)}${festCards ? `<div class="grid">${festCards}</div>` : `<p class="sub" style="color:var(--slate-500)">${esc(t.fest_none)}</p>`}<p class="fine" style="margin-top:1rem">${esc(fill(t.source_tour, { date: tourDate }))}</p></div></section>`;
|
||||
|
||||
// 다크 섹션: 예약과 저장 (큐레이션 숙소 + TourAPI 숙박 가까운 순 6곳)
|
||||
const checkin = plan.arriveBy, checkout = plan.earliestDeparture ?? addDays(plan.surgeryDate, 14);
|
||||
const hotels = places.filter((x) => x.category === 'hotel').sort((a, b) => a.distanceKm - b.distanceKm).map((h) => `
|
||||
<div class="card"><div class="cat">${L(h.area)} · ${esc(fill(t.km, { km: h.distanceKm }))}</div><h3>${L(h.name)}</h3><p>${L(h.note)}</p>
|
||||
const hotelList = [...places.filter((x) => x.category === 'hotel' && x.source !== 'tourapi'), ...places.filter((x) => x.category === 'hotel' && x.source === 'tourapi').sort((a, b) => a.distanceKm - b.distanceKm).slice(0, 6)];
|
||||
const hotels = hotelList.map((h) => `
|
||||
<div class="card"><div class="cat">${L(h.area)} · ${esc(h.travelLabel ?? fill(t.km, { km: h.distanceKm }))}${h.source === 'tourapi' ? ' · ' + esc(t.tour_badge) : ''}</div><h3>${L(h.name)}</h3><p>${L(h.note)}</p>
|
||||
<div class="links"><a href="${bookingUrl(h.bookingQuery ?? (h.name as any).en, checkin, checkout, state.lang)}" rel="noopener sponsored" target="_blank">${esc(t.hotelSearch)}</a>${h.mapQuery ? `<a href="${mapUrl(h.mapQuery)}" rel="noopener" target="_blank">${esc(t.map)}</a>` : ''}</div></div>`).join('');
|
||||
const srcs = p.sources.map((id) => (P as any).clinicSources.find((s: any) => s.id === id)).filter(Boolean).map((s: any) => `<li><a href="${esc(s.url)}" rel="noopener" target="_blank">${L(s.label)}</a></li>`).join('');
|
||||
const bookSec = `<section class="section dark"><div class="wrap-wide">
|
||||
@@ -224,19 +246,22 @@ const nHotels = PL.places.filter((x) => x.category === 'hotel').length;
|
||||
<div class="card"><div class="cat">Save</div><h3>${esc(t.ics)}</h3><p>${esc(t.hotelHint)}</p><div class="plan-actions"><button type="button" class="btn ghost small" data-action="ics">${esc(t.ics)}</button><button type="button" class="btn ghost small" data-action="share">${esc(t.shareLink)}</button><button type="button" class="btn ghost small" data-action="print">${esc(t.print)}</button></div></div>
|
||||
</div>
|
||||
<p class="disclosure">${esc(t.affiliate)} ${esc(t.medical)}</p>
|
||||
${srcs ? `<p class="note" style="margin-top:0.6rem">${esc(t.sourceLabel)}</p><ul class="sources-list">${srcs}</ul>` : ''}
|
||||
<p class="note" style="margin-top:0.6rem">${esc(t.sourceLabel)}</p><ul class="sources-list">${srcs}<li>${esc(fill(t.source_tour, { date: tourDate }))}</li></ul>
|
||||
</div></section>`;
|
||||
|
||||
return scheduleSec + rulesSec + daysSec + bookSec;
|
||||
return scheduleSec + rulesSec + daysSec + festSec + bookSec;
|
||||
}
|
||||
|
||||
let lastPlan: Plan | null = null;
|
||||
let lastFest: ReturnType<typeof festivalsDuring> = [];
|
||||
function render() {
|
||||
const p = currentProc();
|
||||
lastPlan = null;
|
||||
let result = renderEmpty();
|
||||
if (p && isIsoDate(state.date)) {
|
||||
lastPlan = buildPlan({ procedure: p, surgeryDate: state.date, nationality: currentNat(), prefs: state.prefs }, places);
|
||||
const pre = buildPlan({ procedure: p, surgeryDate: state.date, nationality: currentNat(), prefs: state.prefs }, places);
|
||||
lastFest = festivalsDuring(tourData, pre.arriveBy, pre.earliestDeparture ?? addDays(pre.surgeryDate, 14));
|
||||
lastPlan = buildPlan({ procedure: p, surgeryDate: state.date, nationality: currentNat(), prefs: state.prefs, festivals: lastFest }, places);
|
||||
result = renderResult(lastPlan, p);
|
||||
}
|
||||
root.innerHTML = renderInput() + result;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -92,7 +92,7 @@
|
||||
"stat_procs": "시술",
|
||||
"stat_procs_d": "가슴·윤곽·눈·코·지방·리프팅·피부·모발",
|
||||
"stat_places": "추천 장소",
|
||||
"stat_places_d": "신논현역 기준 도보·택시 거리와 실내 여부를 함께 표시",
|
||||
"stat_places_d": "큐레이션과 한국관광공사 TourAPI. 신논현역 기준 거리·이동 시간 표시",
|
||||
"stat_hotels": "근처 숙소",
|
||||
"stat_hotels_d": "병원 도보 10분 안, 엘리베이터·룸서비스·24시간 프런트",
|
||||
"stat_privacy": "서버 저장",
|
||||
@@ -105,7 +105,17 @@
|
||||
"empty_sub": "수술일은 예상일이어도 됩니다.",
|
||||
"stickyView": "일정표 보기",
|
||||
"stickyStay": "{a} → {b} · {n}박",
|
||||
"h_step1_hint": "국적을 고르면 시차와 무비자 체류 한도를 함께 봅니다."
|
||||
"h_step1_hint": "국적을 고르면 시차와 무비자 체류 한도를 함께 봅니다.",
|
||||
"h_fest": "Festivals During Your Stay",
|
||||
"sub_fest": "체류 기간과 겹치는 행사입니다. 자유 외출 단계가 되는 날부터 갈 수 있습니다.",
|
||||
"fest_none": "체류 기간과 겹치는 행사가 없습니다.",
|
||||
"fest_when": "{a} ~ {b}",
|
||||
"fest_from": "{d}부터 가능",
|
||||
"fest_notYet": "이번 체류에서는 자유 외출 단계에 닿지 않습니다",
|
||||
"source_tour": "장소·행사 데이터: 한국관광공사 TourAPI, {date} 기준. 영업 여부와 행사 일정은 방문 전에 확인하세요.",
|
||||
"tour_badge": "관광공사",
|
||||
"festival_pick": "행사",
|
||||
"readMoreShort": "홈페이지"
|
||||
},
|
||||
"en": {
|
||||
"eyebrow": "Recovery Planner",
|
||||
@@ -199,7 +209,7 @@
|
||||
"stat_procs": "procedures",
|
||||
"stat_procs_d": "Breast, contouring, eyes, nose, fat, lifting, skin, hair",
|
||||
"stat_places": "curated places",
|
||||
"stat_places_d": "With walk or taxi distance from Sinnonhyeon Station and indoor flags",
|
||||
"stat_places_d": "Curated picks plus Korea Tourism Organization data, with distance and travel time from Sinnonhyeon Station",
|
||||
"stat_hotels": "hotels nearby",
|
||||
"stat_hotels_d": "Within a 10-minute walk, with elevators, room service and 24-hour desks",
|
||||
"stat_privacy": "stored on servers",
|
||||
@@ -212,6 +222,16 @@
|
||||
"empty_sub": "An estimated date is fine.",
|
||||
"stickyView": "See schedule",
|
||||
"stickyStay": "{a} → {b} · {n} nights",
|
||||
"h_step1_hint": "Your nationality sets the jet-lag buffer and the visa-free stay check."
|
||||
"h_step1_hint": "Your nationality sets the jet-lag buffer and the visa-free stay check.",
|
||||
"h_fest": "Festivals During Your Stay",
|
||||
"sub_fest": "Events that overlap your stay. You can go from the first full-day-out date.",
|
||||
"fest_none": "No events overlap your stay.",
|
||||
"fest_when": "{a} to {b}",
|
||||
"fest_from": "From {d}",
|
||||
"fest_notYet": "Your stay does not reach the full-day-out stage",
|
||||
"source_tour": "Places and events: Korea Tourism Organization TourAPI, as of {date}. Check opening status and event dates before you go.",
|
||||
"tour_badge": "KTO",
|
||||
"festival_pick": "Event",
|
||||
"readMoreShort": "Website"
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,13 @@ export interface Procedure {
|
||||
export interface Place {
|
||||
id: string; name: L10n; category: string; minLevel: number; dietOk?: string[]; distanceKm: number; indoor: boolean;
|
||||
area: L10n; note: L10n; mapQuery: string | null; bookingQuery?: string; verify: boolean;
|
||||
source?: 'curated' | 'tourapi'; travelLabel?: string; image?: string; url?: string;
|
||||
}
|
||||
export interface Nationality { code: string; label: L10n; visaFreeDays: number | null; longHaul: boolean }
|
||||
|
||||
export interface PlanInput { procedure: Procedure; surgeryDate: string; nationality?: Nationality | null; prefs: string[] }
|
||||
export interface PlanDay { date: string; offset: number; level: number; diet: DietStep['type']; picks: Place[]; isSurgery: boolean; isHospital: boolean; isStitch: boolean; isArrival: boolean; isDeparture: boolean }
|
||||
export interface PlanFestival { id: string; title: string; start: string; end: string }
|
||||
export interface PlanInput { procedure: Procedure; surgeryDate: string; nationality?: Nationality | null; prefs: string[]; festivals?: PlanFestival[] }
|
||||
export interface PlanDay { date: string; offset: number; level: number; diet: DietStep['type']; picks: Place[]; festivals: PlanFestival[]; isSurgery: boolean; isHospital: boolean; isStitch: boolean; isArrival: boolean; isDeparture: boolean }
|
||||
export interface Plan {
|
||||
arriveBy: string; surgeryDate: string; dischargeDate: string | null; stitchDate: string | null; earliestDeparture: string | null;
|
||||
stayNights: number | null; preOpDays: number; days: PlanDay[];
|
||||
@@ -57,6 +59,7 @@ export function scorePlace(place: Place, level: number, diet: DietStep['type'],
|
||||
if (place.category === 'food' && place.dietOk && !place.dietOk.includes(diet)) return -1;
|
||||
let s = 0;
|
||||
if (prefs.length === 0 || prefs.includes(place.category)) s += 3;
|
||||
if (place.source !== 'tourapi') s += 0.75; // 큐레이션(1순위)이 같은 조건이면 먼저 나온다
|
||||
if (place.category === 'essentials' || place.category === 'care') s += 1; // 회복에 직접 필요한 것은 기본 가점
|
||||
s += 2 - Math.min(2, level - place.minLevel); // 오늘 등급에 맞는 곳을 우선
|
||||
s += Math.max(0, 1.5 - place.distanceKm / 4); // 가까울수록 가점(최대 1.5)
|
||||
@@ -74,7 +77,7 @@ export function pickForDay(places: Place[], level: number, diet: DietStep['type'
|
||||
}
|
||||
|
||||
export function buildPlan(input: PlanInput, places: Place[]): Plan {
|
||||
const { procedure: p, surgeryDate, nationality, prefs } = input;
|
||||
const { procedure: p, surgeryDate, nationality, prefs, festivals = [] } = input;
|
||||
const preOp = effectivePreOpDays(p, nationality);
|
||||
const arriveBy = addDays(surgeryDate, -preOp);
|
||||
const nights = p.hospitalNights.value;
|
||||
@@ -94,7 +97,8 @@ export function buildPlan(input: PlanInput, places: Place[]): Plan {
|
||||
const recentSet = new Set(recent.slice(-6));
|
||||
const picks = level === 0 || off === 0 ? [] : pickForDay(places, level, diet, prefs, recentSet);
|
||||
recent.push(...picks.map((x) => x.id));
|
||||
days.push({ date, offset: off, level, diet, picks, isSurgery: off === 0, isHospital, isStitch: stitchDate === date, isArrival: off === -preOp, isDeparture: earliestDeparture === date });
|
||||
const dayFest = level >= 3 ? festivals.filter((f) => f.start <= date && f.end >= date).slice(0, 1) : []; // 행사는 자유 외출(L3) 날에만
|
||||
days.push({ date, offset: off, level, diet, picks, festivals: dayFest, isSurgery: off === 0, isHospital, isStitch: stitchDate === date, isArrival: off === -preOp, isDeparture: earliestDeparture === date });
|
||||
}
|
||||
return { arriveBy, surgeryDate, dischargeDate, stitchDate, earliestDeparture, stayNights: dep === null ? null : preOp + dep, preOpDays: preOp, days };
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
// 한국관광공사 TourAPI 사전 수집 데이터(src/data/medicalTourism*.json)를 회복 일정 플래너의 장소·축제 후보로 바꾼다 (설계 v0.2 §13.5, 2순위 소스).
|
||||
// 수집은 scripts/fetch_medical_tourism.py 가 병원 좌표 기준으로 미리 해 두고, 화면은 이 파일의 결과만 쓴다. 외부 호출 없음.
|
||||
// 식이 적합성은 TourAPI 가 주지 않으므로 판정하지 않는다: 음식점은 일반식 단계에서만 후보가 되고, 죽·스무디 같은 회복 초기 식사는 큐레이션(places.json)이 맡는다.
|
||||
import type { Place, L10n } from './plan';
|
||||
|
||||
export interface TourItem {
|
||||
id: string; title: string; address: string; image: string | null; tel: string | null; lat: number; lng: number;
|
||||
distanceM: number; travel: { mode: string; minutes: number; label: string } | null; overview: string; homepage: string;
|
||||
startDate?: string; endDate?: string; season?: string;
|
||||
}
|
||||
export interface TourData {
|
||||
places: Record<string, TourItem[]>;
|
||||
festivals: TourItem[];
|
||||
meta: { lang?: string; source: string; fetchedAt: string; origin?: { lat: number; lng: number; label: string } };
|
||||
}
|
||||
|
||||
/** TourAPI 유형 → 플래너 카테고리. wellness(사우나·스파)는 회복기 금지 항목이라 후보에서 뺀다. */
|
||||
const CATEGORY: Record<string, string | null> = { attraction: 'sightseeing', culture: 'sightseeing', shopping: 'shopping', restaurant: 'food', stay: 'hotel', wellness: null };
|
||||
|
||||
/** 거리로 외출 등급을 정한다: 600m 안 근거리(L1), 3km 안 반나절(L2), 그 밖은 자유 외출(L3). */
|
||||
export const levelByDistance = (m: number): number => (m <= 600 ? 1 : m <= 3000 ? 2 : 3);
|
||||
|
||||
const both = (s: string): L10n => ({ ko: s, en: s });
|
||||
/** 주소를 짧은 동네 표기로. 국문은 '구 도로명', 영문은 첫 쉼표 앞 도로명. */
|
||||
const areaLabel = (address: string, lang: 'ko' | 'en'): string => {
|
||||
const a = (address || '').trim();
|
||||
if (lang === 'en') return a.split(',').map((x) => x.trim()).filter((x) => x && !/^\d+$/.test(x))[0] ?? a;
|
||||
return a.replace(/^서울특별시\s*/, '').split(/\s+/).slice(0, 2).join(' ');
|
||||
};
|
||||
const firstSentence = (s: string, n = 140): string => {
|
||||
const t = (s || '').replace(/\d+\s*m?\s*NAVER\s*©\s*NAVER Corp\.?/gi, '').replace(/\s+/g, ' ').trim();
|
||||
if (t.length <= n) return t;
|
||||
const cut = t.slice(0, n);
|
||||
const stop = Math.max(cut.lastIndexOf('. '), cut.lastIndexOf('다. '), cut.lastIndexOf('。'));
|
||||
return (stop > 40 ? cut.slice(0, stop + 1) : cut).trim() + (stop > 40 ? '' : '…');
|
||||
};
|
||||
/** "K-그랜드 호스텔 강남 1(K-GRAND HOSTEL GANGNAM1)" → 예약 검색용 영문 이름이 괄호 안에 있으면 그것을 쓴다. */
|
||||
export const bookingName = (title: string): string => {
|
||||
const m = title.match(/\(([^)]*[A-Za-z][^)]*)\)\s*$/);
|
||||
return (m ? m[1] : title).trim();
|
||||
};
|
||||
|
||||
export function tourToPlaces(data: TourData, lang: 'ko' | 'en'): Place[] {
|
||||
const out: Place[] = [];
|
||||
for (const [type, items] of Object.entries(data.places ?? {})) {
|
||||
const category = CATEGORY[type];
|
||||
if (!category) continue;
|
||||
for (const it of items) {
|
||||
if (!it.lat || !it.lng) continue;
|
||||
const km = Math.round((it.distanceM / 1000) * 10) / 10;
|
||||
out.push({
|
||||
id: `tour-${type}-${it.id}`,
|
||||
name: both(it.title),
|
||||
category,
|
||||
minLevel: category === 'hotel' ? 0 : levelByDistance(it.distanceM),
|
||||
dietOk: category === 'food' ? ['normal'] : undefined,
|
||||
distanceKm: km,
|
||||
indoor: type === 'shopping' || type === 'culture' || type === 'restaurant' || type === 'stay',
|
||||
area: both(areaLabel(it.address, lang)),
|
||||
note: both(firstSentence(it.overview)),
|
||||
mapQuery: it.title,
|
||||
bookingQuery: category === 'hotel' ? bookingName(it.title) : undefined,
|
||||
verify: true,
|
||||
source: 'tourapi',
|
||||
travelLabel: it.travel?.label ?? undefined,
|
||||
image: it.image ?? undefined,
|
||||
url: it.homepage || undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export interface Festival { id: string; title: string; start: string; end: string; distanceKm: number; travelLabel?: string; blurb: string; image?: string; url?: string; address: string }
|
||||
const iso = (d?: string) => (d && d.length === 8 ? `${d.slice(0, 4)}-${d.slice(4, 6)}-${d.slice(6, 8)}` : '');
|
||||
|
||||
/** 체류 기간 [from, to] 와 겹치는 행사만, 가까운 순. */
|
||||
export function festivalsDuring(data: TourData, from: string, to: string, max = 6): Festival[] {
|
||||
return (data.festivals ?? [])
|
||||
.map((f) => ({ f, start: iso(f.startDate), end: iso(f.endDate) }))
|
||||
.filter((x) => x.start && x.end && x.start <= to && x.end >= from)
|
||||
.sort((a, b) => a.f.distanceM - b.f.distanceM)
|
||||
.slice(0, max)
|
||||
.map(({ f, start, end }) => ({
|
||||
id: `fest-${f.id}`, title: f.title, start, end, distanceKm: Math.round((f.distanceM / 1000) * 10) / 10,
|
||||
travelLabel: f.travel?.label ?? undefined, blurb: firstSentence(f.overview), image: f.image ?? undefined,
|
||||
url: f.homepage || undefined, address: f.address,
|
||||
}));
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
// 없는 주소. Vercel 이 dist/404.html 을 자동으로 쓴다. 옛 주소(/recovery, /stay)는 vercel.json 리다이렉트가 /plan 으로 먼저 보낸다.
|
||||
import Base from '../layouts/Base.astro';
|
||||
import { SITE_NAME } from '../lib';
|
||||
const site = Astro.site!.toString().replace(/\/$/, '');
|
||||
const ld = { '@type': 'WebPage', '@id': `${site}/404#page`, name: '페이지를 찾을 수 없음', url: `${site}/404`, inLanguage: 'ko', isPartOf: { '@id': `${site}/#website` }, publisher: { '@type': 'Organization', name: SITE_NAME, url: site } };
|
||||
---
|
||||
<Base title="페이지를 찾을 수 없음" description="주소가 바뀌었거나 없는 페이지입니다. 홈, 회복 일정, 방문 안내로 이동할 수 있습니다." jsonLd={ld} noindex={true}>
|
||||
<section class="section dark" style="padding:5rem 0 4.5rem"><div class="wrap-wide">
|
||||
<div class="sec-head"><div class="eyebrow" style="color:var(--purple-300)">404</div><h1 class="serif" style="font-size:2rem;display:inline-block;background:linear-gradient(to right,var(--purple-300),var(--blue-300));-webkit-background-clip:text;background-clip:text;color:transparent">Page Not Found</h1><p class="sub">주소가 바뀌었거나 없는 페이지입니다. 아래에서 이어서 보실 수 있습니다.</p></div>
|
||||
<div class="grid">
|
||||
<a class="card" href="/" style="text-decoration:none"><div class="cat">Home</div><h3>홈</h3><p>뷰성형외과를 알아보는 분들의 질문과 답</p></a>
|
||||
<a class="card" href="/plan" style="text-decoration:none"><div class="cat">Recovery Planner</div><h3>회복 일정</h3><p>수술일 기준 입국·출국 계산과 회복기 외출 계획. 영어 화면은 /en/plan</p></a>
|
||||
<a class="card" href="/visit" style="text-decoration:none"><div class="cat">Visit</div><h3>방문 안내</h3><p>예약, 가는 길, 주차, 도착 후 동선</p></a>
|
||||
</div>
|
||||
</div></section>
|
||||
</Base>
|
||||
@@ -100,6 +100,14 @@ button.btn { font: inherit; cursor: pointer; border: 0; }
|
||||
.day .rest { font-size: 0.88rem; color: var(--slate-500); }
|
||||
@media (max-width: 640px) { .day { grid-template-columns: 1fr; } }
|
||||
|
||||
/* 체류 기간의 행사 카드 (TourAPI 이미지) */
|
||||
.fest-card { padding: 0; overflow: hidden; }
|
||||
.fest-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
|
||||
.fest-card .cat, .fest-card h3, .fest-card p { margin-left: 1.5rem; margin-right: 1.5rem; }
|
||||
.fest-card .cat { margin-top: 1.2rem; }
|
||||
.fest-card > p:last-child { margin-bottom: 1.3rem; }
|
||||
.day .picks a.fest { border-color: var(--st-good-border); background: var(--st-good-bg); }
|
||||
|
||||
/* 예약 (다크 섹션 위 흰 카드) */
|
||||
.hotel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.25rem; }
|
||||
.hotel-grid .card small { color: var(--slate-500); font-size: 0.78rem; }
|
||||
|
||||
Reference in new issue
Block a user