fix: resolve TS errors in ChapterReview and HighlightQueue (noUncheckedIndexedAccess)
This commit is contained in:
parent
3bea232a1c
commit
ddeaf9ac41
2 changed files with 12 additions and 9 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue