mirror of
https://github.com/headporter81/ss-front-react.git
synced 2026-12-06 07:41:11 +09:00
feat : 자료실 카테고리 탭·등록 분류·제목/날짜 검색·다운로드 진행률 표시
SpecialSource Frontend (React) CD / deploy (push) Successful in 14s
SpecialSource Frontend (React) CD / deploy (push) Successful in 14s
- 분류 탭(B0 전체 · B1~ 분류 · 마지막 미분류), 등록 칸은 datalist로 고르거나 새로 입력 - 제목·날짜 범위 검색 + 초기화 - 받는 중이면 2초마다 갱신하며 ▓░ 진행 막대와 속도 표시 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eaca07da53
commit
aff5d61aa8
7 files changed
+152
-26
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { API_URL, deleteMediaPost, fetchMediaPost } from "../api";
|
||||
import type { MediaPost } from "../types";
|
||||
import { STATUS } from "./MediaList";
|
||||
import { bar, STATUS } from "./MediaList";
|
||||
import styles from "./bbs.module.css";
|
||||
|
||||
/** 자료실 글 보기: 파일마다 <video>/<img>. 파일 주소의 토큰은 1시간 유효 → 오래 열어 두었으면 "L" 후 다시 열기 */
|
||||
@@ -29,7 +29,7 @@ export default function MediaDetail({ id, token, onError, onDeleted }: Props) {
|
||||
}
|
||||
};
|
||||
|
||||
// 받는 중이면 5초마다 다시 조회 → 끝나면 파일이 나타남
|
||||
// 받는 중이면 2초마다 다시 조회 → 진행률 갱신, 끝나면 파일이 나타남
|
||||
useEffect(() => {
|
||||
let stale = false;
|
||||
let timer: ReturnType<typeof setTimeout>;
|
||||
@@ -38,7 +38,7 @@ export default function MediaDetail({ id, token, onError, onDeleted }: Props) {
|
||||
.then((p) => {
|
||||
if (stale) return;
|
||||
setPost(p);
|
||||
if (p.status === "DOWNLOADING") timer = setTimeout(load, 5000);
|
||||
if (p.status === "DOWNLOADING") timer = setTimeout(load, 2000);
|
||||
})
|
||||
.catch((e) => !stale && onError(e));
|
||||
load();
|
||||
@@ -63,12 +63,16 @@ export default function MediaDetail({ id, token, onError, onDeleted }: Props) {
|
||||
<span>제목 :</span> {post.title}
|
||||
</div>
|
||||
<div className={styles.postHead}>
|
||||
<span>등록:</span> {post.author} <span>날짜:</span> {post.createdAt.slice(0, 16).replace("T", " ")}{" "}
|
||||
<span>분류:</span> {post.category ?? "미분류"} <span>등록:</span> {post.author} <span>날짜:</span> {post.createdAt.slice(0, 16).replace("T", " ")}{" "}
|
||||
<span>상태:</span> {STATUS[post.status]}
|
||||
</div>
|
||||
<hr className={styles.rule} />
|
||||
{post.status === "DOWNLOADING" ? (
|
||||
<div className={styles.dim}>다운로드 중입니다... 끝나면 자동으로 표시됩니다.</div>
|
||||
<div>
|
||||
<span className={styles.accent}>{post.progress === null ? "다운로드 준비 중..." : bar(post.progress, 20)}</span>
|
||||
{post.speed && <span className={styles.dim}> · {post.speed}</span>}
|
||||
<div className={styles.dim}>끝나면 자동으로 표시됩니다.</div>
|
||||
</div>
|
||||
) : post.files.length === 0 ? (
|
||||
<div className={styles.error}>※ 다운로드에 실패했습니다. (쿠키 만료·삭제된 게시물·지원하지 않는 링크)</div>
|
||||
) : (
|
||||
|
||||
Reference in new issue
Block a user