Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

feat(timeline): name the cascading interviewer and prep-question counts in the stage delete confirmation, and let DeleteAlertDialog take a node

Khuram Niaz982333df4606
diff --git a/src/components/DeleteAlertDialog.tsx b/src/components/DeleteAlertDialog.tsx
index 08fa437..5d67e8b 100644
--- a/src/components/DeleteAlertDialog.tsx
+++ b/src/components/DeleteAlertDialog.tsx
@@ -1,3 +1,4 @@
+import type { ReactNode } from "react";
import {
AlertDialog,
AlertDialogAction,
@@ -16,7 +17,7 @@ interface DeleteAlertDialogProps {
onOpenChange: (open: boolean) => void;
onDelete: () => void;
alertTitle?: string;
- alertDescription?: string;
+ alertDescription?: ReactNode;
deleteAction?: boolean;
actionLabel?: string;
actionVariant?: "destructive" | "default";
@@ -40,7 +41,10 @@ export function DeleteAlertDialog({
<AlertDialogTitle>
{alertTitle ?? `Are you sure you want to delete this ${pageTitle}?`}
</AlertDialogTitle>
- <AlertDialogDescription>{alertDescription}</AlertDialogDescription>
+ {/* asChild: a description may carry a list, which cannot nest in a p. */}
+ <AlertDialogDescription asChild>
+ <div>{alertDescription}</div>
+ </AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
diff --git a/src/components/myjobs/job-details/timeline/StageDetailPanel.tsx b/src/components/myjobs/job-details/timeline/StageDetailPanel.tsx
index 9576249..018bad4 100644
--- a/src/components/myjobs/job-details/timeline/StageDetailPanel.tsx
+++ b/src/components/myjobs/job-details/timeline/StageDetailPanel.tsx
@@ -1,6 +1,7 @@
"use client";
import { useEffect, useState, useTransition } from "react";
import { CalendarDays, Pencil, Trash2 } from "lucide-react";
+import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { DeleteAlertDialog } from "@/components/DeleteAlertDialog";
@@ -51,6 +52,54 @@ export function StageDetailPanel({
setTab("overview");
}, [stage.id]);
+ // Both joins cascade with the stage, so the confirmation names what goes.
+ const interviewerCount = stage.interviewers?.length ?? 0;
+ const prepCount = stage.prepQuestions?.length ?? 0;
+ const hasLinks = interviewerCount > 0 || prepCount > 0;
+ const deleteDescription =
+ isCurrent || hasLinks ? (
+ <>
+ {isCurrent && (
+ <p>
+ This is the current stage. Deleting it makes the stage before it
+ current, and the job&apos;s status follows that stage.
+ </p>
+ )}
+ {hasLinks && (
+ <>
+ <p className={cn(isCurrent && "mt-2")}>Deleting it also removes:</p>
+ <ul className="mt-1.5 list-disc space-y-1 pl-5">
+ {interviewerCount > 0 && (
+ <li>
+ <span className="font-semibold text-foreground">
+ {interviewerCount} linked{" "}
+ {interviewerCount === 1 ? "interviewer" : "interviewers"}
+ </span>{" "}
+ on this stage
+ </li>
+ )}
+ {prepCount > 0 && (
+ <li>
+ <span className="font-semibold text-foreground">
+ {prepCount} prep{" "}
+ {prepCount === 1 ? "question" : "questions"}
+ </span>{" "}
+ on this stage, and which of them were asked
+ </li>
+ )}
+ </ul>
+ <p className="mt-2">
+ {interviewerCount > 0 && prepCount > 0
+ ? "Nothing is removed from the job's Contacts tab or your question bank."
+ : interviewerCount > 0
+ ? "Nothing is removed from the job's Contacts tab."
+ : "Nothing is removed from your question bank."}
+ </p>
+ </>
+ )}
+ </>
+ ) : undefined;
+
const onDelete = () => {
setDeleteOpen(false);
startTransition(async () => {
@@ -151,11 +200,7 @@ export function StageDetailPanel({
onOpenChange={setDeleteOpen}
onDelete={onDelete}
alertTitle={`Delete the ${stage.StageType.label} stage?`}
- alertDescription={
- isCurrent
- ? "This is the current stage. Deleting it makes the stage before it current, and the job's status follows that stage."
- : undefined
- }
+ alertDescription={deleteDescription}
/>
</div>
);