feat: 카드뉴스 포스트(관리자 admin/, /v1/card API, 피드 이미지 슬라이드), 인스타 홍보 기획 문서
This commit is contained in:
1 parent
96cbd19c61
commit
739a8c59eb
107 files changed
+17684
-19
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import spec from '../../topics.json'
|
||||
|
||||
/** 날씨 타로 주제(대주제 > 소주제). 대주제마다 꾸밈(skin)·기본 색·먼저 고를 아이콘이 정해져 있다 (topics.json) */
|
||||
export type Category = (typeof spec.categories)[number]
|
||||
export const CATEGORIES: Category[] = spec.categories
|
||||
|
||||
/** '이별', '연애 이별', '연애' 처럼 들어온 주제에서 대주제를 찾는다 */
|
||||
export function categoryOf(topic: string) {
|
||||
const t = topic.trim()
|
||||
return CATEGORIES.find((c) => t.includes(c.name) || c.subtopics.some((s) => t.includes(s)))
|
||||
}
|
||||
|
||||
/** 그 주제의 타로 질문 (소주제 질문, 없으면 대주제 질문) */
|
||||
export function questionOf(topic: string) {
|
||||
const c = categoryOf(topic)
|
||||
if (!c) return ''
|
||||
const sub = c.subtopics.find((x) => topic.includes(x))
|
||||
const q = c.questions as Record<string, string | undefined>
|
||||
return q[sub ?? ''] ?? q[''] ?? ''
|
||||
}
|
||||
Reference in new issue
Block a user