mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Reintroduce Error component
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
import { useContext } from "react";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import { SettingsContext } from "utils/contexts/settings";
|
||||
import { Settings } from "luxon";
|
||||
import Error from "./error"
|
||||
|
||||
export default function Container({ service, children, chart = true, error = false, className = "" }) {
|
||||
const { t } = useTranslation();
|
||||
const { settings } = useContext(SettingsContext);
|
||||
const hideErrors = (service.widget.hide_errors || settings.hideErrors)
|
||||
const hideErrors = (settings.hideErrors || service.widget.hide_errors)
|
||||
return (
|
||||
<div>
|
||||
{children}
|
||||
<div className={`absolute top-0 right-0 bottom-0 left-0 overflow-clip pointer-events-none ${className}`} />
|
||||
{chart && <div className="h-[68px] overflow-clip" />}
|
||||
{!chart && <div className="h-[16px] overflow-clip" />}
|
||||
{error && !hideErrors && <div className="absolute bottom-2 left-2 z-20 text-red-400 text-xs opacity-75">{t("widget.api_error")}</div>}
|
||||
{error && !hideErrors && <Error />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
7
src/widgets/glances/components/error.jsx
Normal file
7
src/widgets/glances/components/error.jsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
export default function Error() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return <div className="absolute bottom-2 left-2 z-20 text-red-400 text-xs opacity-75">{t("widget.api_error")}</div>;
|
||||
}
|
||||
Reference in New Issue
Block a user