From 45d8923561b853b66d855f4fb84235a26604f59f Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:14:13 -0300 Subject: [PATCH] feat: double click on sidebar opens game --- .../src/components/sidebar/sidebar.tsx | 18 ++++++-- .../modals/game-options-modal.tsx | 45 +++++++------------ 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/renderer/src/components/sidebar/sidebar.tsx b/src/renderer/src/components/sidebar/sidebar.tsx index 76ab3137..faa77708 100644 --- a/src/renderer/src/components/sidebar/sidebar.tsx +++ b/src/renderer/src/components/sidebar/sidebar.tsx @@ -122,6 +122,20 @@ export function Sidebar() { } }; + const handleSidebarGameClick = ( + event: React.MouseEvent, + game: LibraryGame + ) => { + const path = buildGameDetailsPath(game); + if (path !== location.pathname) { + navigate(path); + } + + if (event.detail == 2 && game.executablePath) { + window.electron.openGame(game.id, game.executablePath); + } + }; + return (