2024-06-23 17:43:51 +01:00
|
|
|
import { useContext } from "react";
|
|
|
|
|
|
|
|
import Error from "./error";
|
|
|
|
|
|
|
|
import { SettingsContext } from "utils/contexts/settings";
|
|
|
|
|
|
|
|
export default function Container({ children, widget, error = null, chart = true, className = "" }) {
|
|
|
|
const { settings } = useContext(SettingsContext);
|
|
|
|
const hideErrors = settings.hideErrors || widget?.hideErrors;
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
if (hideErrors) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <Error />;
|
|
|
|
}
|
|
|
|
|
2023-08-01 13:05:17 +03:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{children}
|
2023-08-02 06:04:20 +03:00
|
|
|
<div className={`absolute top-0 right-0 bottom-0 left-0 overflow-clip pointer-events-none ${className}`} />
|
2023-10-17 23:26:55 -07:00
|
|
|
{chart && <div className="h-[68px] overflow-clip" />}
|
|
|
|
{!chart && <div className="h-[16px] overflow-clip" />}
|
2023-08-01 13:05:17 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|