feat : 자료실 무한 스크롤·TUI 달력 팝업 추가
SpecialSource Frontend (React) CD / deploy (push) Successful in 14s

- 목록을 30건씩 id 커서로 이어 불러옴 (MoreSentinel 재사용), 글 보기에서 돌아와도 불러온 글·스크롤 유지
- 받는 중 진행률 갱신은 첫 페이지만 다시 받아 합침 (아래쪽 불러온 글 유지)
- 날짜 검색: 브라우저 기본 달력 대신 <dialog> 레이어 달력 (방향키·PageUp/Down·Enter·Esc, 오늘/지우기)
- 글 수정 시 목록에도 바로 반영

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
headporterandClaude Opus 5.5 committed 2026-11-27 18:12:55 +09:00
1 parent d359c35304
commit 60ab3e9ff6
9 files changed
+283 -34

No files matched your search

+16 -7
View File
@@ -1,10 +1,15 @@
import { useState, type FormEvent } from "react";
import { createMediaPost } from "../api";
import type { MediaPost, MediaQuery } from "../types";
import DatePicker from "./DatePicker";
import { MoreSentinel } from "./PostList";
import styles from "./bbs.module.css";
interface Props {
posts: MediaPost[] | null;
total: number; // 조건에 맞는 전체 건수
last: boolean; // 더 불러올 글이 없음
onMore: () => void; // 목록 끝이 보이면 다음 페이지 불러오기 (무한 스크롤)
categories: string[];
query: MediaQuery;
token: string | null;
@@ -24,8 +29,9 @@ export const bar = (percent: number, width = 10) => {
const EMPTY_SEARCH = { q: "", from: "", to: "" };
/** [4] 자료실: 분류 탭 / 링크 등록 / 검색 / 목록. 받는 중인 글이 있으면 BbsTerminal이 2초마다 새로고침 */
export default function MediaList({ posts, categories, query, token, onSelect, onQuery, onCreated, onError }: Props) {
/** [4] 자료실: 분류 탭 / 링크 등록 / 검색 / 목록(무한 스크롤). 받는 중인 글이 있으면 BbsTerminal이 2초마다 진행률 갱신 */
export default function MediaList(props: Props) {
const { posts, total, last, onMore, categories, query, token, onSelect, onQuery, onCreated, onError } = props;
const [busy, setBusy] = useState(false);
const tabs = [{ key: null, name: "전체" }, ...categories.map((c) => ({ key: c, name: c })), { key: "", name: "미분류" }];
const searching = query.q || query.from || query.to;
@@ -61,7 +67,7 @@ export default function MediaList({ posts, categories, query, token, onSelect, o
return (
<section className={`${styles.win} ${styles.full}`}>
<span className={styles.cap}>
═ [4] 자료실{posts && ` (${posts.length}건${searching ? " 검색됨" : ""})`} ═
═ [4] 자료실{posts && ` (${total}건${searching ? " 검색됨" : ""})`} ═
</span>
{!token ? (
<div className={styles.dim}>로그인이 필요합니다. (F5 또는 메인에서 7)</div>
@@ -107,11 +113,13 @@ export default function MediaList({ posts, categories, query, token, onSelect, o
<span className={styles.num}>검색</span>
<input name="q" defaultValue={query.q} placeholder="제목" />
</label>
<label>
{/* 브라우저 기본 달력 대신 TUI 스타일 달력 팝업 (DatePicker가 hidden input으로 from/to 제출) */}
{/* label이 아닌 div: label 안이면 팝업 배경을 눌러 닫을 때 그 클릭이 첫 버튼으로 전달돼 다시 열림 */}
<div className={styles.dates}>
<span className={styles.num}>날짜</span>
<input name="from" type="date" className={styles.date} defaultValue={query.from} aria-label="시작일" />~
<input name="to" type="date" className={styles.date} defaultValue={query.to} aria-label="종료일" />
</label>
<DatePicker name="from" defaultValue={query.from} label="시작일" />~
<DatePicker name="to" defaultValue={query.to} label="종료일" />
</div>
<span>
<button type="submit">검색</button>{" "}
{searching && (
@@ -156,6 +164,7 @@ export default function MediaList({ posts, categories, query, token, onSelect, o
</tbody>
</table>
)}
{posts && posts.length > 0 && <MoreSentinel last={last} onMore={onMore} />}
</>
)}
<div className={styles.footer}>