import React, { useMemo, useState } from "react"; import { CheckCircle, XCircle, Link as LinkIcon, ShieldCheck, Timer, Globe, Users, TrendingUp, AlertTriangle, Search, Filter, BarChart3, PieChart as PieIcon, Star } from "lucide-react"; import { PieChart, Pie, Cell, ResponsiveContainer, Tooltip, Bar, BarChart, XAxis, YAxis, CartesianGrid } from "recharts"; // Single-file, drop-in React page. TailwindCSS recommended for styling. // Default export is required by the canvas preview. const RAW = { "status": "success", "brand_analysis": { "brand_name": "Tesla", "website": "https://www.tesla.com/", "analysis_date": "2025-08-28T15:04:31.442279", "processing_time": "Real-time SERP + GPT-4o analysis", "analysis_method": "SerpAPI + GPT-4o with follower tracking" }, "data": { "platforms": [ { "name": "Google Business", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on Google Business.", "activity_level": "unknown" }, { "name": "LinkedIn", "found": true, "verified": true, "profile_url": "https://www.linkedin.com/company/tesla-motors", "confidence": "high", "search_ranking": 1, "followers_count": 12261045, "subscribers_count": null, "engagement_level": "high", "posts_count": null, "verification_badge": "verified", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 90, "notes": "Official Tesla LinkedIn profile with over 12 million followers. Verified account.", "activity_level": "unknown" }, { "name": "YouTube", "found": true, "verified": true, "profile_url": "https://www.youtube.com/channel/UC5WjFrtBdufl6CZojX3D8dQ", "confidence": "high", "search_ranking": 1, "followers_count": null, "subscribers_count": null, "engagement_level": "high", "posts_count": null, "verification_badge": "verified", "account_age_estimate": "unknown", "last_activity": "recent", "profile_completeness": 80, "notes": "Official Tesla YouTube channel. Verified with regular content updates.", "activity_level": "high" }, { "name": "TikTok", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on TikTok.", "activity_level": "unknown" }, { "name": "Instagram", "found": true, "verified": true, "profile_url": "https://www.instagram.com/teslamotors/", "confidence": "high", "search_ranking": 1, "followers_count": null, "subscribers_count": null, "engagement_level": "high", "posts_count": null, "verification_badge": "verified", "account_age_estimate": "unknown", "last_activity": "recent", "profile_completeness": 85, "notes": "Official Tesla Instagram profile. Verified with active engagement.", "activity_level": "high" }, { "name": "Pinterest", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on Pinterest.", "activity_level": "unknown" }, { "name": "X (Twitter)", "found": true, "verified": true, "profile_url": "https://x.com/teslaownerssv", "confidence": "medium", "search_ranking": 1, "followers_count": null, "subscribers_count": null, "engagement_level": "high", "posts_count": null, "verification_badge": "verified", "account_age_estimate": "unknown", "last_activity": "recent", "profile_completeness": 70, "notes": "Tesla Owners Silicon Valley is a prominent Tesla-related account. Verified.", "activity_level": "high" }, { "name": "Facebook", "found": true, "verified": false, "profile_url": "https://www.facebook.com/TeslaMotorsCorp/", "confidence": "medium", "search_ranking": 1, "followers_count": 278870, "subscribers_count": null, "engagement_level": "medium", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 60, "notes": "Tesla fan page with significant following but not verified.", "activity_level": "medium" }, { "name": "Medium", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on Medium.", "activity_level": "unknown" }, { "name": "Tumblr", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on Tumblr.", "activity_level": "unknown" }, { "name": "Threads", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on Threads.", "activity_level": "unknown" }, { "name": "Quora", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on Quora.", "activity_level": "unknown" }, { "name": "Reddit", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on Reddit.", "activity_level": "unknown" }, { "name": "Blue Sky", "found": false, "verified": null, "profile_url": null, "confidence": "low", "search_ranking": null, "followers_count": null, "subscribers_count": null, "engagement_level": "unknown", "posts_count": null, "verification_badge": "none", "account_age_estimate": "unknown", "last_activity": "unknown", "profile_completeness": 0, "notes": "No official Tesla profile found on Blue Sky.", "activity_level": "unknown" } ], "summary": { "total_platforms_checked": 14, "platforms_found": 5, "platforms_missing": 9, "completion_percentage": 35.71, "verification_rate": 60, "average_search_ranking": 1, "total_followers": 12539915, "average_engagement": "medium", "verified_accounts": 3 } }, "competitor_analysis": {}, "insights": { "digital_presence_score": "B-", "final_score": 66.7, "strongest_presence": "LinkedIn", "biggest_opportunity": "Google Business", "total_followers": 12539915, "average_engagement": "high", "verification_gaps": 1, "industry_benchmark": "Below average (36% vs 52% industry average)", "recommendations": [ { "platform": "Google Business", "priority": "medium", "reason": "Critical for local SEO and customer reviews", "estimated_setup_time": "2-4 hours", "potential_reach": "Local search dominance" }, { "platform": "TikTok", "priority": "high", "reason": "Fastest-growing platform for viral marketing and reaching Gen Z/Millennial audiences", "estimated_setup_time": "1-2 hours", "potential_reach": "500K+ monthly views potential" }, { "platform": "Pinterest", "priority": "medium", "reason": "Perfect for visual discovery and driving website traffic", "estimated_setup_time": "2-3 hours", "potential_reach": "50K+ monthly pin impressions" } ] }, "meta": { "analyzer_version": "2.1 Pro Enhanced", "platforms_supported": 14, "analysis_method": "Real-time SERP search + GPT-4o analysis", "model": "GPT-4o", "serp_provider": "serpapi", "features": [ "live_verification", "actual_urls", "search_rankings", "follower_counts", "engagement_metrics", "verification_badges", "account_age_estimation", "profile_completeness", "follower_weighted_scoring", "competitor_analysis", "actionable_insights" ] } }; const COLORS = ["#60A5FA", "#34D399", "#FBBF24", "#F87171", "#A78BFA", "#F472B6", "#22D3EE", "#F59E0B"]; // Tailwind palette-ish function Badge({ children, intent = "neutral" }) { const map = { success: "bg-emerald-500/20 text-emerald-300 ring-1 ring-emerald-400/30", danger: "bg-rose-500/20 text-rose-300 ring-1 ring-rose-400/30", warn: "bg-amber-500/20 text-amber-200 ring-1 ring-amber-400/30", info: "bg-sky-500/20 text-sky-200 ring-1 ring-sky-400/30", neutral: "bg-zinc-700/40 text-zinc-200 ring-1 ring-white/5", }; return ( {children} ); } function Stat({ icon: Icon, label, value, hint }) { return (

