Scroll to results anchor when search result is clicked
Immediate scroll before the FCC lookup starts, so the user sees the loading spinner even when the search results list is long. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0d07b6a2d9
commit
5d9b378e55
1 changed files with 1 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ import"./hoisted.yFz1BYXO.js";const k=window.__PW_API||"https://api.performancew
|
||||||
${s.frn?`<span class="text-xs text-gray-500 ml-2">FRN: ${s.frn}</span>`:""}
|
${s.frn?`<span class="text-xs text-gray-500 ml-2">FRN: ${s.frn}</span>`:""}
|
||||||
${s.filer_id?`<span class="text-xs text-gray-500 ml-2">Filer ID: ${s.filer_id}</span>`:""}
|
${s.filer_id?`<span class="text-xs text-gray-500 ml-2">Filer ID: ${s.filer_id}</span>`:""}
|
||||||
<span class="text-xs text-gray-400 ml-2">(${C})</span>
|
<span class="text-xs text-gray-400 ml-2">(${C})</span>
|
||||||
`,i.addEventListener("click",()=>{s.frn?(f.value=s.frn,m()):h("This record has no FRN. Enter an FRN manually to run a compliance check.")}),n.appendChild(i)}}catch{t("search-count").textContent="Search failed. Please try again.",t("search-results")?.classList.remove("hidden")}finally{p.disabled=!1,p.textContent="Search"}}}async function m(){const e=f.value.replace(/\D/g,"").padStart(10,"0");if(e.length!==10||e==="0000000000"){h("Please enter a valid 10-digit FRN.");return}const r=new URL(window.location.href);r.searchParams.set("frn",e),history.replaceState(null,"",r.toString()),t("loading")?.classList.remove("hidden"),t("results")?.classList.add("hidden"),t("error-box")?.classList.add("hidden"),l.disabled=!0,l.textContent="Checking...";try{const o=await fetch(`${k}/api/v1/fcc/lookup?frn=${e}`),d=await o.json();if(!o.ok){h(d.error||"Lookup failed. Please try again.");return}$(d)}catch{h("Could not reach the compliance checker. Please try again.")}finally{t("loading")?.classList.add("hidden"),l.disabled=!1,l.textContent="Check Compliance"}}function h(e){const r=t("error-box"),o=t("error-msg");o.textContent=e,r.classList.remove("hidden"),t("loading")?.classList.add("hidden"),l.disabled=!1,l.textContent="Check Compliance"}function $(e){t("entity-name").textContent=e.entity_name||"Unknown Entity",t("entity-frn").textContent=e.frn;const r=e.cores;r.address?t("entity-address").textContent=[r.address,r.city,r.state,r.zip].filter(Boolean).join(", "):t("entity-address").textContent="Address not available from CORES";const o=t("checks-container");o.innerHTML="";for(const n of e.checks){const a={green:{bg:"bg-green-50",border:"border-green-200",icon:"text-green-600",text:"text-green-800"},yellow:{bg:"bg-amber-50",border:"border-amber-200",icon:"text-amber-600",text:"text-amber-800"},red:{bg:"bg-red-50",border:"border-red-200",icon:"text-red-600",text:"text-red-800"},unknown:{bg:"bg-gray-50",border:"border-gray-200",icon:"text-gray-400",text:"text-gray-600"}},s=a[n.status]||a.unknown,i={green:'<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/></svg>',yellow:'<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"/></svg>',red:'<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/></svg>',unknown:'<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"/></svg>'},u=document.createElement("div");u.className=`${s.bg} ${s.border} border rounded-xl p-4 flex items-start gap-3`,u.innerHTML=`
|
`,i.addEventListener("click",()=>{s.frn?(f.value=s.frn,document.getElementById("pw-results-anchor")?.scrollIntoView({behavior:"smooth",block:"start"}),m()):h("This record has no FRN. Enter an FRN manually to run a compliance check.")}),n.appendChild(i)}}catch{t("search-count").textContent="Search failed. Please try again.",t("search-results")?.classList.remove("hidden")}finally{p.disabled=!1,p.textContent="Search"}}}async function m(){const e=f.value.replace(/\D/g,"").padStart(10,"0");if(e.length!==10||e==="0000000000"){h("Please enter a valid 10-digit FRN.");return}const r=new URL(window.location.href);r.searchParams.set("frn",e),history.replaceState(null,"",r.toString()),t("loading")?.classList.remove("hidden"),t("results")?.classList.add("hidden"),t("error-box")?.classList.add("hidden"),l.disabled=!0,l.textContent="Checking...";try{const o=await fetch(`${k}/api/v1/fcc/lookup?frn=${e}`),d=await o.json();if(!o.ok){h(d.error||"Lookup failed. Please try again.");return}$(d)}catch{h("Could not reach the compliance checker. Please try again.")}finally{t("loading")?.classList.add("hidden"),l.disabled=!1,l.textContent="Check Compliance"}}function h(e){const r=t("error-box"),o=t("error-msg");o.textContent=e,r.classList.remove("hidden"),t("loading")?.classList.add("hidden"),l.disabled=!1,l.textContent="Check Compliance"}function $(e){t("entity-name").textContent=e.entity_name||"Unknown Entity",t("entity-frn").textContent=e.frn;const r=e.cores;r.address?t("entity-address").textContent=[r.address,r.city,r.state,r.zip].filter(Boolean).join(", "):t("entity-address").textContent="Address not available from CORES";const o=t("checks-container");o.innerHTML="";for(const n of e.checks){const a={green:{bg:"bg-green-50",border:"border-green-200",icon:"text-green-600",text:"text-green-800"},yellow:{bg:"bg-amber-50",border:"border-amber-200",icon:"text-amber-600",text:"text-amber-800"},red:{bg:"bg-red-50",border:"border-red-200",icon:"text-red-600",text:"text-red-800"},unknown:{bg:"bg-gray-50",border:"border-gray-200",icon:"text-gray-400",text:"text-gray-600"}},s=a[n.status]||a.unknown,i={green:'<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/></svg>',yellow:'<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"/></svg>',red:'<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/></svg>',unknown:'<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"/></svg>'},u=document.createElement("div");u.className=`${s.bg} ${s.border} border rounded-xl p-4 flex items-start gap-3`,u.innerHTML=`
|
||||||
<span class="${s.icon} shrink-0 mt-0.5">${i[n.status]||i.unknown}</span>
|
<span class="${s.icon} shrink-0 mt-0.5">${i[n.status]||i.unknown}</span>
|
||||||
<div class="flex-1 min-w-0">
|
<div class="flex-1 min-w-0">
|
||||||
<div class="flex items-center justify-between gap-2">
|
<div class="flex items-center justify-between gap-2">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue