feat(themes): 테마 인덱스/상세 (11 카테고리 · 111 종목)
- seed/themes.py: 반도체/2차전지/바이오/게임/엔터/자동차/금융/조선·방산/플랫폼·AI/유통·소비재/에너지 정적 매핑
- /api/themes (인덱스) + /api/themes/{slug} (종목 카드 + 최신 종가/등락)
- 홈에 ThemeTiles 그리드, /themes/{slug} 상세 페이지
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -186,6 +186,25 @@ export type RelatedResponse = {
|
||||
items: Mover[];
|
||||
};
|
||||
|
||||
export type ThemeIndex = {
|
||||
slug: string;
|
||||
name: string;
|
||||
description: string;
|
||||
code_count: number;
|
||||
};
|
||||
|
||||
export type ThemesIndexResponse = {
|
||||
items: ThemeIndex[];
|
||||
total: number;
|
||||
};
|
||||
|
||||
export type ThemeDetailResponse = {
|
||||
slug: string;
|
||||
name: string;
|
||||
description: string;
|
||||
items: Mover[];
|
||||
};
|
||||
|
||||
async function getJson<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
const res = await fetch(`${API_BASE}${path}`, {
|
||||
...init,
|
||||
@@ -239,4 +258,9 @@ export const api = {
|
||||
getJson<RelatedResponse>(
|
||||
`/api/markets/related/${encodeURIComponent(code)}?limit=${limit}`,
|
||||
),
|
||||
themesIndex: () => getJson<ThemesIndexResponse>(`/api/themes`),
|
||||
themeDetail: (slug: string, limit = 30) =>
|
||||
getJson<ThemeDetailResponse>(
|
||||
`/api/themes/${encodeURIComponent(slug)}?limit=${limit}`,
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user