fix: ip info error

This commit is contained in:
hamster1963 2024-12-13 10:11:00 +08:00
parent d075ab5e0e
commit 231a66931b

View File

@ -26,78 +26,100 @@ export default function ServerIPInfo({ server_id }: { server_id: number }) {
return ( return (
<> <>
<section className="flex flex-wrap gap-2 mb-4"> <section className="flex flex-wrap gap-2 mb-4">
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> {data.asn.autonomous_system_organization && (
<CardContent className="px-1.5 py-1"> <Card className="rounded-[10px] bg-transparent border-none shadow-none">
<section className="flex flex-col items-start gap-0.5"> <CardContent className="px-1.5 py-1">
<p className="text-xs text-muted-foreground">{"ASN"}</p> <section className="flex flex-col items-start gap-0.5">
<div className="text-xs"> <p className="text-xs text-muted-foreground">{"ASN"}</p>
{data.asn.autonomous_system_organization} <div className="text-xs">
</div> {data.asn.autonomous_system_organization}
</section> </div>
</CardContent> </section>
</Card> </CardContent>
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> </Card>
<CardContent className="px-1.5 py-1"> )}
<section className="flex flex-col items-start gap-0.5"> {data.asn.autonomous_system_number && (
<p className="text-xs text-muted-foreground">{t("asn_number")}</p> <Card className="rounded-[10px] bg-transparent border-none shadow-none">
<div className="text-xs"> <CardContent className="px-1.5 py-1">
AS{data.asn.autonomous_system_number} <section className="flex flex-col items-start gap-0.5">
</div> <p className="text-xs text-muted-foreground">
</section> {t("asn_number")}
</CardContent> </p>
</Card> <div className="text-xs">
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> AS{data.asn.autonomous_system_number}
<CardContent className="px-1.5 py-1"> </div>
<section className="flex flex-col items-start gap-0.5"> </section>
<p className="text-xs text-muted-foreground"> </CardContent>
{t("registered_country")} </Card>
</p> )}
<div className="text-xs"> {data.city.registered_country?.names.en && (
{data.city.registered_country?.names.en} <Card className="rounded-[10px] bg-transparent border-none shadow-none">
</div> <CardContent className="px-1.5 py-1">
</section> <section className="flex flex-col items-start gap-0.5">
</CardContent> <p className="text-xs text-muted-foreground">
</Card> {t("registered_country")}
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> </p>
<CardContent className="px-1.5 py-1"> <div className="text-xs">
<section className="flex flex-col items-start gap-0.5"> {data.city.registered_country?.names.en}
<p className="text-xs text-muted-foreground">{"ISO"}</p> </div>
<div className="text-xs">{data.city.country?.iso_code}</div> </section>
</section> </CardContent>
</CardContent> </Card>
</Card> )}
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> {data.city.country?.iso_code && (
<CardContent className="px-1.5 py-1"> <Card className="rounded-[10px] bg-transparent border-none shadow-none">
<section className="flex flex-col items-start gap-0.5"> <CardContent className="px-1.5 py-1">
<p className="text-xs text-muted-foreground">{t("city")}</p> <section className="flex flex-col items-start gap-0.5">
<div className="text-xs">{data.city.city?.names.en}</div> <p className="text-xs text-muted-foreground">{"ISO"}</p>
</section> <div className="text-xs">{data.city.country?.iso_code}</div>
</CardContent> </section>
</Card> </CardContent>
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> </Card>
<CardContent className="px-1.5 py-1"> )}
<section className="flex flex-col items-start gap-0.5"> {data.city.city?.names.en && (
<p className="text-xs text-muted-foreground">{t("longitude")}</p> <Card className="rounded-[10px] bg-transparent border-none shadow-none">
<div className="text-xs">{data.city.location?.longitude}</div> <CardContent className="px-1.5 py-1">
</section> <section className="flex flex-col items-start gap-0.5">
</CardContent> <p className="text-xs text-muted-foreground">{t("city")}</p>
</Card> <div className="text-xs">{data.city.city?.names.en}</div>
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> </section>
<CardContent className="px-1.5 py-1"> </CardContent>
<section className="flex flex-col items-start gap-0.5"> </Card>
<p className="text-xs text-muted-foreground">{t("latitude")}</p> )}
<div className="text-xs">{data.city.location?.latitude}</div> {data.city.location?.longitude && (
</section> <Card className="rounded-[10px] bg-transparent border-none shadow-none">
</CardContent> <CardContent className="px-1.5 py-1">
</Card> <section className="flex flex-col items-start gap-0.5">
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> <p className="text-xs text-muted-foreground">
<CardContent className="px-1.5 py-1"> {t("longitude")}
<section className="flex flex-col items-start gap-0.5"> </p>
<p className="text-xs text-muted-foreground">{t("time_zone")}</p> <div className="text-xs">{data.city.location?.longitude}</div>
<div className="text-xs">{data.city.location?.time_zone}</div> </section>
</section> </CardContent>
</CardContent> </Card>
</Card> )}
{data.city.location?.latitude && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground">{t("latitude")}</p>
<div className="text-xs">{data.city.location?.latitude}</div>
</section>
</CardContent>
</Card>
)}
{data.city.location?.time_zone && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground">
{t("time_zone")}
</p>
<div className="text-xs">{data.city.location?.time_zone}</div>
</section>
</CardContent>
</Card>
)}
{data.city.postal && ( {data.city.postal && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> <Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1"> <CardContent className="px-1.5 py-1">