mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: double click on sidebar opens game
This commit is contained in:
parent
086ee8ac04
commit
45d8923561
2 changed files with 32 additions and 31 deletions
|
@ -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 (
|
return (
|
||||||
<aside
|
<aside
|
||||||
ref={sidebarRef}
|
ref={sidebarRef}
|
||||||
|
@ -183,9 +197,7 @@ export function Sidebar() {
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={styles.menuItemButton}
|
className={styles.menuItemButton}
|
||||||
onClick={() =>
|
onClick={(event) => handleSidebarGameClick(event, game)}
|
||||||
handleSidebarItemClick(buildGameDetailsPath(game))
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{game.iconUrl ? (
|
{game.iconUrl ? (
|
||||||
<img
|
<img
|
||||||
|
|
|
@ -29,8 +29,6 @@ export function GameOptionsModal({
|
||||||
onClose,
|
onClose,
|
||||||
selectGameExecutable,
|
selectGameExecutable,
|
||||||
}: GameOptionsModalProps) {
|
}: GameOptionsModalProps) {
|
||||||
const [currentCategoryIndex, setCurrentCategoryIndex] = useState(0);
|
|
||||||
|
|
||||||
const { updateGame, openRepacksModal } = useContext(gameDetailsContext);
|
const { updateGame, openRepacksModal } = useContext(gameDetailsContext);
|
||||||
|
|
||||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||||
|
@ -80,19 +78,9 @@ export function GameOptionsModal({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
gap: `${SPACING_UNIT}px`,
|
gap: `${SPACING_UNIT}px`,
|
||||||
minWidth: "500px",
|
width: "700px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ marginBottom: `${SPACING_UNIT * 2}px` }}>
|
|
||||||
<Button
|
|
||||||
key={"general"}
|
|
||||||
theme={currentCategoryIndex === 0 ? "primary" : "outline"}
|
|
||||||
onClick={() => setCurrentCategoryIndex(0)}
|
|
||||||
>
|
|
||||||
General
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles.downloadSourceField}>
|
<div className={styles.downloadSourceField}>
|
||||||
<TextField
|
<TextField
|
||||||
label="Caminho do executável"
|
label="Caminho do executável"
|
||||||
|
@ -102,7 +90,9 @@ export function GameOptionsModal({
|
||||||
disabled
|
disabled
|
||||||
placeholder="Selecione um executável"
|
placeholder="Selecione um executável"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.downloadSourceField}>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
theme="outline"
|
theme="outline"
|
||||||
|
@ -110,7 +100,7 @@ export function GameOptionsModal({
|
||||||
onClick={handleOpenGameExecutablePath}
|
onClick={handleOpenGameExecutablePath}
|
||||||
>
|
>
|
||||||
<FileDirectoryOpenFillIcon />
|
<FileDirectoryOpenFillIcon />
|
||||||
{"Abrir local do executável"}
|
{"Abrir pasta"}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -122,20 +112,25 @@ export function GameOptionsModal({
|
||||||
<FileSymlinkFileIcon />
|
<FileSymlinkFileIcon />
|
||||||
{"Alterar"}
|
{"Alterar"}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={handleCreateShortcut}
|
||||||
|
theme="outline"
|
||||||
|
disabled={deleting}
|
||||||
|
>
|
||||||
|
{"Criar atalho"}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.downloadSourceField}>
|
<div className={styles.downloadSourceField}>
|
||||||
<TextField
|
<TextField
|
||||||
label="Caminho do instalador"
|
label="Caminho do instalador"
|
||||||
value={game.downloadPath + game.folderName}
|
value={`${game.downloadPath}\\${game.folderName}`}
|
||||||
readOnly
|
readOnly
|
||||||
theme="dark"
|
theme="dark"
|
||||||
disabled
|
disabled
|
||||||
placeholder=""
|
placeholder=""
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles.downloadSourceField}>
|
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
theme="outline"
|
theme="outline"
|
||||||
|
@ -143,7 +138,7 @@ export function GameOptionsModal({
|
||||||
onClick={handleOpenGameInstallerPath}
|
onClick={handleOpenGameInstallerPath}
|
||||||
>
|
>
|
||||||
<FileDirectoryOpenFillIcon />
|
<FileDirectoryOpenFillIcon />
|
||||||
{"Abrir pasta do instalador"}
|
{"Abrir pasta"}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -154,8 +149,11 @@ export function GameOptionsModal({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
{"Remover instalador"}
|
{"Remover"}
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.downloadSourceField}>
|
||||||
<Button
|
<Button
|
||||||
onClick={openRepacksModal}
|
onClick={openRepacksModal}
|
||||||
theme="outline"
|
theme="outline"
|
||||||
|
@ -164,15 +162,6 @@ export function GameOptionsModal({
|
||||||
{t("open_download_options")}
|
{t("open_download_options")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.downloadSourceField}>
|
|
||||||
<Button
|
|
||||||
onClick={handleCreateShortcut}
|
|
||||||
theme="outline"
|
|
||||||
disabled={deleting}
|
|
||||||
>
|
|
||||||
{"criar atalho na area de trabalho"}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue