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,
|
reorderChapters,
|
||||||
approveChapters,
|
approveChapters,
|
||||||
type Chapter,
|
type Chapter,
|
||||||
type ChapterPatch,
|
|
||||||
type VideoDetail,
|
type VideoDetail,
|
||||||
} from "../api/videos";
|
} from "../api/videos";
|
||||||
import { fetchConsentList, type VideoConsentRead } from "../api/consent";
|
import { fetchConsentList, type VideoConsentRead } from "../api/consent";
|
||||||
|
|
@ -29,11 +28,11 @@ function formatTime(seconds: number): string {
|
||||||
function statusBadgeClass(status: string): string {
|
function statusBadgeClass(status: string): string {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case "approved":
|
case "approved":
|
||||||
return styles.badgeApproved;
|
return styles.badgeApproved ?? "";
|
||||||
case "hidden":
|
case "hidden":
|
||||||
return styles.badgeHidden;
|
return styles.badgeHidden ?? "";
|
||||||
default:
|
default:
|
||||||
return styles.badgeDraft;
|
return styles.badgeDraft ?? "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,7 +302,9 @@ function ChapterReviewDetail({ videoId }: { videoId: string }) {
|
||||||
async (index: number) => {
|
async (index: number) => {
|
||||||
if (!videoId || index <= 0) return;
|
if (!videoId || index <= 0) return;
|
||||||
const newList = [...chapters];
|
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 }));
|
const order = newList.map((c, i) => ({ id: c.id, sort_order: i }));
|
||||||
setChapters(newList);
|
setChapters(newList);
|
||||||
try {
|
try {
|
||||||
|
|
@ -320,7 +321,9 @@ function ChapterReviewDetail({ videoId }: { videoId: string }) {
|
||||||
async (index: number) => {
|
async (index: number) => {
|
||||||
if (!videoId || index >= chapters.length - 1) return;
|
if (!videoId || index >= chapters.length - 1) return;
|
||||||
const newList = [...chapters];
|
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 }));
|
const order = newList.map((c, i) => ({ id: c.id, sort_order: i }));
|
||||||
setChapters(newList);
|
setChapters(newList);
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ function formatDuration(secs: number): string {
|
||||||
function statusBadgeClass(status: string): string {
|
function statusBadgeClass(status: string): string {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case "approved":
|
case "approved":
|
||||||
return styles.badgeApproved;
|
return styles.badgeApproved ?? "";
|
||||||
case "rejected":
|
case "rejected":
|
||||||
return styles.badgeRejected;
|
return styles.badgeRejected ?? "";
|
||||||
default:
|
default:
|
||||||
return styles.badgeCandidate;
|
return styles.badgeCandidate ?? "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue