fix: hide unknown field

This commit is contained in:
hamster1963
2024-12-04 14:43:49 +08:00
parent d7d68fe3a5
commit 1f9b667f0a
+16 -20
View File
@@ -101,30 +101,30 @@ export default function ServerDetailOverview({
</section> </section>
</CardContent> </CardContent>
</Card> </Card>
{version && (
<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">
<section className="flex flex-col items-start gap-0.5"> <section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
{t("serverDetail.version")} {t("serverDetail.version")}
</p> </p>
<div className="text-xs"> <div className="text-xs">{version} </div>
{version || t("serverDetail.unknown")}{" "}
</div>
</section> </section>
</CardContent> </CardContent>
</Card> </Card>
)}
{arch && (
<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">
<section className="flex flex-col items-start gap-0.5"> <section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
{t("serverDetail.arch")} {t("serverDetail.arch")}
</p> </p>
<div className="text-xs"> <div className="text-xs">{arch} </div>
{arch || t("serverDetail.unknown")}{" "}
</div>
</section> </section>
</CardContent> </CardContent>
</Card> </Card>
)}
<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">
<section className="flex flex-col items-start gap-0.5"> <section className="flex flex-col items-start gap-0.5">
@@ -145,6 +145,7 @@ export default function ServerDetailOverview({
</section> </section>
</CardContent> </CardContent>
</Card> </Card>
{country_code && (
<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">
<section className="flex flex-col items-start gap-0.5"> <section className="flex flex-col items-start gap-0.5">
@@ -153,7 +154,7 @@ export default function ServerDetailOverview({
</p> </p>
<section className="flex items-start gap-1"> <section className="flex items-start gap-1">
<div className="text-xs text-start"> <div className="text-xs text-start">
{country_code?.toUpperCase() || t("serverDetail.unknown")} {country_code?.toUpperCase()}
</div> </div>
{country_code && ( {country_code && (
<ServerFlag <ServerFlag
@@ -165,49 +166,44 @@ export default function ServerDetailOverview({
</section> </section>
</CardContent> </CardContent>
</Card> </Card>
)}
</section> </section>
<section className="flex flex-wrap gap-2 mt-1"> <section className="flex flex-wrap gap-2 mt-1">
{platform && (
<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">
<section className="flex flex-col items-start gap-0.5"> <section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
{t("serverDetail.system")} {t("serverDetail.system")}
</p> </p>
{platform ? (
<div className="text-xs"> <div className="text-xs">
{" "} {" "}
{platform || t("serverDetail.unknown")} - {platform_version}{" "} {platform} - {platform_version || ""}{" "}
</div> </div>
) : (
<div className="text-xs"> {t("serverDetail.unknown")}</div>
)}
</section> </section>
</CardContent> </CardContent>
</Card> </Card>
)}
{cpu_info.length > 0 && (
<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">
<section className="flex flex-col items-start gap-0.5"> <section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground">{"CPU"}</p> <p className="text-xs text-muted-foreground">{"CPU"}</p>
{cpu_info.length > 0 ? (
<div className="text-xs"> {cpu_info.join(", ")}</div> <div className="text-xs"> {cpu_info.join(", ")}</div>
) : (
<div className="text-xs"> {t("serverDetail.unknown")}</div>
)}
</section> </section>
</CardContent> </CardContent>
</Card> </Card>
)}
{gpu_info.length > 0 && (
<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">
<section className="flex flex-col items-start gap-0.5"> <section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground">{"GPU"}</p> <p className="text-xs text-muted-foreground">{"GPU"}</p>
{gpu_info.length > 0 ? (
<div className="text-xs">{gpu_info.join(", ")}</div> <div className="text-xs">{gpu_info.join(", ")}</div>
) : (
<div className="text-xs"> {t("serverDetail.unknown")}</div>
)}
</section> </section>
</CardContent> </CardContent>
</Card> </Card>
)}
</section> </section>
<section className="flex flex-wrap gap-2 mt-1"> <section className="flex flex-wrap gap-2 mt-1">
<Card className="rounded-[10px] bg-transparent border-none shadow-none"> <Card className="rounded-[10px] bg-transparent border-none shadow-none">