import { Clock, RotateCcw, AlertCircle, Loader2, CheckCircle2 } from "lucide-react";
import { Link } from "@/lib/router";
import { Button } from "@/components/ui/button";
import { cn, formatDateTime } from "@/lib/utils";
import { formatMonitorOffset } from "@/lib/issue-monitor";
import { formatRetryReason } from "@/lib/runRetryState";
import type { IssueScheduledRetry } from "@paperclipai/shared";
import { useRetryNowMutation, type RetryNowError } from "../hooks/useRetryNowMutation";
import { Badge } from "@/components/ui/badge";
import { InlineBanner } from "@/components/InlineBanner";
const MAX_TURN_CONTINUATION = "max_turns_continuation";
function isContinuationReason(reason: string | null | undefined) {
return reason === MAX_TURN_CONTINUATION;
}
function shortRunId(runId: string | null | undefined) {
return typeof runId === "string" && runId.length >= 8 ? runId.slice(0, 8) : runId ?? "";
}
interface IssueScheduledRetryCardProps {
issueId: string | null | undefined;
scheduledRetry: IssueScheduledRetry | null | undefined;
}
export function IssueScheduledRetryCard({
issueId,
scheduledRetry,
}: IssueScheduledRetryCardProps) {
const retryNow = useRetryNowMutation(issueId);
if (!scheduledRetry || !issueId) return null;
if (scheduledRetry.status !== "scheduled_retry") return null;
if (scheduledRetry.scheduledRetryReason === "workspace_busy") {
return (