浏览代码

chore(web): curly braces (#5362)

Jason Rasmussen 1 年之前
父节点
当前提交
4d727708e2
共有 3 个文件被更改,包括 26 次插入8 次删除
  1. 1 0
      web/.eslintrc.cjs
  2. 5 2
      web/src/lib/components/admin-page/restore-dialoge.svelte
  3. 20 6
      web/src/lib/utils/thumbnail-util.ts

+ 1 - 0
web/.eslintrc.cjs

@@ -35,5 +35,6 @@ module.exports = {
         varsIgnorePattern: '^_$',
         varsIgnorePattern: '^_$',
       },
       },
     ],
     ],
+    curly: 2,
   },
   },
 };
 };

+ 5 - 2
web/src/lib/components/admin-page/restore-dialoge.svelte

@@ -9,8 +9,11 @@
 
 
   const restoreUser = async () => {
   const restoreUser = async () => {
     const restoredUser = await api.userApi.restoreUser({ id: user.id });
     const restoredUser = await api.userApi.restoreUser({ id: user.id });
-    if (restoredUser.data.deletedAt == null) dispatch('user-restore-success');
-    else dispatch('user-restore-fail');
+    if (restoredUser.data.deletedAt == null) {
+      dispatch('user-restore-success');
+    } else {
+      dispatch('user-restore-fail');
+    }
   };
   };
 </script>
 </script>
 
 

+ 20 - 6
web/src/lib/utils/thumbnail-util.ts

@@ -7,12 +7,26 @@
 export function getThumbnailSize(assetCount: number, viewWidth: number): number {
 export function getThumbnailSize(assetCount: number, viewWidth: number): number {
   if (assetCount < 6) {
   if (assetCount < 6) {
     return Math.min(320, Math.floor(viewWidth / assetCount - assetCount));
     return Math.min(320, Math.floor(viewWidth / assetCount - assetCount));
-  } else {
-    if (viewWidth > 600) return viewWidth / 7 - 7;
-    else if (viewWidth > 400) return viewWidth / 4 - 6;
-    else if (viewWidth > 300) return viewWidth / 2 - 6;
-    else if (viewWidth > 200) return viewWidth / 2 - 6;
-    else if (viewWidth > 100) return viewWidth / 1 - 6;
+  }
+
+  if (viewWidth > 600) {
+    return viewWidth / 7 - 7;
+  }
+
+  if (viewWidth > 400) {
+    return viewWidth / 4 - 6;
+  }
+
+  if (viewWidth > 300) {
+    return viewWidth / 2 - 6;
+  }
+
+  if (viewWidth > 200) {
+    return viewWidth / 2 - 6;
+  }
+
+  if (viewWidth > 100) {
+    return viewWidth / 1 - 6;
   }
   }
 
 
   return 300;
   return 300;