mirror of
https://github.com/headporter81/ss-front-react.git
synced 2026-12-06 07:41:11 +09:00
- 목록을 30건씩 id 커서로 이어 불러옴 (MoreSentinel 재사용), 글 보기에서 돌아와도 불러온 글·스크롤 유지 - 받는 중 진행률 갱신은 첫 페이지만 다시 받아 합침 (아래쪽 불러온 글 유지) - 날짜 검색: 브라우저 기본 달력 대신 <dialog> 레이어 달력 (방향키·PageUp/Down·Enter·Esc, 오늘/지우기) - 글 수정 시 목록에도 바로 반영 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d359c35304
commit
60ab3e9ff6
9 files changed
+283
-34
No files matched your search
@@ -23,21 +23,23 @@ interface Props {
|
||||
categories: string[]; // 수정 칸 분류 자동완성
|
||||
onError: (e: unknown) => void;
|
||||
onDeleted: () => void; // 삭제 성공 → 목록으로
|
||||
onEdited: (post: MediaPost) => void; // 수정 성공 → 목록에도 반영
|
||||
}
|
||||
|
||||
export default function MediaDetail({ id, token, categories, onError, onDeleted }: Props) {
|
||||
export default function MediaDetail({ id, token, categories, onError, onDeleted, onEdited }: Props) {
|
||||
const [post, setPost] = useState<MediaPost | null>(null);
|
||||
const [confirming, setConfirming] = useState(false); // [삭제] 한 번 누르면 "정말?" 확인 단계
|
||||
const [editing, setEditing] = useState(false); // [수정] 누르면 제목·분류 입력칸으로 바뀜
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
// 목록으로 돌아가면 목록·분류 탭을 다시 불러오므로 바뀐 내용이 그대로 반영됨
|
||||
const save = async (e: FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
const data = new FormData(e.currentTarget);
|
||||
setBusy(true);
|
||||
try {
|
||||
setPost(await updateMediaPost(token, id, String(data.get("title")).trim(), String(data.get("category")).trim()));
|
||||
const updated = await updateMediaPost(token, id, String(data.get("title")).trim(), String(data.get("category")).trim());
|
||||
setPost(updated);
|
||||
onEdited(updated);
|
||||
setEditing(false);
|
||||
} catch (err) {
|
||||
onError(err);
|
||||
|
||||
Reference in new issue
Block a user