feat: 카드뉴스 포스트(관리자 admin/, /v1/card API, 피드 이미지 슬라이드), 인스타 홍보 기획 문서

This commit is contained in:
minaChoi committed 2026-10-23 15:38:07 +09:00
1 parent 96cbd19c61
commit 739a8c59eb
107 files changed
+17684 -19

No files matched your search

+8 -2
View File
@@ -1,6 +1,7 @@
import { useEffect, useRef, useState, type CSSProperties, type MouseEvent, type ReactNode } from 'react'
import { createPortal } from 'react-dom'
import { PostType, SlotTone, type GakSlide, type HoursSlide, type PlanSlide, type PostData, type ResFeed, type RowsSlide, type SunsetSlide, type WeekSlide } from '../api/client/types.gen'
import { PostType, SlotTone, type GakSlide, type HoursSlide, type ImageSlide, type PlanSlide, type PostData, type ResFeed, type RowsSlide, type SunsetSlide, type WeekSlide } from '../api/client/types.gen'
import { API_BASE_URL } from '../api/setup'
import { cx } from '../lib/utils'
import { cardBg, clockShort, fall } from './lib'
import type { SlideBg } from './types'
@@ -29,9 +30,10 @@ const ACCOUNTS: Record<PostType, readonly [string, string]> = {
[PostType.DAY_TRIP]: ['당일치기', 'picnic'],
[PostType.MOON]: ['오늘 밤 달', 'moon'],
[PostType.UV]: ['자외선', 'glasses'],
[PostType.CARD]: ['날씨각 카드', 'stars'],
}
type Slide = HoursSlide | RowsSlide | GakSlide | SunsetSlide | WeekSlide | PlanSlide
type Slide = HoursSlide | RowsSlide | GakSlide | SunsetSlide | WeekSlide | PlanSlide | ImageSlide
const GAK_BG: SlideBg[] = ['butter', 'peach', 'lilac']
const ROW_ICON_BG: Record<string, SlideBg> = { umbrella: 'lilac', vent: 'mint', sunset: 'peach', thermo: 'sky', maple: 'peach', moon: 'lilac', glasses: 'butter' }
@@ -43,6 +45,7 @@ function slideBg(post: PostData, slide: Slide): SlideBg {
if (slide.kind === 'week') return 'mint'
if (slide.kind === 'plan') return slide.eyebrow.startsWith('일') ? 'peach' : 'butter'
if (slide.kind === 'gak') return GAK_BG[post.post_id % GAK_BG.length]
if (slide.kind === 'image') return 'sky'
if (post.post_type === PostType.EVENT) return 'night'
if (post.post_type === PostType.TIP) return 'sky'
if (post.post_type === PostType.AIR) return slide.icon === 'vent' ? 'mint' : 'lilac'
@@ -209,6 +212,9 @@ function SlideView({ slide, bg }: { slide: Slide; bg: SlideBg }) {
</div>
)
}
// 카드뉴스: 관리자가 만든 4:5 이미지 한 장 (/v1/card/... 는 API 서버 경로)
if (slide.kind === 'image')
return <img src={slide.url.startsWith('/') ? `${API_BASE_URL}${slide.url}` : slide.url} alt={slide.alt ?? ''} className="h-full w-full shrink-0 object-cover" loading="lazy" draggable={false} />
if (slide.kind === 'rows' && slide.image)
return (
<div className={'relative flex h-full w-full shrink-0 flex-col justify-end bg-cover bg-center text-white'} style={{ backgroundImage: `url(${slide.image})` }}>