{config.lastSkipReason === "insufficient_credits" && (
Last scheduled check was skipped due to insufficient credits. Top up
your balance to resume automatic tracking.
)}
{latestRun?.maybeStale && (
This run may be unresponsive and will be cleaned up automatically.
)}
{/* Results card */}
{/* Domain header */}
setShowAddKeywords((c) => !c)}
/>
{showAddKeywords && (
setShowAddKeywords(false)}
/>
)}
{/* Portfolio overview */}
{(rows?.length ?? 0) > 0 && (
)}
{/* Table toolbar */}
setShowFilters((c) => !c)}
activeFilterCount={activeFilterCount}
isRunning={isRunning}
latestRun={latestRun}
keywordCount={filtered.length}
viewMode={effectiveViewMode}
onViewModeChange={setViewMode}
historyAvailable={historyAvailable}
onExport={() =>
exportRankTrackingCsv(
filtered,
showDesktop,
showMobile,
config.domain,
)
}
onExportToSheets={() =>
exportRankTrackingToSheets(filtered, showDesktop, showMobile)
}
onCopyKeywords={() => {
void navigator.clipboard.writeText(
filtered.map((r) => r.keyword).join("\n"),
);
toast.success("Keywords copied to clipboard");
}}
onCheckNow={() => {
const count = costEstimate?.keywordCount ?? rows?.length ?? 0;
if (count > 0) requestCheck(count);
}}
onRefreshMetrics={refreshMetrics}
metricsRefreshing={metricsRefreshing}
checkBusy={isBusy}
checkDisabled={isFreePlan}
hasData={filtered.length > 0}
/>
{/* Filters panel */}
{showFilters && (
setFilters(EMPTY_FILTERS)}
/>
)}
{/* Table */}
{effectiveViewMode === "history" ? (
({
trackingKeywordId: r.trackingKeywordId,
keyword: r.keyword,
}))}
/>
) : (
)}
{pendingCheck && (
startCheck({
keywordIds: pendingCheck.keywordIds,
})
}
onCancel={() => setPendingCheck(null)}
/>
)}
);
}