diff --git a/apps/admin-ui/src/app/downloads/page.tsx b/apps/admin-ui/src/app/downloads/page.tsx
index ba0a808..8820e2a 100644
--- a/apps/admin-ui/src/app/downloads/page.tsx
+++ b/apps/admin-ui/src/app/downloads/page.tsx
@@ -136,6 +136,26 @@ function progressLabel(job: JobRow): string {
return parts.join(" · ");
}
+function subtitleStatus(job: JobRow): { kind: "ok" | "pending" | "missing"; text: string } | null {
+ if (job.subtitlePath) {
+ return {
+ kind: "ok",
+ text: `Ondertitel: ${job.subtitlePath.split(/[/\\]/).pop()}`,
+ };
+ }
+ if (!job.hasSubtitle && !job.subtitleError) return null;
+ if (job.status === "IMPORTED") {
+ return {
+ kind: "missing",
+ text: job.subtitleError || "Ondertitel ontbreekt in map",
+ };
+ }
+ return {
+ kind: "pending",
+ text: job.subtitleError || "Ondertitel gekozen — wordt bij import geschreven",
+ };
+}
+
function formatBytes(n: number): string {
if (!n || n <= 0) return "—";
const u = ["B", "KB", "MB", "GB", "TB"];
@@ -853,14 +873,13 @@ export default function DownloadsPage() {
{j.movieYear ? ` (${j.movieYear})` : ""}
{j.sourceTitle}
- {j.subtitlePath && (
- Ondertitel: {j.subtitlePath.split(/[/\\]/).pop()}
- )}
- {j.hasSubtitle && !j.subtitlePath && (
-
- {j.subtitleError || j.error || "Ondertitel ontbreekt in map"}
-
- )}
+ {(() => {
+ const sub = subtitleStatus(j);
+ if (!sub) return null;
+ if (sub.kind === "ok") return {sub.text}
;
+ if (sub.kind === "pending") return {sub.text}
;
+ return {sub.text}
;
+ })()}
{j.error && !j.hasSubtitle && {j.error}
}
{(j.status === "FAILED" || j.status === "FINISHED") && (
@@ -903,11 +922,13 @@ export default function DownloadsPage() {
{j.movieTitle}
{j.movieYear ? ` (${j.movieYear})` : ""}
- {j.hasSubtitle && !j.subtitlePath && (
-
- {j.subtitleError || j.error || "Ondertitel ontbreekt"}
-
- )}
+ {(() => {
+ const sub = subtitleStatus(j);
+ if (!sub) return null;
+ if (sub.kind === "ok") return {sub.text} ;
+ if (sub.kind === "pending") return {sub.text} ;
+ return {sub.text} ;
+ })()}
{j.error && !j.hasSubtitle && {j.error} }
|
{j.sourceTitle} |
@@ -985,16 +1006,17 @@ export default function DownloadsPage() {
))}
)}
- {(!j.episodes || j.episodes.length === 0) && j.subtitlePath && (
-
Ondertitel: {j.subtitlePath.split(/[/\\]/).pop()}
- )}
- {(!j.episodes || j.episodes.length === 0) && j.hasSubtitle && !j.subtitlePath && (
-
- {j.subtitleError || j.error || "Ondertitel ontbreekt in map"}
-
- )}
+ {(!j.episodes || j.episodes.length === 0) &&
+ (() => {
+ const sub = subtitleStatus(j);
+ if (!sub) return null;
+ if (sub.kind === "ok") return
{sub.text}
;
+ if (sub.kind === "pending") return
{sub.text}
;
+ return
{sub.text}
;
+ })()}
{(!j.episodes || j.episodes.length === 0) &&
+ j.status === "IMPORTED" &&
j.importedPath &&
!j.subtitlePath && (