import { useState } from 'react'; import { ServerIcon, MapPinIcon, GlobeAltIcon, BuildingOfficeIcon, CpuChipIcon, ClipboardDocumentIcon, CheckIcon, ArrowTopRightOnSquareIcon } from '@heroicons/react/24/outline'; import type { HostInfo } from '@/utils/types'; import { browser } from 'wxt/browser'; const CopyButton = ({ text }: { text: string }) => { const [copied, setCopied] = useState(false); const handleCopy = async (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); await navigator.clipboard.writeText(text); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return ( ); }; const InfoRow = ({ icon: Icon, label, value, href, canCopy }: { icon: any, label: string, value: string | null, href?: string, canCopy?: boolean }) => { if (!value) return null; return (

{label}

{href ? ( {value} ) : ( {value} )} {canCopy && }
); }; export default function ServerInfo({ data }: { data: HostInfo }) { const { network, location, domain, isBrowserResource } = data; // Header Component const Header = ({ title, subtitle, icon: Icon }: { title: string, subtitle?: string, icon?: any }) => (
{Icon && }

{title}

{subtitle &&

{subtitle}

}
); // Browser Resource View if (isBrowserResource) { return (

No network information available for this page.

); } if (!network) return null; const flagUrl = location?.countryCode ? `/${location.countryCode.toLowerCase()}.webp` : ''; // Local Network View if (network.isLocal) { return (
); } // Public Internet View return (

{domain}

Publicly Accessible

{location?.countryCode && ( {location.countryCode} (e.currentTarget.style.display = 'none')} /> )}
Analyze on Censys
); }