mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-16 01:39:49 +00:00
Run pre-commit hooks over existing codebase
Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
parent
fa50bbad9c
commit
19c25713c4
387 changed files with 4785 additions and 4109 deletions
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue