import { useState } from 'react'; import { ServerIcon, MapPinIcon, GlobeAltIcon, BuildingOfficeIcon, ClipboardDocumentIcon, CheckIcon, CpuChipIcon } from '@heroicons/react/24/outline'; import type { HostInfo } from '@/utils/types'; import { browser } from 'wxt/browser'; import Error from './Error'; 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, iconColor = "text-gray-400 dark:text-gray-500" }: { icon: any, label: string, value: string | null, href?: string, canCopy?: boolean, iconColor?: string }) => { if (!value) return null; return (

{label}

{href ? ( {value} ) : ( {value} )} {canCopy && }
); }; export default function ServerInfo({ data }: { data: HostInfo }) { const { network, location, domain, isBrowserResource } = data; // URL generation for flags const getFlagUrl = (code?: string | null) => { if (!code) return ''; try { const path = `/${code.toLowerCase()}.webp`; return browser.runtime.getURL(path as any); } catch { return ''; } }; // Header Component const Header = ({ title, flagCode }: { title: string, flagCode?: string | null }) => (

{title}

{flagCode && ( {flagCode} (e.currentTarget.style.display = 'none')} /> )}
); // Browser Resource View if (isBrowserResource) { return (
This page is generated locally by your browser.
); } // Fallback if network data is missing if (!network) { return ; } // Local Network View if (network.isLocal) { return (
); } // Public Internet View return (
Analyze on Censys
); }