diff --git a/src/widgets/nextcloud/component.jsx b/src/widgets/nextcloud/component.jsx
index 9bc54dc8..010ef73a 100755
--- a/src/widgets/nextcloud/component.jsx
+++ b/src/widgets/nextcloud/component.jsx
@@ -14,19 +14,21 @@ export default function Component({ service }) {
return ;
}
- // cpuload & memoryusage were deprecated, dont break existing installs & dont have > 4 blocks total
- let deprecatedFieldsCount = widget.fields ? widget.fields.includes('cpuload') + widget.fields.includes('memoryusage') : 0;
- if (widget.fields && widget.fields.length - deprecatedFieldsCount < 4) deprecatedFieldsCount -= 4 - (widget.fields.length - deprecatedFieldsCount);
+ // cpuload & memoryusage are deprecated, so limit to 4 fields
+ const showCpuLoad = widget.fields?.includes('cpuload');
+ const showMemoryUsage = widget.fields?.includes('memoryusage');
+ const showNumFiles = !showCpuLoad || !showMemoryUsage; // at least 1 deprecated field is hidden
+ const showNumShares = !showCpuLoad && !showMemoryUsage; // both deprecated fields are hidden
if (!nextcloudData) {
return (
- {widget.fields?.includes('cpuload') && }
- {widget.fields?.includes('memoryusage') && }
+ {showCpuLoad && }
+ {showMemoryUsage && }
- {deprecatedFieldsCount < 2 && }
- {deprecatedFieldsCount < 1 && }
+ {showNumFiles && }
+ {showNumShares && }
);
}
@@ -36,12 +38,12 @@ export default function Component({ service }) {
return (
- {widget.fields?.includes('cpuload') && }
- {widget.fields?.includes('memoryusage') && }
+ {showCpuLoad && }
+ {showMemoryUsage && }
- {deprecatedFieldsCount < 2 && }
- {deprecatedFieldsCount < 1 && }
+ {showNumFiles && }
+ {showNumShares && }
);
}