From f00d438d665a6bf7338ba2941d457637140f96f5 Mon Sep 17 00:00:00 2001 From: metatroncubeswdev Date: Tue, 20 Oct 2026 19:19:41 -0400 Subject: [PATCH] Replace the fake "Run Live Audit" demo with a real crawl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hero widget looked up a hardcoded preset or a generic templated result for any domain typed in, after a scripted 700ms delay — it never actually looked at the site. It now calls a real, rate-limited endpoint on app.crawlerx.co that crawls the submitted URL and reports an actual finding, with an honest error (not a fabricated result) when a site is unreachable or blocks crawlers. The fake "Approve and push to CMS" button is replaced with a sign-up CTA, since pushing to a client's CMS needs that client's own connected credentials, not something an anonymous visitor can authorize. Co-Authored-By: Claude Sonnet 5 --- src/index.css | 17 ++++ src/pages/HomePage.jsx | 203 +++++++++++++++++++---------------------- 2 files changed, 110 insertions(+), 110 deletions(-) diff --git a/src/index.css b/src/index.css index fe13124..999b463 100644 --- a/src/index.css +++ b/src/index.css @@ -995,6 +995,7 @@ button { gap: 6px; border: 0; cursor: pointer; + text-decoration: none; } /* Product UI Frame Specific Sub-elements (Dark Mode) */ @@ -1006,6 +1007,22 @@ button { background: #0B1015; } +.ui-main-panel-empty { + min-height: 220px; + align-items: center; + justify-content: center; + text-align: center; + color: var(--ink-muted); + font-size: 14px; + line-height: 1.6; +} + +.audit-error-text { + color: #E36A5C; + font-size: 13px; + margin-top: 10px; +} + .ui-card-top-summary { display: flex; justify-content: space-between; diff --git a/src/pages/HomePage.jsx b/src/pages/HomePage.jsx index fad0d50..549c752 100644 --- a/src/pages/HomePage.jsx +++ b/src/pages/HomePage.jsx @@ -11,38 +11,12 @@ import { ChevronDown } from 'lucide-react'; -const PRESETS = { - 'smileline-dental.in': { - domain: 'smileline-dental.in', - score: 81, - action: 'Fix your title tags', - issue: 'Title tags too long on 14 pages (Truncated in SERPs)', - priority: 'High Priority', - current: 'Smileline Dental Clinic | Complete Family Dental Services and Orthodontics Treatment Clinic in Pune, Maharashtra', - suggested: 'Family Dentist in Pune | Smileline Dental Clinic', - cms: 'WordPress 6.4 API' - }, - 'speedyplumbing.com': { - domain: 'speedyplumbing.com', - score: 64, - action: 'Add LocalBusiness Schema', - issue: 'Missing LocalBusiness structured data on 3 location pages', - priority: 'Critical Impact', - current: '', - suggested: '{\n "@type": "PlumbingService",\n "name": "Speedy Plumbing",\n "geo": { "latitude": 41.8781, "longitude": -87.6298 }\n}', - cms: 'Webflow Webhook' - }, - 'fashiondirect.in': { - domain: 'fashiondirect.in', - score: 83, - action: 'Resolve Canonical Duplicates', - issue: 'Category pagination creating duplicate canonical URLs', - priority: 'High Priority', - current: '', - suggested: '', - cms: 'Shopify Storefront' - } -}; +// Backed by a real, unauthenticated endpoint on app.crawlerx.co that crawls +// the submitted page with the same crawler + analyzer the authenticated +// product uses — never a canned/fabricated result. See +// src/routes/api/public/quick-audit.ts in the metatron_seo repo. +const QUICK_AUDIT_ENDPOINT = 'https://app.crawlerx.co/api/public/quick-audit'; +const SAMPLE_DOMAIN = 'crawlerx.co'; const FAQS = [ { @@ -107,11 +81,11 @@ const LOOP_STEPS = { }; export default function HomePage() { - // Live Audit Simulator State - const [domainInput, setDomainInput] = useState('smileline-dental.in'); - const [activeAudit, setActiveAudit] = useState(PRESETS['smileline-dental.in']); + // Live Audit State + const [domainInput, setDomainInput] = useState(''); + const [activeAudit, setActiveAudit] = useState(null); + const [auditError, setAuditError] = useState(''); const [isScanning, setIsScanning] = useState(false); - const [isPushed, setIsPushed] = useState(false); const [toastMsg, setToastMsg] = useState(''); // Agency ROI Calculator State @@ -129,31 +103,33 @@ export default function HomePage() { setTimeout(() => setToastMsg(''), 4000); }; - const runAudit = (targetDomain) => { - const cleanDomain = targetDomain.trim().replace(/^https?:\/\//, '').replace(/\/.*$/, ''); + const runAudit = async (targetUrl) => { + if (!targetUrl.trim()) return; setIsScanning(true); - setIsPushed(false); + setAuditError(''); + + try { + const response = await fetch(QUICK_AUDIT_ENDPOINT, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ url: targetUrl.trim() }) + }); + const data = await response.json(); + + if (!response.ok) { + setActiveAudit(null); + setAuditError(data.error || "We couldn't complete that audit. Try another URL."); + return; + } - setTimeout(() => { - const data = PRESETS[cleanDomain] || { - domain: cleanDomain, - score: 74, - action: 'Optimize Meta Descriptions & Headings', - issue: '12 pages missing meta descriptions; multiple H1 tags found', - priority: 'High Priority', - current: `\n`, - suggested: ``, - cms: 'Direct CMS / API' - }; setActiveAudit(data); + triggerToast(`Audit complete for ${data.domain}`); + } catch { + setActiveAudit(null); + setAuditError("We couldn't reach the audit service. Please try again shortly."); + } finally { setIsScanning(false); - triggerToast(`Audit complete for ${cleanDomain}`); - }, 700); - }; - - const handleApprovePush = () => { - setIsPushed(true); - triggerToast(`✓ Fix approved and pushed to ${activeAudit.cms}`); + } }; // Helper for ROI Calculator Math (Default in INR) @@ -259,21 +235,19 @@ export default function HomePage() {
- Try sample: - {Object.keys(PRESETS).map(dom => ( - - ))} + Try it on: +
+ {auditError &&

{auditError}

}
@@ -303,9 +277,9 @@ export default function HomePage() {
🔒 - {activeAudit.domain} + {activeAudit ? activeAudit.domain : 'Enter a URL to scan'}
- ACTIVE WORKBENCH + {isScanning ? 'SCANNING' : 'LIVE WORKBENCH'}
@@ -316,50 +290,59 @@ export default function HomePage() {
-
-
-
- HIGH IMPACT ACTION RECOMMENDED -

{activeAudit.action}

+ {activeAudit ? ( +
+
+
+ + {activeAudit.priority === 'Good Health' ? 'QUICK SCAN RESULT' : 'HIGH IMPACT ACTION RECOMMENDED'} + +

{activeAudit.action}

+
+
+ {activeAudit.score} + HEALTH
Score / 100
+
-
- {activeAudit.score} - HEALTH
Good / 100
-
-
-
- {activeAudit.priority} - {activeAudit.issue} -
+
+ {activeAudit.priority} + {activeAudit.issue} +
-
-
-
CURRENT SERP METADATA
-
{activeAudit.current}
+
+
+
FOUND ON THIS PAGE
+
{activeAudit.current}
+
+
+
SUGGESTED FIX
+
{activeAudit.suggested}
+
-
-
AI RECOMMENDED (CLICK-THROUGH OPTIMIZED)
-
{activeAudit.suggested}
-
-
-
-
- - {activeAudit.cms} Connected +
+
+ + Crawled live just now +
+ + Fix this with CrawlerX +
-
-
+ ) : ( +
+

+ {isScanning + ? 'Crawling the page and checking title tags, meta description, headings, and canonical URL…' + : "Type a URL above and run a real scan — it's a live crawl of that page, not a demo."} +

+
+ )}