diff --git a/frontend/src/pages/ChapterReview.tsx b/frontend/src/pages/ChapterReview.tsx index b289f6f..3176f13 100644 --- a/frontend/src/pages/ChapterReview.tsx +++ b/frontend/src/pages/ChapterReview.tsx @@ -11,7 +11,6 @@ import { reorderChapters, approveChapters, type Chapter, - type ChapterPatch, type VideoDetail, } from "../api/videos"; import { fetchConsentList, type VideoConsentRead } from "../api/consent"; @@ -29,11 +28,11 @@ function formatTime(seconds: number): string { function statusBadgeClass(status: string): string { switch (status) { case "approved": - return styles.badgeApproved; + return styles.badgeApproved ?? ""; case "hidden": - return styles.badgeHidden; + return styles.badgeHidden ?? ""; default: - return styles.badgeDraft; + return styles.badgeDraft ?? ""; } } @@ -303,7 +302,9 @@ function ChapterReviewDetail({ videoId }: { videoId: string }) { async (index: number) => { if (!videoId || index <= 0) return; const newList = [...chapters]; - [newList[index - 1], newList[index]] = [newList[index], newList[index - 1]]; + const a = newList[index - 1]; const b = newList[index]; + if (!a || !b) return; + [newList[index - 1], newList[index]] = [b, a]; const order = newList.map((c, i) => ({ id: c.id, sort_order: i })); setChapters(newList); try { @@ -320,7 +321,9 @@ function ChapterReviewDetail({ videoId }: { videoId: string }) { async (index: number) => { if (!videoId || index >= chapters.length - 1) return; const newList = [...chapters]; - [newList[index], newList[index + 1]] = [newList[index + 1], newList[index]]; + const a = newList[index]; const b = newList[index + 1]; + if (!a || !b) return; + [newList[index], newList[index + 1]] = [b, a]; const order = newList.map((c, i) => ({ id: c.id, sort_order: i })); setChapters(newList); try { diff --git a/frontend/src/pages/HighlightQueue.tsx b/frontend/src/pages/HighlightQueue.tsx index 12fbb2a..ed76689 100644 --- a/frontend/src/pages/HighlightQueue.tsx +++ b/frontend/src/pages/HighlightQueue.tsx @@ -23,11 +23,11 @@ function formatDuration(secs: number): string { function statusBadgeClass(status: string): string { switch (status) { case "approved": - return styles.badgeApproved; + return styles.badgeApproved ?? ""; case "rejected": - return styles.badgeRejected; + return styles.badgeRejected ?? ""; default: - return styles.badgeCandidate; + return styles.badgeCandidate ?? ""; } }