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
@@ -15,10 +15,10 @@ import {
|
||||
type WeatherBand,
|
||||
type WeatherMood,
|
||||
} from '@o2o/shared';
|
||||
import {BOOKING_CHANNELS, UNIT_SPEC, publicLinks, unitBaseRate} from '@site/seo/jsonld';
|
||||
import {UNIT_SPEC, bookingChannelLinks, primaryChannelLink, publicLinks, unitBaseRate} from '@site/seo/jsonld';
|
||||
|
||||
// 링크 거르기는 jsonld 에 산다(순환 의존 회피) — 화면 쪽은 늘 derive 를 통해 쓰므로 여기서 다시 낸다.
|
||||
export {publicLinks};
|
||||
export {publicLinks, primaryChannelLink};
|
||||
|
||||
/**
|
||||
* payload → 화면이 바로 쓰는 모양.
|
||||
@@ -491,23 +491,10 @@ function confirmedLinks(payload: SitePayload, channels: readonly number[]): Chan
|
||||
* 예약 버튼에 낼 채널. **BOOKING_CHANNELS 순서대로** 정렬한다 — 예약 화면으로 바로 가는
|
||||
* 채널이 맨 위 버튼이어야 한다.
|
||||
*
|
||||
* ★ 검색 결과 주소는 뺀다. 자동 발견이 `map.naver.com/p/search/…` 를 물어오는 경우가 있고
|
||||
* (실측 2026-09-08), 그걸 "예약" 버튼에 걸면 손님이 검색 화면을 만난다 — 예약하러 온
|
||||
* 사람에게 검색 결과를 주는 건 링크가 없는 것보다 나쁘다. 가게를 특정하지 못하는 주소라
|
||||
* 애초에 예약 창구가 아니다.
|
||||
* ★ 필터·순서 판단은 seo/jsonld 에 산다(순환 의존 회피, `bookingChannelLinks`) — 화면과
|
||||
* makesOffer.url·potentialAction 이 같은 함수를 써야 어긋나지 않는다.
|
||||
*/
|
||||
export function bookingLinks(payload: SitePayload): ChannelLink[] {
|
||||
const order = new Map(BOOKING_CHANNELS.map((channel, index) => [channel, index]));
|
||||
return confirmedLinks(payload, BOOKING_CHANNELS)
|
||||
.filter((link) => !isSearchUrl(link.url))
|
||||
.sort((a, b) => (order.get(a.channel) ?? 99) - (order.get(b.channel) ?? 99));
|
||||
}
|
||||
|
||||
/** 가게가 아니라 **검색 결과**를 가리키는 주소인지. */
|
||||
function isSearchUrl(url: string): boolean {
|
||||
return /\/p\/search\/|[?&]query=/.test(url);
|
||||
}
|
||||
|
||||
export const bookingLinks = bookingChannelLinks;
|
||||
|
||||
/**
|
||||
* ─────────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import {expect, it} from 'vitest';
|
||||
import {condition} from './use-live-weather';
|
||||
|
||||
it('recognizes fog, showers and thunderstorms as distinct conditions', () => {
|
||||
expect(condition(45)).toBe('안개');
|
||||
expect(condition(48)).toBe('안개');
|
||||
expect(condition(80)).toBe('소나기');
|
||||
expect(condition(81)).toBe('소나기');
|
||||
expect(condition(82)).toBe('소나기');
|
||||
expect(condition(85)).toBe('소나기');
|
||||
expect(condition(86)).toBe('소나기');
|
||||
expect(condition(95)).toBe('뇌우');
|
||||
expect(condition(96)).toBe('뇌우');
|
||||
expect(condition(99)).toBe('뇌우');
|
||||
});
|
||||
|
||||
it('splits rain into drizzle, normal, heavy and freezing', () => {
|
||||
expect(condition(51)).toBe('이슬비');
|
||||
expect(condition(53)).toBe('이슬비');
|
||||
expect(condition(55)).toBe('이슬비');
|
||||
expect(condition(61)).toBe('비');
|
||||
expect(condition(63)).toBe('비');
|
||||
expect(condition(65)).toBe('강한비');
|
||||
expect(condition(56)).toBe('어는비');
|
||||
expect(condition(57)).toBe('어는비');
|
||||
expect(condition(66)).toBe('어는비');
|
||||
expect(condition(67)).toBe('어는비');
|
||||
});
|
||||
@@ -5,7 +5,8 @@ export interface LiveWeather extends WeatherSnapshot {
|
||||
stale?: boolean;
|
||||
}
|
||||
|
||||
function condition(code: number): string {
|
||||
/** WMO weather code → 한 줄. ★ solution/backend/services/site_payload.py 의 _weather_condition() 과 같은 구간이어야 한다. */
|
||||
export function condition(code: number): string {
|
||||
if (code === 0) return '맑음';
|
||||
if (code >= 1 && code <= 2) return '구름많음';
|
||||
if (code === 3) return '흐림';
|
||||
|
||||
Reference in new issue
Block a user