import { IpInfo } from '@shared/types' import { useLanguage } from '../contexts/LanguageContext' import './IpInfoCard.css' interface IpInfoCardProps { info: IpInfo className?: string compact?: boolean } export default function IpInfoCard({ info, className = '', compact = false }: IpInfoCardProps) { const { t } = useLanguage() const asnDisplay = info.asn ? `AS${info.asn}` : '-' if (compact) { return (
IP {info.ip} {info.city && `${info.city}, `}{info.country || '-'}
{info.org || info.isp || '-'} {asnDisplay}
) } return (
IP {info.ip}
{info.city && `${info.city}, `}{info.country || '-'}
ISP {info.isp || '-'}
ASN {asnDisplay}
{t('组织', 'Organization')} {info.org || '-'}
) }