mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 21:59:50 +01:00
Run pre-commit hooks over existing codebase
Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
@@ -4,7 +4,7 @@ import useSWR from "swr";
|
||||
export default function Ping({ group, service, style }) {
|
||||
const { t } = useTranslation();
|
||||
const { data, error } = useSWR(`api/ping?${new URLSearchParams({ group, service }).toString()}`, {
|
||||
refreshInterval: 30000
|
||||
refreshInterval: 30000,
|
||||
});
|
||||
|
||||
let colorClass = "text-black/20 dark:text-white/40 opacity-20";
|
||||
@@ -29,7 +29,7 @@ export default function Ping({ group, service, style }) {
|
||||
statusText = data.status;
|
||||
}
|
||||
} else if (data) {
|
||||
const ping = t("common.ms", { value: data.latency, style: "unit", unit: "millisecond", maximumFractionDigits: 0 })
|
||||
const ping = t("common.ms", { value: data.latency, style: "unit", unit: "millisecond", maximumFractionDigits: 0 });
|
||||
statusTitle += ` ${data.status} (${ping})`;
|
||||
colorClass = "text-emerald-500/80";
|
||||
|
||||
@@ -42,14 +42,17 @@ export default function Ping({ group, service, style }) {
|
||||
}
|
||||
|
||||
if (style === "dot") {
|
||||
backgroundClass = 'p-4';
|
||||
colorClass = colorClass.replace(/text-/g, 'bg-').replace(/\/\d\d/g, '');
|
||||
backgroundClass = "p-4";
|
||||
colorClass = colorClass.replace(/text-/g, "bg-").replace(/\/\d\d/g, "");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`w-auto text-center rounded-b-[3px] overflow-hidden ping-status ${backgroundClass}`} title={statusTitle}>
|
||||
{style !== 'dot' && <div className={`font-bold uppercase text-[8px] ${colorClass}`}>{statusText}</div>}
|
||||
{style === 'dot' && <div className={`rounded-full h-3 w-3 ${colorClass}`}/>}
|
||||
<div
|
||||
className={`w-auto text-center rounded-b-[3px] overflow-hidden ping-status ${backgroundClass}`}
|
||||
title={statusTitle}
|
||||
>
|
||||
{style !== "dot" && <div className={`font-bold uppercase text-[8px] ${colorClass}`}>{statusText}</div>}
|
||||
{style === "dot" && <div className={`rounded-full h-3 w-3 ${colorClass}`} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user