diff --git a/src/widgets/romm/component.jsx b/src/widgets/romm/component.jsx index 94be30d1d..9f095cbec 100644 --- a/src/widgets/romm/component.jsx +++ b/src/widgets/romm/component.jsx @@ -4,20 +4,26 @@ import Container from "components/services/widget/container"; import Block from "components/services/widget/block"; import useWidgetAPI from "utils/proxy/use-widget-api"; +export const rommDefaultFields = ["platforms", "roms", "saves", "states"]; + export default function Component({ service }) { const { widget } = service; const { t } = useTranslation(); - const { data: response, error: responseError } = useWidgetAPI(widget, "statistics"); if (responseError) { - return ( - - - - ); + return ; } + // Default fields + if (!widget.fields?.length > 0) { + widget.fields = rommDefaultFields; + } + const MAX_ALLOWED_FIELDS = 4; + if (widget.fields?.length > MAX_ALLOWED_FIELDS) { + widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS); + } + if (!response) { return ( @@ -32,8 +38,6 @@ export default function Component({ service }) { } if (response) { - const totalFilesizeGB = (response.FILESIZE / 1024 ** 3).toFixed(2); - return ( @@ -41,7 +45,7 @@ export default function Component({ service }) { - + ); }