Galaxy Website Design

import { useState, useCallback, useRef } from “react”; // ─── Constants ─────────────────────────────────────────────────────────────── const INDUSTRIES = [ “Legal Services”,”Healthcare”,”Home Improvement”,”Flooring & Carpets”, “Refrigeration & HVAC”,”Airport Transfers & Taxis”,”Restaurant & Food”, “E-commerce”,”Real Estate”,”Financial Services”,”Education”,”Fitness & Wellness”, “Magic & Entertainment”,”Web Design & Digital Agency”,”Construction & Trades”, “Automotive”,”Beauty & Hair”,”Accountancy”,”Funeral Services”,”Other” ]; const LOCATIONS = [ “National (UK)”,”London”,”Hampshire”,”Portsmouth”,”Southampton”,”Winchester”, “Eastleigh”,”Fareham”,”Costa Blanca, Spain”,”Javea, Spain”,”Birmingham”, “Manchester”,”Bristol”,”Leeds”,”Edinburgh”,”Cardiff”,”Wales”,”Custom…” ]; const PAGE_TYPES = [ “Homepage”,”Service Page”,”Location Page”,”About Us”,”Contact”, “Blog Post / Article”,”Product Page”,”Landing Page”,”FAQ Page”,”Case Study” ]; const TONES = [ “Professional & Authoritative”,”Friendly & Approachable”,”Urgent & Reassuring”, “Technical & Expert”,”Local & Community”,”Luxury & Premium”,”Concise & Direct” ]; const STAGES = { INPUT: “input”, SEO: “seo”, APPROVED: “approved”, BUILDING: “building”, DONE: “done” }; // ─── Small components ───────────────────────────────────────────────────────── function Badge({ color, children }) { const c = { green: [“#d1fae5″,”#065f46″,”#6ee7b7”], blue: [“#dbeafe”,”#1e3a8a”,”#93c5fd”], amber: [“#fef3c7″,”#78350f”,”#fcd34d”], red: [“#fee2e2″,”#7f1d1d”,”#fca5a5″], purple: [“#ede9fe”,”#4c1d95″,”#c4b5fd”], gray: [“#f3f4f6″,”#374151″,”#d1d5db”], }[color] || [“#f3f4f6″,”#374151″,”#d1d5db”]; return ( {children} ); } function Spinner({ size=16 }) { return ( ); } function CopyBtn({ text, label=”Copy” }) { const [done, setDone] = useState(false); const copy = () => { navigator.clipboard.writeText(text); setDone(true); setTimeout(()=>setDone(false), 1500); }; return ( ); } function StageBar({ stage }) { const steps = [ {id:STAGES.INPUT, label:”Brief”}, {id:STAGES.SEO, label:”SEO Research”}, {id:STAGES.APPROVED, label:”Approved”}, {id:STAGES.BUILDING, label:”Building”}, {id:STAGES.DONE, label:”Done”}, ]; const idx = steps.findIndex(s=>s.id===stage); return (
{steps.map((s,i)=>(
{i {s.label}
{i )}
))}
); } // ─── SEO Results Panel ──────────────────────────────────────────────────────── function SEOPanel({ data }) { const [tab, setTab] = useState(“keywords”); const tabs = [ {id:”keywords”, label:`Keywords (${data.keywords?.length||0})`}, {id:”meta”, label:”Meta & RankMath”}, {id:”brief”, label:”Content Brief”}, ]; const diffColor = d => d<=30?"green":d<=60?"amber":"red"; const intentColor = i => ({informational:”blue”,commercial:”purple”,transactional:”green”,navigational:”gray”})[i]||”gray”; return (
{tabs.map(t=>( ))}
{tab===”keywords” && data.keywords && (
{data.keywords.map((kw,i)=>(
{kw.keyword}
{kw.intent} KD {kw.difficulty} {kw.volume && ~{kw.volume}/mo}
{kw.reason &&

{kw.reason}

}
))}
)} {tab===”meta” && data.meta && (
{[ {key:”title”, label:”Meta Title”, max:60, col:”#1e3a8a”}, {key:”description”, label:”Meta Description”, max:160, col:”#065f46″}, {key:”h1″, label:”H1 Heading”, max:70, col:”#78350f”}, {key:”slug”, label:”URL Slug”, max:60, col:”#4c1d95″}, {key:”focusKW”, label:”Focus Keyword”, max:50, col:”#7f1d1d”}, ].map(f=>{ const val=data.meta[f.key]||””; const over=val.length>f.max; return (
{f.label}
{val.length}/{f.max}

{val||}

{over &&

⚠ Too long — trim {val.length-f.max} chars

}
); })} {data.meta.schemaType && (

Schema Type

{data.meta.schemaType}

)} {data.meta.rankMathTips?.length>0 && (

RankMath Pro Tips

    {data.meta.rankMathTips.map((t,i)=>(
  • {t}
  • ))}
)}
)} {tab===”brief” && data.brief && (
{data.brief.sections && (

Page Sections (Elementor Order)

    {data.brief.sections.map((s,i)=>(
  1. {s.heading} {s.tip && — {s.tip}}
  2. ))}
)} {data.brief.lsiKeywords && (

LSI / Semantic Keywords

{data.brief.lsiKeywords.map((k,i)=>( {k} ))}
)} {data.brief.questions && (

People Also Ask (FAQ targets)

    {data.brief.questions.map((q,i)=>(
  1. {q}
  2. ))}
)} {data.brief.contentTips && (

Content Tips

    {data.brief.contentTips.map((t,i)=>(
  • {t}
  • ))}
)}
)}
); } // ─── Main App ───────────────────────────────────────────────────────────────── export default function PageBuilder() { const [stage, setStage] = useState(STAGES.INPUT); // Form state const [topic, setTopic] = useState(“”); const [industry, setIndustry] = useState(“”); const [location, setLocation] = useState(“”); const [customLoc, setCustomLoc] = useState(“”); const [pageType, setPageType] = useState(“”); const [tone, setTone] = useState(“”); const [extra, setExtra] = useState(“”); // Results state const [seoData, setSeoData] = useState(null); const [htmlOut, setHtmlOut] = useState(“”); const [error, setError] = useState(“”); const [loadMsg, setLoadMsg] = useState(“”); const [htmlLoading, setHtmlLoading] = useState(false); const [htmlLoadMsg, setHtmlLoadMsg] = useState(“”); const [copied, setCopied] = useState(false); const seoMsgs = [ “Analysing search intent and landscape…”, “Mining high-value keyword clusters…”, “Scoring difficulty and opportunity…”, “Crafting RankMath-ready meta tags…”, “Building People Also Ask targets…”, “Finalising LSI semantic keywords…”, ]; const htmlMsgs = [ “Applying keywords to page structure…”, “Writing SEO-optimised body copy…”, “Embedding LSI terms naturally…”, “Structuring FAQ section from PAA questions…”, “Adding RankMath comment block…”, “Styling for Elementor HTML widget…”, “Finalising and polishing…”, ]; const loc = location === “Custom…” ? customLoc : location; // ── Step 1: Run SEO Research ────────────────────────────────────────────── const runSEO = useCallback(async () => { if (!topic.trim()) { setError(“Please enter a page topic.”); return; } if (!industry) { setError(“Please select an industry.”); return; } if (!pageType) { setError(“Please select a page type.”); return; } setError(“”); setStage(STAGES.SEO); setSeoData(null); let i=0; setLoadMsg(seoMsgs[0]); const t = setInterval(()=>{ i=(i+1)%seoMsgs.length; setLoadMsg(seoMsgs[i]); }, 2000); const prompt = `You are a UK SEO expert for Galaxy Website Design agency. Generate a comprehensive SEO package. Return ONLY valid JSON, no markdown, no explanation. TOPIC: ${topic} INDUSTRY: ${industry} PAGE TYPE: ${pageType} LOCATION: ${loc||”National UK”} TONE: ${tone||”Professional & Authoritative”} EXTRA NOTES: ${extra||”none”} JSON structure: { “keywords”: [ {“keyword”:””,”intent”:”informational|commercial|transactional|navigational”,”difficulty”:0,”volume”:0,”reason”:””} ], “meta”: { “title”:”under 60 chars with primary keyword”, “description”:”140-155 chars with CTA and primary keyword”, “h1″:”keyword-rich H1 heading, different from title”, “slug”:”kebab-case-url-slug”, “focusKW”:”single focus keyword for RankMath”, “schemaType”:”Schema.org type”, “rankMathTips”:[“tip1″,”tip2″,”tip3″,”tip4”] }, “brief”: { “sections”:[{“heading”:””,”tip”:””}], “lsiKeywords”:[“”], “questions”:[“”,””,””,””,””], “contentTips”:[“”,””,””] } } Rules: – Exactly 12 keywords: 2-3 head terms (KD 55-80), 4-5 long-tail (KD 15-45), 2-3 local (KD 20-50), 2-3 questions (KD 10-30) – Realistic UK search volumes – Meta title MUST be under 60 chars – Meta description MUST be 140-155 chars – British spelling throughout – Sections should map to logical Elementor page layout order – 5 People Also Ask questions targeting featured snippets – 12-15 LSI keywords`; try { const res = await fetch(“https://api.anthropic.com/v1/messages”,{ method:”POST”, headers:{“Content-Type”:”application/json”}, body:JSON.stringify({ model:”claude-sonnet-4-20250514″, max_tokens:2000, messages:[{role:”user”,content:prompt}] }) }); const d = await res.json(); const raw = d.content?.find(b=>b.type===”text”)?.text||””; const clean = raw.replace(/“`json|“`/g,””).trim(); setSeoData(JSON.parse(clean)); } catch(e) { setError(“SEO research failed. Please try again.”); setStage(STAGES.INPUT); } finally { clearInterval(t); } }, [topic, industry, pageType, loc, tone, extra]); // ── Step 2: Approve & Build HTML ────────────────────────────────────────── const buildHTML = useCallback(async () => { if (!seoData) return; setStage(STAGES.BUILDING); setHtmlLoading(true); setHtmlOut(“”); let i=0; setHtmlLoadMsg(htmlMsgs[0]); const t = setInterval(()=>{ i=(i+1)%htmlMsgs.length; setHtmlLoadMsg(htmlMsgs[i]); }, 2500); const kws = seoData.keywords?.map(k=>`• ${k.keyword} (${k.intent}, KD${k.difficulty})`).join(“\n”)||””; const lsi = seoData.brief?.lsiKeywords?.join(“, “)||””; const paas = seoData.brief?.questions?.map((q,i)=>`${i+1}. ${q}`).join(“\n”)||””; const secs = seoData.brief?.sections?.map((s,i)=>`${i+1}. ${s.heading}: ${s.tip}`).join(“\n”)||””; const prompt = `You are an expert web developer and SEO copywriter for Galaxy Website Design. Build a complete, production-ready Elementor HTML widget for this page. PAGE DETAILS: Topic: ${topic} Industry: ${industry} Page Type: ${pageType} Location: ${loc||”National UK”} Tone: ${tone||”Professional & Authoritative”} Extra notes: ${extra||”none”} SEO PACKAGE TO USE: Focus Keyword: ${seoData.meta?.focusKW||””} H1: ${seoData.meta?.h1||””} Meta Title: ${seoData.meta?.title||””} Meta Description: ${seoData.meta?.description||””} URL Slug: ${seoData.meta?.slug||””} Schema Type: ${seoData.meta?.schemaType||””} PRIMARY KEYWORDS (use these throughout): ${kws} LSI KEYWORDS (weave naturally into copy): ${lsi} PEOPLE ALSO ASK (use as FAQ headings): ${paas} PAGE SECTIONS (build in this order): ${secs} CONTENT TIPS: ${seoData.brief?.contentTips?.join(“\n”)||””} STRICT REQUIREMENTS: 1. Output ONLY raw HTML — no markdown fences, no explanation before or after 2. Start with an HTML comment block containing the RankMath settings (title, desc, slug, focus KW, schema) 3. NO , , , or tags — this goes in an Elementor HTML widget 4. Include {/* Header */}
🚀

SEO + Page Builder

Galaxy Website Design · SEO research → Elementor HTML · One flow

{[ {col:"#1D9E75",label:"SEO First"}, {col:"#378ADD",label:"Elementor Ready"}, {col:"#8b5cf6",label:"RankMath Pro"}, ].map(b=>( {b.label} ))}
{/* Stage bar */} {/* Error */} {error && (
⚠ {error}
)} {/* ── STAGE: INPUT ─────────────────────────────────────────────────── */} {stage===STAGES.INPUT && (

Step 1 — Page Brief

setTopic(e.target.value)} placeholder="e.g. Carpet fitting services in Southampton" style={inputStyle}/>
{location==="Custom..." && (
setCustomLoc(e.target.value)} placeholder="Enter location..." style={inputStyle}/>
)}

Utility Delta Business Services Ltd (T/A Galaxy Website Design)