/** * Header component with logo and pipeline trigger. */ import React from "react"; import { ChevronDown, Loader2, Play, RefreshCcw, Rocket, Trash2 } from "lucide-react"; import { Button } from "@/components/ui/button"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import type { JobSource } from "../../shared/types"; interface HeaderProps { onRunPipeline: () => void; onRefresh: () => void; onClearDatabase: () => void; isPipelineRunning: boolean; isLoading: boolean; pipelineSources: JobSource[]; onPipelineSourcesChange: (sources: JobSource[]) => void; } export const Header: React.FC = ({ onRunPipeline, onRefresh, onClearDatabase, isPipelineRunning, isLoading, pipelineSources, onPipelineSourcesChange, }) => { const sourceLabel: Record = { gradcracker: "Gradcracker", indeed: "Indeed", linkedin: "LinkedIn", }; const orderedSources: JobSource[] = ["gradcracker", "indeed", "linkedin"]; const toggleSource = (source: JobSource, checked: boolean) => { const next = checked ? Array.from(new Set([...pipelineSources, source])) : pipelineSources.filter((s) => s !== source); if (next.length === 0) return; onPipelineSourcesChange(next); }; return (
Job Ops
Orchestrator
Clear all jobs? This deletes all jobs from the database. This action cannot be undone. Cancel Clear database
Sources {orderedSources.map((source) => ( toggleSource(source, Boolean(checked))} > {sourceLabel[source]} ))} onPipelineSourcesChange(orderedSources)}> All sources onPipelineSourcesChange(["gradcracker"])}> Gradcracker only onPipelineSourcesChange(["indeed", "linkedin"])}> Indeed + LinkedIn only
); };