fix: country code

This commit is contained in:
hamster1963 2024-11-27 08:56:17 +08:00
parent d36f740650
commit d98a42fcd8
3 changed files with 5 additions and 4 deletions

View File

@ -134,13 +134,13 @@ 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">
{server.host.country_code?.toUpperCase() || {server.country_code?.toUpperCase() ||
t("serverDetail.unknown")} t("serverDetail.unknown")}
</div> </div>
{server.host.country_code && ( {server.country_code && (
<ServerFlag <ServerFlag
className="text-[11px] -mt-[1px]" className="text-[11px] -mt-[1px]"
country_code={server.host.country_code} country_code={server.country_code}
/> />
)} )}
</section> </section>

View File

@ -23,7 +23,7 @@ export function formatNezhaInfo(serverInfo: NezhaAPI) {
swap: (serverInfo.state.swap_used / serverInfo.host.swap_total) * 100 || 0, swap: (serverInfo.state.swap_used / serverInfo.host.swap_total) * 100 || 0,
disk: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0, disk: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0,
stg: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0, stg: (serverInfo.state.disk_used / serverInfo.host.disk_total) * 100 || 0,
country_code: serverInfo.host.country_code, country_code: serverInfo.country_code,
}; };
} }

View File

@ -7,6 +7,7 @@ export interface NezhaAPI {
id: number; id: number;
name: string; name: string;
last_active: string; last_active: string;
country_code: string;
host: NezhaAPIHost; host: NezhaAPIHost;
state: NezhaAPIStatus; state: NezhaAPIStatus;
} }