refactor: Entscheider-Kategorie als Einzelauswahl (Radio)

- Nur noch eine Kategorie gleichzeitig wählbar (Array → einzelner Wert)
- ceo-Label: "CEO / Owner / President / Founder" mit Empfohlen-Badge
- API-Aufruf sendet [category] statt categories[]
- Überflüssige Validierungen entfernt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Timo Uttenweiler
2026-03-17 13:05:14 +01:00
parent 717bc4f943
commit 39760b20a9
4 changed files with 61 additions and 71 deletions

View File

@@ -19,12 +19,12 @@ import { useAppStore } from "@/lib/store";
import type { DecisionMakerCategory } from "@/lib/services/anymailfinder";
import type { ExportRow } from "@/lib/utils/csv";
const CATEGORY_OPTIONS: { value: DecisionMakerCategory; label: string }[] = [
{ value: "ceo", label: "CEO / Inhaber / Gründer" },
{ value: "operations", label: "COO / Geschäftsführung" },
{ value: "engineering", label: "CTO / Technik" },
{ value: "marketing", label: "CMO / Marketing" },
{ value: "finance", label: "CFO / Finanzen" },
const CATEGORY_OPTIONS: { value: DecisionMakerCategory; label: string; recommended?: boolean }[] = [
{ value: "ceo", label: "CEO / Owner / President / Founder", recommended: true },
{ value: "operations", label: "COO" },
{ value: "engineering", label: "CTO" },
{ value: "marketing", label: "CMO" },
{ value: "finance", label: "CFO" },
{ value: "sales", label: "Vertriebsleiter" },
];
@@ -42,7 +42,7 @@ export default function LinkedInPage() {
const [enrichProgress, setEnrichProgress] = useState({ current: 0, total: 0 });
const [results, setResults] = useState<ResultRow[]>([]);
const [selectedIds, setSelectedIds] = useState<string[]>([]);
const [categories, setCategories] = useState<DecisionMakerCategory[]>(["ceo"]);
const [category, setCategory] = useState<DecisionMakerCategory>("ceo");
const { addJob, updateJob, removeJob } = useAppStore();
useEffect(() => {
@@ -115,7 +115,6 @@ export default function LinkedInPage() {
const startEnrich = async () => {
if (!selectedIds.length) return toast.error("Mindestens ein Profil zum Anreichern auswählen");
if (!categories.length) return toast.error("Mindestens eine Kategorie auswählen");
setStage("enriching");
setEnrichProgress({ current: 0, total: selectedIds.length });
@@ -124,7 +123,7 @@ export default function LinkedInPage() {
const res = await fetch("/api/jobs/linkedin-enrich", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ jobId: scrapeJobId, resultIds: selectedIds, categories }),
body: JSON.stringify({ jobId: scrapeJobId, resultIds: selectedIds, categories: [category] }),
});
const data = await res.json() as { jobId?: string; error?: string };
if (!res.ok || !data.jobId) throw new Error(data.error || "Failed");
@@ -355,16 +354,17 @@ export default function LinkedInPage() {
{CATEGORY_OPTIONS.map(opt => (
<button
key={opt.value}
onClick={() => setCategories(prev =>
prev.includes(opt.value) ? prev.filter(c => c !== opt.value) : [...prev, opt.value]
)}
className={`px-3 py-1.5 rounded-lg text-sm font-medium border transition-all ${
categories.includes(opt.value)
onClick={() => setCategory(opt.value)}
className={`flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium border transition-all ${
category === opt.value
? "bg-blue-500/20 text-blue-300 border-blue-500/40"
: "bg-[#0d0d18] text-gray-400 border-[#2e2e3e] hover:border-blue-500/30"
}`}
>
{opt.label}
{opt.recommended && (
<span className="text-[10px] bg-blue-500/30 text-blue-300 px-1.5 py-0.5 rounded font-semibold">Empfohlen</span>
)}
</button>
))}
</div>
@@ -382,7 +382,7 @@ export default function LinkedInPage() {
{stage === "scraped" && (
<Button
onClick={startEnrich}
disabled={!selectedIds.length || !categories.length}
disabled={!selectedIds.length}
className="bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-medium px-8 shadow-lg hover:shadow-blue-500/25 transition-all"
>
{selectedIds.length} ausgewählte Profile mit E-Mails anreichern