25 lines
705 B
React
Raw Normal View History

2022-09-25 19:43:00 +03:00
import { useTranslation } from "next-i18next";
2022-09-08 11:48:16 +03:00
import ErrorBoundary from "components/errorboundry";
2022-09-25 19:43:47 +03:00
import components from "widgets/components";
2022-08-24 10:44:35 +03:00
export default function Widget({ service }) {
2022-09-08 11:48:16 +03:00
const { t } = useTranslation("common");
2022-09-25 19:43:47 +03:00
const ServiceWidget = components[service.widget.type];
2022-08-24 10:44:35 +03:00
if (ServiceWidget) {
return (
<ErrorBoundary>
<ServiceWidget service={service} />
</ErrorBoundary>
);
2022-08-24 10:44:35 +03:00
}
return (
<div className="bg-theme-200/50 dark:bg-theme-900/20 rounded m-1 flex-1 flex flex-col items-center justify-center p-1 service-missing">
2022-09-08 11:48:16 +03:00
<div className="font-thin text-sm">{t("widget.missing_type", { type: service.widget.type })}</div>
2022-08-24 10:44:35 +03:00
</div>
);
}