mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-08 22:48:46 +00:00
Further improvements to simplify information widgets
Signed-off-by: Denis Papec <denis.papec@gmail.com>
This commit is contained in:
parent
d4fd923be5
commit
a55fe939cb
12 changed files with 181 additions and 267 deletions
|
@ -1,23 +1,20 @@
|
|||
import { useTranslation } from "next-i18next";
|
||||
import { FaThermometerHalf } from "react-icons/fa";
|
||||
|
||||
import UsageBar from "../resources/usage-bar";
|
||||
import SingleResource from "../widget/single_resource";
|
||||
import WidgetIcon from "../widget/widget_icon";
|
||||
import ResourceValue from "../widget/resource_value";
|
||||
import ResourceLabel from "../widget/resource_label";
|
||||
import Resource from "../widget/resource";
|
||||
import WidgetLabel from "../widget/widget_label";
|
||||
|
||||
export default function Node({ data, expanded, labels }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return <SingleResource expanded={expanded}>
|
||||
<WidgetIcon icon={FaThermometerHalf} />
|
||||
<ResourceValue>{t("common.bytes", { value: data.node.available })}</ResourceValue>
|
||||
<ResourceLabel>{t("resources.free")}</ResourceLabel>
|
||||
<ResourceValue>{t("common.bytes", { value: data.node.maximum })}</ResourceValue>
|
||||
<ResourceLabel>{t("resources.total")}</ResourceLabel>
|
||||
<UsageBar percent={Math.round(((data.node.maximum - data.node.available) / data.node.maximum) * 100)} />
|
||||
{ labels && <WidgetLabel label={data.node.id} /> }
|
||||
</SingleResource>
|
||||
return <Resource
|
||||
icon={FaThermometerHalf}
|
||||
value={t("common.bytes", { value: data.node.available })}
|
||||
label={t("resources.free")}
|
||||
expandedValue={t("common.bytes", { value: data.node.maximum })}
|
||||
expandedLabel={t("resources.total")}
|
||||
percentage={Math.round(((data.node.maximum - data.node.available) / data.node.maximum) * 100)}
|
||||
expanded={expanded}
|
||||
>{ labels && <WidgetLabel label={data.node.id} /> }
|
||||
</Resource>
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue