Merge commit '46171b4f24f2ddc3b9212b9ad6769925bcaceb03' into feature/site-features-and-mockup
# Conflicts: # .env.example # solution/backend/common/enums.py # solution/backend/requirements.txt # solution/backend/services/site_payload.py # solution/backend/services/snapshot.py # solution/backend/services/weather_notes.json # solution/shared/src/types/site-payload.ts # solution/site/src/layouts/editorial/Shell.tsx # solution/site/src/lib/use-live-weather.ts # solution/site/src/pages/HomePage.tsx # solution/site/src/sections/SiteFooter.tsx # solution/site/src/sections/WeatherSection.tsx # solution/site/src/sections/index.ts
This commit is contained in:
commit
b78486b845
74 files changed
+3266
-193
No files matched your search
@@ -2,7 +2,7 @@ import {ExternalLink, Mail, MapPin, Phone} from 'lucide-react';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {isoDate} from '@site/lib/format';
|
||||
// 채널 이름표는 예약·문의 섹션과 같은 표를 쓴다 — 같은 채널이 자리마다 다른 이름으로 뜨면 안 된다.
|
||||
import {bookingLabel, publicLinks} from '@site/lib/derive';
|
||||
import {channelLabel, primaryChannelLink} from '@site/lib/derive';
|
||||
|
||||
/**
|
||||
* 푸터.
|
||||
@@ -14,9 +14,8 @@ import {bookingLabel, publicLinks} from '@site/lib/derive';
|
||||
export function SiteFooter() {
|
||||
const payload = useSite();
|
||||
const {place, site} = payload;
|
||||
// 확정된 채널만 — 확정 전 URL 은 동명 업소일 수 있다.
|
||||
// ★ sameAs 와 같은 목록이어야 한다 — 화면에 없는 주소가 구조화 데이터에 있으면 발행이 막힌다.
|
||||
const links = publicLinks(payload);
|
||||
// ★ 확정 채널을 전부 늘어놓지 않는다 — 예약 우선으로 딱 하나만 낸다(seo/jsonld.ts 주석 참고).
|
||||
const link = primaryChannelLink(payload);
|
||||
const address = place.roadAddress ?? place.address;
|
||||
|
||||
return (
|
||||
@@ -58,23 +57,21 @@ export function SiteFooter() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{links.length > 0 && (
|
||||
{link && (
|
||||
<nav aria-label="공식 채널" className="md:col-span-5">
|
||||
<h2 className="label mb-3 !text-current opacity-100">공식 채널</h2>
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{links.map((link) => (
|
||||
<li key={link.url}>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1.5 rounded-lg border border-current/25 px-3 py-2 text-[length:var(--fs-xs)] font-medium transition-colors hover:bg-current/10"
|
||||
>
|
||||
<span>{bookingLabel(link)}</span>
|
||||
<ExternalLink className="size-3.5" />
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
<li>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1.5 rounded-lg border border-current/25 px-3 py-2 text-[length:var(--fs-xs)] font-medium transition-colors hover:bg-current/10"
|
||||
>
|
||||
<span>{channelLabel(link)}</span>
|
||||
<ExternalLink className="size-3.5" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
|
||||
/** 승인해 함께 발행한 소식의 사본. 플랫폼 인용·임베드·JSON-LD 사실로 취급하지 않는다. */
|
||||
export function SocialPostsSection() {
|
||||
const posts = useSite().socialPosts ?? [];
|
||||
if (!posts.length) return null;
|
||||
return <section id="social-posts" className="mx-auto w-full max-w-5xl px-6 py-12">
|
||||
<h2 className="mb-3 text-2xl font-semibold">함께 발행한 소식</h2>
|
||||
<p className="mb-6 text-sm opacity-70">사장님이 승인해 홈페이지와 Threads에 함께 전한 소식입니다.</p>
|
||||
<div className="grid gap-4 md:grid-cols-3">{posts.map((post) => <article key={post.postId} className="rounded-xl border border-current/15 p-5">
|
||||
<time dateTime={post.postedAt} className="text-sm opacity-70">{new Date(post.postedAt).toLocaleDateString('sv-SE', {timeZone: 'Asia/Seoul'})} (한국시간)</time>
|
||||
<p className="my-4 whitespace-pre-wrap break-words">{post.body}</p>
|
||||
{post.permalink && <a href={post.permalink} target="_blank" rel="noopener noreferrer" className="text-sm underline underline-offset-4">SNS에 올린 글 보기</a>}
|
||||
</article>)}</div>
|
||||
</section>;
|
||||
}
|
||||
@@ -24,4 +24,5 @@ export {MobileTabBar} from './MobileTabBar';
|
||||
// 붙여넣기 아이템 — 데이터가 fact 가 아니라 사장님이 넣은 JSON 에서 온다(theme.sections[].data).
|
||||
export {ITEM_SECTIONS} from './items';
|
||||
export {ReviewSection} from './ReviewSection';
|
||||
export {SocialPostsSection} from './SocialPostsSection';
|
||||
export {PostcardMakerSection} from './items/PostcardMakerSection';
|
||||
@@ -0,0 +1,41 @@
|
||||
import {describe, expect, it} from 'vitest';
|
||||
import {sanitizePayloadForPublish, type SitePayload} from '@o2o/shared';
|
||||
import {MOONLIGHT_STAY_PAYLOAD} from '@site/fixtures/moonlight-stay';
|
||||
import {render} from '@site/entry-server';
|
||||
import {collectJsonLd} from '@site/seo/jsonld';
|
||||
import {homeMeta} from '@site/seo/meta';
|
||||
import {verifyJsonLd} from '@site/seo/verify';
|
||||
|
||||
const post = {postId: 'social-1', provider: 2, body: '새 홈페이지에서 숙소의 확인된 정보를 만나보세요.\n\nhttps://example.com/s/stay', postedAt: '2026-09-13T23:30:00Z', permalink: 'https://www.threads.com/@host/post/abc'};
|
||||
function payload(enabled = true): SitePayload {
|
||||
return {...MOONLIGHT_STAY_PAYLOAD, socialPosts: [post], theme: {...MOONLIGHT_STAY_PAYLOAD.theme,
|
||||
sections: [{id: 'social', name: 'SNS 게시글', enabled, locked: false}, ...MOONLIGHT_STAY_PAYLOAD.theme.sections]}};
|
||||
}
|
||||
|
||||
describe('SNS 소식 정적 발행', () => {
|
||||
it('없는 글이나 꺼진 섹션을 그리지 않는다', () => {
|
||||
expect(render({...payload(), socialPosts: []})).not.toContain('함께 발행한 소식');
|
||||
expect(render(payload(false))).not.toContain('함께 발행한 소식');
|
||||
});
|
||||
it('본문 전문·절대 KST 날짜를 마지막 섹션에 굽고 위젯을 쓰지 않는다', () => {
|
||||
const html = render(sanitizePayloadForPublish(payload()));
|
||||
expect(html).toContain(post.body);
|
||||
expect(html.replace(/<!--.*?-->/g, '')).toContain('2026-09-14 (한국시간)');
|
||||
expect(html).not.toContain('widgets.js');
|
||||
expect(html).not.toContain('platform.twitter.com');
|
||||
expect(html).not.toContain('threads.net/embed');
|
||||
expect(html.indexOf('id="social-posts"')).toBeGreaterThan(html.lastIndexOf('id="location"'));
|
||||
});
|
||||
it('임의의 승인 비밀·위험 링크를 공개 payload에서 뺀다', () => {
|
||||
const dirty = {...post, approval_token_sha: 'secret', permalink: 'javascript:alert(1)'};
|
||||
const clean = sanitizePayloadForPublish({...payload(), socialPosts: [dirty]});
|
||||
expect(JSON.stringify(clean.socialPosts)).not.toContain('secret');
|
||||
expect(clean.socialPosts?.[0].permalink).toBeUndefined();
|
||||
});
|
||||
it('SNS 글을 JSON-LD 주장이나 메타 설명에 넣지 않는다', () => {
|
||||
const input = sanitizePayloadForPublish(payload());
|
||||
const nodes = collectJsonLd(input, homeMeta(input));
|
||||
expect(JSON.stringify(nodes)).not.toContain(post.body);
|
||||
expect(verifyJsonLd(render(input), nodes)).toEqual(verifyJsonLd(render({...input, socialPosts: []}), collectJsonLd({...input, socialPosts: []}, homeMeta(input))));
|
||||
});
|
||||
});
|
||||
@@ -223,10 +223,10 @@ describe('예약 버튼은 예약 화면으로 바로 간다', () => {
|
||||
],
|
||||
};
|
||||
|
||||
it('네이버 예약이 플레이스보다 먼저 나온다 — 플레이스는 한 번 더 눌러야 한다', () => {
|
||||
it('네이버 예약이 있으면 네이버 플레이스는 예약 목록에서 빠진다 — 같은 예약이 두 번 뜨지 않는다', () => {
|
||||
const links = stayBookingView(withBooking)!.links;
|
||||
expect(links[0].channel).toBe(LinkChannel.NAVER_BOOKING);
|
||||
expect(links.map((l) => l.channel)).toContain(LinkChannel.NAVER_PLACE);
|
||||
expect(links.map((l) => l.channel)).not.toContain(LinkChannel.NAVER_PLACE);
|
||||
});
|
||||
|
||||
it('버튼 문구가 "네이버 예약에서 예약" 이 되지 않는다', () => {
|
||||
|
||||
@@ -19,6 +19,17 @@ it('uses the first sky and temperature lines for deterministic HTML', () => {
|
||||
expect(render(weather)).toBe(render(weather));
|
||||
});
|
||||
|
||||
it('uses condition-specific notes for fog, showers and thunderstorms', () => {
|
||||
const weather = {temperature: 20, observedAt: '2026-09-15T12:00', condition: '소나기', noteSets: {'소나기': ['소나기 첫 줄']}, tempNoteSets: {'선선': ['선선 첫 줄']}};
|
||||
expect(render(weather)).toContain('소나기 첫 줄');
|
||||
});
|
||||
|
||||
it('uses condition-specific notes for the rain subtypes', () => {
|
||||
const weather = {temperature: 5, observedAt: '2026-09-15T12:00', condition: '어는비', noteSets: {'어는비': ['어는비 첫 줄'], '비': ['일반 비 첫 줄']}, tempNoteSets: {'추움': ['추움 첫 줄']}};
|
||||
expect(render(weather)).toContain('어는비 첫 줄');
|
||||
expect(render(weather)).not.toContain('일반 비 첫 줄');
|
||||
});
|
||||
|
||||
it('preserves legacy single notes', () => {
|
||||
const html = render({temperature: 15, observedAt: '2026-09-15T12:00', condition: '비', notes: {'비': '기존 비 안내'}, tempNotes: {'쌀쌀': '겉옷 안내'}});
|
||||
expect(html).toContain('기존 비 안내');
|
||||
|
||||
Reference in new issue
Block a user