import useSWR from "swr";
import { FaCarBattery } from "react-icons/fa";
import { useTranslation } from "next-i18next";
import Error from "../widget/error";
import Resource from "../widget/resource";
import Raw from "../widget/raw";
import Container from "../widget/container";
export default function Widget({ options }) {
const { t } = useTranslation();
const { expanded } = options;
let { refresh } = options;
if (!refresh) refresh = 1500;
const { data, error } = useSWR(`/api/widgets/peanut?${new URLSearchParams({ ...options }).toString()}`, {
refreshInterval: refresh,
});
if (error || data?.error) {
return ;
}
if (!data) {
return (
);
}
return (
{options.label && (
{options.label}
)}
);
}