Files
songs2vid/components/RecentYouTubeLimitAlert.tsx
T
Atakan Doğan ÖzbanandCursor c8015937f9 Align preview typography with FFmpeg output, add video/song title split, and ship OSS updates.
Separate YouTube video titles from on-video song/artist fields with Pro gating, serve curated fonts and watermark assets for 1:1 preview parity, and include billing/API/docs/deploy stack for self-hosted release.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 16:26:19 +02:00

35 lines
1004 B
TypeScript

"use client";
import { useEffect, useState } from "react";
import { isYouTubeUploadLimitError } from "@/lib/youtube/errors";
import { YouTubeLimitBanner } from "./YouTubeLimitBanner";
/** Shows a dashboard alert when a recent job hit YouTube's upload limit. */
export function RecentYouTubeLimitAlert() {
const [show, setShow] = useState(false);
useEffect(() => {
let active = true;
fetch("/api/jobs?limit=10")
.then(async (res) => {
if (!res.ok) return;
const data = await res.json();
const hit = (data.jobs ?? []).some((job: { items?: Array<{ status: string; error?: string | null }> }) =>
(job.items ?? []).some(
(item) => item.status === "FAILED" && item.error && isYouTubeUploadLimitError(item.error),
),
);
if (active) setShow(hit);
})
.catch(() => {});
return () => {
active = false;
};
}, []);
if (!show) return null;
return <YouTubeLimitBanner className="mb-6" />;
}