feat: rescrape max 20; select all checkbox in scrape results

This commit is contained in:
James 2026-03-20 00:16:09 -04:00
parent 8f143308bf
commit 41d3844a18
2 changed files with 21 additions and 5 deletions

View File

@ -1643,7 +1643,7 @@ func (h *Handlers) RescrapeOrg(w http.ResponseWriter, r *http.Request) {
return
}
const maxPeople = 40
const maxPeople = 20
truncated := false
people := scraped.People
if len(people) > maxPeople {

View File

@ -386,17 +386,24 @@
let title = '';
if (newPeople.length > 0) title = newPeople.length + ' new person' + (newPeople.length !== 1 ? 's' : '') + ' found on website';
else title = 'No new people found';
if (truncated) title += ' (showing first 40 of ' + total + ' — rescrape again for more)';
if (truncated) title += ' (showing first 20 of ' + total + ' — rescrape again for more)';
document.getElementById('rescrapeTitle').textContent = title;
let html = '';
if (truncated) {
html += '<p class="text-xs text-[#c9a84c] mb-3">⚠️ Only the first 40 results were pulled. You can rescrape again to get additional people.</p>';
html += '<p class="text-xs text-[#c9a84c] mb-3">⚠️ Only the first 20 results were pulled. You can rescrape again to get additional people.</p>';
}
if (newPeople.length > 0) {
html += '<div class="mb-3"><p class="text-xs font-medium mb-2" style="color:var(--ds-tx2)">New people — select to add:</p><div class="space-y-1.5">';
html += '<div class="mb-3">'
+ '<div class="flex items-center justify-between mb-2">'
+ '<p class="text-xs font-medium" style="color:var(--ds-tx2)">New people found — select to add:</p>'
+ '<label class="flex items-center gap-1.5 text-xs cursor-pointer" style="color:var(--ds-tx2)">'
+ '<input type="checkbox" id="rescrapeSelectAll" class="accent-[#c9a84c]" onchange="toggleAllRescrape(this.checked)"> Select all'
+ '</label>'
+ '</div>'
+ '<div class="space-y-1.5">';
newPeople.forEach((p, i) => {
html += '<label class="flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer hover:opacity-80" style="background:var(--ds-sf)">'
+ '<input type="checkbox" class="rescrape-cb accent-[#c9a84c]" data-idx="' + i + '">'
+ '<input type="checkbox" class="rescrape-cb accent-[#c9a84c]" data-idx="' + i + '" onchange="syncRescrapeSelectAll()">'
+ '<div class="min-w-0 flex-1"><div class="text-sm text-white truncate">' + escHtml(p.name || p.email) + '</div>'
+ (p.title ? '<div class="text-xs truncate" style="color:var(--ds-tx3)">' + escHtml(p.title) + '</div>' : '') + '</div>'
+ (p.email ? '<div class="text-xs shrink-0" style="color:var(--ds-tx3)">' + escHtml(p.email) + '</div>' : '')
@ -422,6 +429,15 @@
window._rescrapeNewPeople = newPeople;
}
function toggleAllRescrape(checked) {
document.querySelectorAll('.rescrape-cb').forEach(cb => cb.checked = checked);
}
function syncRescrapeSelectAll() {
const all = document.querySelectorAll('.rescrape-cb');
const checked = document.querySelectorAll('.rescrape-cb:checked');
const sa = document.getElementById('rescrapeSelectAll');
if (sa) sa.checked = all.length > 0 && checked.length === all.length;
}
function addRescrapeSelected() {
const people = window._rescrapeNewPeople || [];
const checked = document.querySelectorAll('.rescrape-cb:checked');