From 4d727708e26a4a5ea8ba4c06494463c5ce17d728 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Tue, 28 Nov 2023 15:16:27 -0500 Subject: [PATCH] chore(web): curly braces (#5362) --- web/.eslintrc.cjs | 1 + .../admin-page/restore-dialoge.svelte | 7 +++-- web/src/lib/utils/thumbnail-util.ts | 26 ++++++++++++++----- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/web/.eslintrc.cjs b/web/.eslintrc.cjs index fdf66b7005..9277676ac5 100644 --- a/web/.eslintrc.cjs +++ b/web/.eslintrc.cjs @@ -35,5 +35,6 @@ module.exports = { varsIgnorePattern: '^_$', }, ], + curly: 2, }, }; diff --git a/web/src/lib/components/admin-page/restore-dialoge.svelte b/web/src/lib/components/admin-page/restore-dialoge.svelte index 848dedaf65..e96a4a54db 100644 --- a/web/src/lib/components/admin-page/restore-dialoge.svelte +++ b/web/src/lib/components/admin-page/restore-dialoge.svelte @@ -9,8 +9,11 @@ const restoreUser = async () => { 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'); + } }; diff --git a/web/src/lib/utils/thumbnail-util.ts b/web/src/lib/utils/thumbnail-util.ts index 07c99ddb44..19448b944f 100644 --- a/web/src/lib/utils/thumbnail-util.ts +++ b/web/src/lib/utils/thumbnail-util.ts @@ -7,12 +7,26 @@ export function getThumbnailSize(assetCount: number, viewWidth: number): number { if (assetCount < 6) { 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;