mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
28 lines
724 B
JavaScript
28 lines
724 B
JavaScript
import { useTranslation } from "next-i18next";
|
|
|
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
|
import Container from "components/services/widget/container";
|
|
import Block from "components/services/widget/block";
|
|
|
|
export default function Component({ service }) {
|
|
const { t } = useTranslation();
|
|
const { data, error } = useWidgetAPI(service.widget);
|
|
|
|
if (error) {
|
|
return <Container service={service} error={error} />;
|
|
}
|
|
|
|
if (!data) {
|
|
return null;
|
|
}
|
|
|
|
const { uptime, cpuLoad } = data;
|
|
|
|
return (
|
|
<Container service={service}>
|
|
<Block label="openwrt.uptime" value={t("common.duration", { value: uptime })} />
|
|
<Block label="openwrt.cpuLoad" value={cpuLoad} />
|
|
</Container>
|
|
);
|
|
}
|