feat: 시안 B 화면을 기본 화면으로, Hey API로 백엔드 연결

- 예전 화면(/, /a)과 목업 데이터를 지우고 시안 B 를 / 로
- @hey-api/openapi-ts 로 타입·TanStack Query 함수 생성, 토큰·401 갱신 처리
- 공유는 기본 공유창, 없으면 링크 복사

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 5.5 committed 2026-10-02 11:32:22 +09:00
1 parent e134295ce5
commit f8b47f064a
147 files changed
+12350

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
import type { CSSProperties } from 'react'
const SHARED = new Set(['bear', 'bike', 'bronze', 'camping', 'carwash', 'chimaek', 'cloud', 'coldwind', 'delivery', 'dog', 'garden', 'glasses', 'gold', 'hiking', 'iced_hot', 'jjamppong', 'laundry', 'letter', 'makeup', 'makgeolli', 'maple', 'moon', 'muggy', 'naengmyeon', 'photo', 'picnic', 'rabbit', 'rain', 'running', 'silver', 'snow', 'stars', 'sun_cloud', 'sun', 'sunset', 'taxi', 'umbrella', 'vent', 'walk', 'yajang'])
const OWN = new Set(['fireworks', 'bulb', 'calendar', 'thermo', 'sheaf'])
/** 아이콘 이름 → 파일 경로 (공용 public/icons, B 전용 public/b/icons) */
export function iconSrc(name: string) {
if (OWN.has(name)) return `/b/icons/${name}.png`
return `/icons/${SHARED.has(name) ? name : 'sun_cloud'}.png`
}
export const MEDALS = ['gold', 'silver', 'bronze'] as const
export const fall = (d: string, f = '4.8s', amp?: string) => ({ '--d': d, '--f': f, ...(amp ? { '--amp': amp } : {}) }) as CSSProperties
export const WEEKDAYS = ['일', '월', '화', '수', '목', '금', '토'] as const
const KST = new Intl.DateTimeFormat('en-US', { timeZone: 'Asia/Seoul', year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', hourCycle: 'h23', weekday: 'short' })
const WD_EN = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
/** 한국 시각으로 쪼개기 (브라우저 시간대와 상관없이) */
export function kst(input: string | Date) {
const parts = Object.fromEntries(KST.formatToParts(typeof input === 'string' ? new Date(input) : input).map((p) => [p.type, p.value]))
return { y: +parts.year, mo: +parts.month, d: +parts.day, h: +parts.hour, mi: +parts.minute, wd: WD_EN.indexOf(parts.weekday) }
}
const h12 = (h: number) => h % 12 || 12
/** 18:25 → "6:25" */
export function clockShort(iso: string) {
const t = kst(iso)
return `${h12(t.h)}:${String(t.mi).padStart(2, '0')}`
}
/** 18:30 → "6시 반", 18:25 → "6시 25분" */
export function timeWords(iso: string) {
const t = kst(iso)
return `${h12(t.h)}시${t.mi === 0 ? '' : t.mi === 30 ? ' 반' : ` ${t.mi}분`}`
}
/** 발표 시각 → "방금" · "12분 전" · "3시간 전" */
export function ago(iso: string | null | undefined, now = Date.now()) {
if (!iso) return '오늘'
const min = Math.max(0, Math.round((now - new Date(iso).getTime()) / 60000))
if (min < 5) return '방금'
if (min < 60) return `${min}분 전`
return `${Math.floor(min / 60)}시간 전`
}
/** 날짜 칸 이름: 오늘 · 내일 · "토 10.4" */
export function dayLabel(date: string, index: number) {
if (index === 0) return '오늘'
if (index === 1) return '내일'
const [, m, d] = date.split('-').map(Number)
const wd = new Date(`${date}T12:00:00+09:00`).getUTCDay()
return `${WEEKDAYS[wd]} ${m}.${d}`
}
export type TimeKind = 'morning' | 'day' | 'sunset' | 'night'
export function kindOfHour(h: number): TimeKind {
if (h >= 5 && h < 9) return 'morning'
if (h >= 9 && h < 16) return 'day'
if (h >= 16 && h < 19) return 'sunset'
return 'night'
}
/** "서울 마포구" → "서울" */
export const sidoOf = (regionName: string) => regionName.split(' ')[0]
/** 2026-10-02 ~ 2026-10-11 → "10.2 ~ 10.11", 하루짜리는 "10.3" */
export function dateRange(start: string, end: string) {
return start === end ? shortDay(start) : `${shortDay(start)} ~ ${shortDay(end)}`
}
const CARD_BG = ['night', 'butter', 'lilac', 'mint', 'peach', 'sky'] as const
const ICON_BG: Record<string, (typeof CARD_BG)[number] | 'dusk'> = { picnic: 'mint', walk: 'mint', sunset: 'dusk', chimaek: 'peach', photo: 'butter', fireworks: 'night', sheaf: 'butter', rain: 'sky', calendar: 'sky', bulb: 'lilac', maple: 'peach', snow: 'sky', thermo: 'sky', umbrella: 'lilac' }
/** API에 배경색이 없어 아이콘·순서로 카드 배경을 고른다 */
export function cardBg(icon: string, index: number) {
return ICON_BG[icon] && icon !== 'calendar' ? ICON_BG[icon] : CARD_BG[index % CARD_BG.length]
}
/** "2026-09-23" → "9.23" */
export const shortDay = (day: string) => day.split('-').slice(1).map(Number).join('.')
export const ARTICLE_CAT: Record<number, [string, string]> = { 1: ['계절 소식', 'text-[#1f9d62]'], 2: ['날씨 상식', 'text-[#7a5cd6]'], 3: ['각 원리', 'text-(--orange)'] }
/** 읽을거리 한 줄 정보: "계절 소식 · 3분" */
export const articleMeta = (a: { category: number; read_minutes: number }) => `${ARTICLE_CAT[a.category]?.[0] ?? '읽을거리'} · ${a.read_minutes}분`