From 04be5c754e6b60459edf0e196ede09432380d2c6 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Fri, 19 Sep 2025 17:43:21 +0300 Subject: [PATCH] Changed props to be read-only, started using coalescing operator --- .../events/library/update-game-custom-assets.ts | 13 +++---------- .../sidebar/sidebar-adding-custom-game-modal.tsx | 4 ++-- .../game-details/modals/edit-custom-game-modal.tsx | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/main/events/library/update-game-custom-assets.ts b/src/main/events/library/update-game-custom-assets.ts index 6049ef5d..6e504e92 100644 --- a/src/main/events/library/update-game-custom-assets.ts +++ b/src/main/events/library/update-game-custom-assets.ts @@ -21,16 +21,9 @@ const updateGameCustomAssets = async ( const updatedGame = { ...existingGame, title, - customIconUrl: - customIconUrl !== undefined ? customIconUrl : existingGame.customIconUrl, - customLogoImageUrl: - customLogoImageUrl !== undefined - ? customLogoImageUrl - : existingGame.customLogoImageUrl, - customHeroImageUrl: - customHeroImageUrl !== undefined - ? customHeroImageUrl - : existingGame.customHeroImageUrl, + customIconUrl: customIconUrl ?? existingGame.customIconUrl, + customLogoImageUrl: customLogoImageUrl ?? existingGame.customLogoImageUrl, + customHeroImageUrl: customHeroImageUrl ?? existingGame.customHeroImageUrl, }; await gamesSublevel.put(gameKey, updatedGame); diff --git a/src/renderer/src/components/sidebar/sidebar-adding-custom-game-modal.tsx b/src/renderer/src/components/sidebar/sidebar-adding-custom-game-modal.tsx index 4b18a211..7eb8fe32 100644 --- a/src/renderer/src/components/sidebar/sidebar-adding-custom-game-modal.tsx +++ b/src/renderer/src/components/sidebar/sidebar-adding-custom-game-modal.tsx @@ -17,10 +17,10 @@ export interface SidebarAddingCustomGameModalProps { onClose: () => void; } -export function SidebarAddingCustomGameModal({ +export function SidebarAddingCustomGameModal ({ visible, onClose, -}: SidebarAddingCustomGameModalProps) { +}: Readonly) { const { t } = useTranslation("sidebar"); const { updateLibrary } = useLibrary(); const { showSuccessToast, showErrorToast } = useToast(); diff --git a/src/renderer/src/pages/game-details/modals/edit-custom-game-modal.tsx b/src/renderer/src/pages/game-details/modals/edit-custom-game-modal.tsx index fd1e850f..b8daf355 100644 --- a/src/renderer/src/pages/game-details/modals/edit-custom-game-modal.tsx +++ b/src/renderer/src/pages/game-details/modals/edit-custom-game-modal.tsx @@ -20,7 +20,7 @@ export function EditCustomGameModal({ onClose, game, onGameUpdated, -}: EditCustomGameModalProps) { +}: Readonly) { const { t } = useTranslation("sidebar"); const { showSuccessToast, showErrorToast } = useToast();