feat: disableShowNetTransfer env

This commit is contained in:
hamster1963 2024-12-15 02:11:31 +08:00
parent 9921a9a9bb
commit ffcbf4489e

View File

@ -27,6 +27,8 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf
} = formatNezhaInfo(now, serverInfo)
const showFlag = true
// @ts-expect-error ShowNetTransfer is a global variable
const disableShowNetTransfer = window.ShowNetTransfer === "false"
const parsedData = parsePublicNote(public_note)
@ -121,27 +123,30 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf
</div>
</div>
</section>
<section className={"flex items-center justify-between gap-1"}>
<Badge
variant="secondary"
className="items-center flex-1 justify-center rounded-[8px] text-nowrap text-[11px] border-muted-50 shadow-md shadow-neutral-200/30 dark:shadow-none"
>
{t("serverCard.upload")}:{formatBytes(net_out_transfer)}
</Badge>
<Badge
variant="outline"
className="items-center flex-1 justify-center rounded-[8px] text-nowrap text-[11px] shadow-md shadow-neutral-200/30 dark:shadow-none"
>
{t("serverCard.download")}:{formatBytes(net_in_transfer)}
</Badge>
</section>
{!disableShowNetTransfer && (
<section className={"flex items-center justify-between gap-1"}>
<Badge
variant="secondary"
className="items-center flex-1 justify-center rounded-[8px] text-nowrap text-[11px] border-muted-50 shadow-md shadow-neutral-200/30 dark:shadow-none"
>
{t("serverCard.upload")}:{formatBytes(net_out_transfer)}
</Badge>
<Badge
variant="outline"
className="items-center flex-1 justify-center rounded-[8px] text-nowrap text-[11px] shadow-md shadow-neutral-200/30 dark:shadow-none"
>
{t("serverCard.download")}:{formatBytes(net_in_transfer)}
</Badge>
</section>
)}
</div>
</Card>
</section>
) : (
<Card
className={cn(
"flex flex-col lg:min-h-[91px] min-h-[123px] items-center justify-start gap-3 p-3 md:px-5 lg:flex-row cursor-pointer hover:bg-accent/50 transition-colors",
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row cursor-pointer hover:bg-accent/50 transition-colors",
!disableShowNetTransfer ? "lg:min-h-[91px] min-h-[123px]" : "lg:min-h-[61px] min-h-[93px]",
)}
onClick={() => navigate(`/server/${serverInfo.id}`, { replace: true })}
>