{label}

{value}

{hint &&

{hint}

}
); } function Progress({ value }) { return (
); } function PlatformCard({ p }) { const found = p.found; const verified = p.verified === true; const notFound = p.found === false; const statusIntent = found ? (verified ? "success" : "info") : "danger"; const engagementMap = { high: "High", medium: "Medium", low: "Low", unknown: "Unknown", }; return (
{found ? ( ) : ( )}

{p.name}

{found ? (verified ? "Verified" : "Found") : "Missing"}
Rank: {p.search_ranking ?? "-"}
Followers: {p.followers_count ?? p.subscribers_count ?? "-"}
Engagement: {engagementMap[p.engagement_level] ?? p.engagement_level}
Profile completeness: {p.profile_completeness ?? 0}%
{p.profile_url ? ( Visit profile ) : ( No URL )} {verified && Verified} {p.last_activity && Last: {p.last_activity}}
{p.notes &&

{p.notes}

}
); } function Section({ title, icon: Icon, right }) { return (

{title}

{right}
); } export default function BrandAnalysisPage() { const [query, setQuery] = useState(""); const [filter, setFilter] = useState("all"); // all | found | missing const [sort, setSort] = useState("default"); // default | followers | completeness | name const platforms = RAW.data.platforms; const summary = RAW.data.summary; const insights = RAW.insights; const brand = RAW.brand_analysis; const filtered = useMemo(() => { let arr = [...platforms]; if (filter === "found") arr = arr.filter(p => p.found); if (filter === "missing") arr = arr.filter(p => p.found === false); if (query.trim()) { const q = query.toLowerCase(); arr = arr.filter(p => `${p.name} ${p.notes ?? ""}`.toLowerCase().includes(q)); } if (sort === "followers") arr.sort((a,b) => (b.followers_count ?? b.subscribers_count ?? -1) - (a.followers_count ?? a.subscribers_count ?? -1)); if (sort === "completeness") arr.sort((a,b) => (b.profile_completeness ?? 0) - (a.profile_completeness ?? 0)); if (sort === "name") arr.sort((a,b) => a.name.localeCompare(b.name)); return arr; }, [platforms, filter, query, sort]); const foundCount = platforms.filter(p => p.found).length; const missingCount = platforms.length - foundCount; const pieData = [ { name: "Found", value: foundCount }, { name: "Missing", value: missingCount }, ]; const followerBars = platforms .map(p => ({ name: p.name, followers: p.followers_count ?? p.subscribers_count ?? 0 })) .filter(d => d.followers > 0); return (
{/* Header */}
logo

{brand.brand_name} – Digital Presence Report

Website: {brand.website}

Analyzed on {new Date(brand.analysis_date).toLocaleString()}

{/* Score & Overview */}

{insights.final_score}

{insights.digital_presence_score}

Industry benchmark: {insights.industry_benchmark}

Profile completion: {summary.completion_percentage}%

{pieData.map((entry, index) => ( ))}
{followerBars.map((_, index) => ( ))}
{/* Recommendations */}
{RAW.insights.recommendations.map((r, i) => (

{r.platform}

Priority: {r.priority}

{r.reason}

Setup: {r.estimated_setup_time}
Reach: {r.potential_reach}
))}
{/* Platforms List */}
setQuery(e.target.value)} />
} />
{filtered.map((p) => ( ))}
{/* Meta */}

Analyzer Version

{RAW.meta.analyzer_version}

Platforms Supported

{RAW.meta.platforms_supported}

Method

{RAW.meta.analysis_method}

); }