- {Array.from({ length: 6 }).map((_, i) => (
-
+
+ {Array.from({ length: cfg.pageSize }).map((_, i) => (
+
))}
) : isMaintenance ? (
-
+
넥슨 Open API 점검중
-
점검이 끝나면 다시 표시됩니다
- ) : initialItems.length === 0 ? (
-
+ ) : slice.length === 0 ? (
+
+ {cfg.filterOngoing ? `진행중인 ${cfg.label}이 없습니다` : `등록된 ${cfg.label}이 없습니다`}
+
+ ) : (
+
- {tab.filterOngoing ? `진행중인 ${tab.label}이 없습니다` : `등록된 ${tab.label}이 없습니다`}
+ {slice.map((it) => )}
- ) : (
- <>
-
-
- {initialItems.map((notice) => (
-
- ))}
-
-
-
- {/* 펼쳐지는 영역 */}
-
- {hasMore && expanded && (
-
-
- {extraItems.map((notice) => (
-
- ))}
-
-
- )}
-
- >
- )}
-
- {/* 더보기 / 접기 */}
- {hasMore && (
-
)}
)
}
+
+/* ─── Root ──────────────────────────────────────────────────── */
+
+export default function NoticeWidget() {
+ const queries = useQueries({
+ queries: Object.keys(SECTIONS).map((key) => ({
+ queryKey: ['notices', key],
+ queryFn: () => api(`/api/notices?type=${key}`),
+ staleTime: 5 * 60 * 1000,
+ retry: (n, err) => (err?.maintenance ? false : n < 1),
+ })),
+ })
+
+ const byKey = Object.keys(SECTIONS).reduce((acc, key, i) => {
+ const q = queries[i]
+ const cfg = SECTIONS[key]
+ const list = q.data?.[cfg.dataKey] || []
+ const items = cfg.filterOngoing ? list.filter((n) => isOngoing(n, cfg)) : list
+ acc[key] = { items, isLoading: q.isLoading, isMaintenance: !!q.error?.maintenance }
+ return acc
+ }, {})
+
+ return (
+
+ )
+}
diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx
index 60278db..cf52ad3 100644
--- a/frontend/src/pages/Home.jsx
+++ b/frontend/src/pages/Home.jsx
@@ -10,10 +10,7 @@ export default function Home() {
})
return (
-
- {/* 메이플 공지 */}
-
-
+
{/* 구분선 */}
@@ -57,6 +54,16 @@ export default function Home() {
)}
+
+ {/* 구분선 */}
+
+
+ {/* 메이플 공지 */}
+
)
}