import { useEffect, useState } from "react"; import { Download, Search } from "lucide-react"; import type { BacklinksOverviewData, BacklinksSearchState, } from "./backlinksPageTypes"; import { TAB_DESCRIPTIONS } from "./backlinksPageUtils"; import { exportBacklinksTabCsv } from "./export"; type BacklinksResultsData = { backlinks: BacklinksOverviewData["backlinks"]; referringDomains: BacklinksOverviewData["referringDomains"]; topPages: BacklinksOverviewData["topPages"]; }; export function ResultsHeader({ activeTab, filterText, hideSpam, spamThreshold, onFilterTextChange, onSetActiveTab, onSetHideSpam, onSetSpamThreshold, filteredData, exportTarget, }: { activeTab: BacklinksSearchState["tab"]; filterText: string; hideSpam: boolean; spamThreshold: number; onFilterTextChange: (value: string) => void; onSetActiveTab: (tab: BacklinksSearchState["tab"]) => void; onSetHideSpam: (hideSpam: boolean) => void; onSetSpamThreshold: (threshold: number) => void; filteredData: BacklinksResultsData; exportTarget: string; }) { const [draftSpamThreshold, setDraftSpamThreshold] = useState( String(spamThreshold), ); useEffect(() => { setDraftSpamThreshold(String(spamThreshold)); }, [spamThreshold]); function commitSpamThreshold() { onSetSpamThreshold( draftSpamThreshold.trim() === "" ? spamThreshold : Number(draftSpamThreshold), ); } return (
{TAB_DESCRIPTIONS[activeTab]}