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() {
{auditError}
}{activeAudit.current}
+ {activeAudit.current}
+ {activeAudit.suggested}
+ {activeAudit.suggested}
- + {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."} +
+