diff --git a/docs/widgets/services/romm.md b/docs/widgets/services/romm.md
index 6d8bc8b30..cf10d09b8 100644
--- a/docs/widgets/services/romm.md
+++ b/docs/widgets/services/romm.md
@@ -4,6 +4,7 @@ description: Romm Widget Configuration
---
Allowed fields: `["platforms", "roms", "saves", "states", "screenshots", "totalfilesize"]`.
+If more than (4) fields are provided, only the first (4) will be used.
```yaml
widget:
@@ -11,5 +12,5 @@ widget:
url: http://romm.host.or.ip
username: username # optional
password: password # optional
- fields: ["platforms", "roms", "saves", "screenshots"]
+ fields: ["platforms", "roms", "saves", "states"] # optional - default fields shown
```
diff --git a/src/widgets/romm/component.jsx b/src/widgets/romm/component.jsx
index 94be30d1d..a9df14230 100644
--- a/src/widgets/romm/component.jsx
+++ b/src/widgets/romm/component.jsx
@@ -4,18 +4,24 @@ 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) {
@@ -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 }) {
-
+
);
}