浏览代码

code style & formatting

shamoon 1 年之前
父节点
当前提交
ccf360b859
共有 2 个文件被更改,包括 19 次插入19 次删除
  1. 17 17
      docs/widgets/services/fritzbox.md
  2. 2 2
      src/widgets/fritzbox/component.jsx

+ 17 - 17
docs/widgets/services/fritzbox.md

@@ -1,22 +1,22 @@
-  ---
-  title: FRITZ!Box
-  description: FRITZ!Box Widget Configuration
-  ---
+---
+title: FRITZ!Box
+description: FRITZ!Box Widget Configuration
+---
 
 
-  Application access & UPnP must be activated on your device:
+Application access & UPnP must be activated on your device:
 
 
-  ```
-  Home Network > Network > Network Settings > Access Settings in the Home Network
-  [x] Allow access for applications
-  [x] Transmit status information over UPnP
-  ```
+```
+Home Network > Network > Network Settings > Access Settings in the Home Network
+[x] Allow access for applications
+[x] Transmit status information over UPnP
+```
 
 
-  You don't need to provide any credentials.
+You don't need to provide any credentials.
 
 
-  Allowed fields (limited to a max of 4): `["connectionStatus", "upTime", "maxDown", "maxUp", "down", "up", "received", "sent", "externalIPAddress"]`.
+Allowed fields (limited to a max of 4): `["connectionStatus", "upTime", "maxDown", "maxUp", "down", "up", "received", "sent", "externalIPAddress"]`.
 
 
-  ```yaml
-  widget:
-    type: fritzbox
-    url: https://192.168.178.1
-  ```
+```yaml
+widget:
+  type: fritzbox
+  url: https://192.168.178.1
+```

+ 2 - 2
src/widgets/fritzbox/component.jsx

@@ -26,12 +26,12 @@ export default function Component({ service }) {
   }
   }
 
 
   // Default fields
   // Default fields
-  if (widget.fields == null || widget.fields.length === 0) {
+  if (!widget.fields?.length > 0) {
     widget.fields = ["connectionStatus", "uptime", "maxDown", "maxUp"];
     widget.fields = ["connectionStatus", "uptime", "maxDown", "maxUp"];
   }
   }
   const MAX_ALLOWED_FIELDS = 4;
   const MAX_ALLOWED_FIELDS = 4;
   // Limits max number of displayed fields
   // Limits max number of displayed fields
-  if (widget.fields != null && widget.fields.length > MAX_ALLOWED_FIELDS) {
+  if (widget.fields?.length > MAX_ALLOWED_FIELDS) {
     widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS);
     widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS);
   }
   }