import { useTranslation } from "next-i18next"; import Container from "components/services/widget/container"; import Block from "components/services/widget/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; const ROMM_DEFAULT_FIELDS = ["platforms", "totalRoms", "saves", "states"]; const MAX_ALLOWED_FIELDS = 4; export default function Component({ service }) { const { widget } = service; const { t } = useTranslation(); const { data: response, error: responseError } = useWidgetAPI(widget, "statistics"); if (responseError) { return ; } if (!widget.fields?.length > 0) { widget.fields = ROMM_DEFAULT_FIELDS; } else if (widget.fields.length > MAX_ALLOWED_FIELDS) { widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS); } if (!response) { return ( ); } if (response) { return ( ); } }