mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
organize ui
This commit is contained in:
parent
45d8923561
commit
e8b28ccf90
5 changed files with 89 additions and 98 deletions
|
@ -11,8 +11,7 @@ const addGameToLibrary = async (
|
||||||
_event: Electron.IpcMainInvokeEvent,
|
_event: Electron.IpcMainInvokeEvent,
|
||||||
objectID: string,
|
objectID: string,
|
||||||
title: string,
|
title: string,
|
||||||
shop: GameShop,
|
shop: GameShop
|
||||||
executablePath: string | null
|
|
||||||
) => {
|
) => {
|
||||||
return gameRepository
|
return gameRepository
|
||||||
.update(
|
.update(
|
||||||
|
@ -22,7 +21,6 @@ const addGameToLibrary = async (
|
||||||
{
|
{
|
||||||
shop,
|
shop,
|
||||||
status: null,
|
status: null,
|
||||||
executablePath,
|
|
||||||
isDeleted: false,
|
isDeleted: false,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -42,7 +40,6 @@ const addGameToLibrary = async (
|
||||||
iconUrl,
|
iconUrl,
|
||||||
objectID,
|
objectID,
|
||||||
shop,
|
shop,
|
||||||
executablePath,
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (iconUrl) {
|
if (iconUrl) {
|
||||||
|
|
|
@ -61,19 +61,8 @@ contextBridge.exposeInMainWorld("electron", {
|
||||||
syncDownloadSources: () => ipcRenderer.invoke("syncDownloadSources"),
|
syncDownloadSources: () => ipcRenderer.invoke("syncDownloadSources"),
|
||||||
|
|
||||||
/* Library */
|
/* Library */
|
||||||
addGameToLibrary: (
|
addGameToLibrary: (objectID: string, title: string, shop: GameShop) =>
|
||||||
objectID: string,
|
ipcRenderer.invoke("addGameToLibrary", objectID, title, shop),
|
||||||
title: string,
|
|
||||||
shop: GameShop,
|
|
||||||
executablePath: string
|
|
||||||
) =>
|
|
||||||
ipcRenderer.invoke(
|
|
||||||
"addGameToLibrary",
|
|
||||||
objectID,
|
|
||||||
title,
|
|
||||||
shop,
|
|
||||||
executablePath
|
|
||||||
),
|
|
||||||
createGameShortcut: (id: number) =>
|
createGameShortcut: (id: number) =>
|
||||||
ipcRenderer.invoke("createGameShortcut", id),
|
ipcRenderer.invoke("createGameShortcut", id),
|
||||||
updateExecutablePath: (id: number, executablePath: string) =>
|
updateExecutablePath: (id: number, executablePath: string) =>
|
||||||
|
|
3
src/renderer/src/declaration.d.ts
vendored
3
src/renderer/src/declaration.d.ts
vendored
|
@ -56,8 +56,7 @@ declare global {
|
||||||
addGameToLibrary: (
|
addGameToLibrary: (
|
||||||
objectID: string,
|
objectID: string,
|
||||||
title: string,
|
title: string,
|
||||||
shop: GameShop,
|
shop: GameShop
|
||||||
executablePath: string | null
|
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
createGameShortcut: (id: number) => Promise<boolean>;
|
createGameShortcut: (id: number) => Promise<boolean>;
|
||||||
updateExecutablePath: (id: number, executablePath: string) => Promise<void>;
|
updateExecutablePath: (id: number, executablePath: string) => Promise<void>;
|
||||||
|
|
|
@ -79,12 +79,7 @@ export function HeroPanelActions() {
|
||||||
if (game) {
|
if (game) {
|
||||||
await removeGameFromLibrary(game.id);
|
await removeGameFromLibrary(game.id);
|
||||||
} else {
|
} else {
|
||||||
await window.electron.addGameToLibrary(
|
await window.electron.addGameToLibrary(objectID!, gameTitle, "steam");
|
||||||
objectID!,
|
|
||||||
gameTitle,
|
|
||||||
"steam",
|
|
||||||
null
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLibrary();
|
updateLibrary();
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { gameDetailsContext } from "../game-details.context";
|
||||||
import {
|
import {
|
||||||
FileDirectoryOpenFillIcon,
|
FileDirectoryOpenFillIcon,
|
||||||
FileSymlinkFileIcon,
|
FileSymlinkFileIcon,
|
||||||
|
PencilIcon,
|
||||||
TrashIcon,
|
TrashIcon,
|
||||||
} from "@primer/octicons-react";
|
} from "@primer/octicons-react";
|
||||||
import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal";
|
import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal";
|
||||||
|
@ -54,6 +55,7 @@ export function GameOptionsModal({
|
||||||
|
|
||||||
const handleDeleteGame = async () => {
|
const handleDeleteGame = async () => {
|
||||||
await removeGameInstaller(game.id);
|
await removeGameInstaller(game.id);
|
||||||
|
updateGame();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOpenGameInstallerPath = async () => {
|
const handleOpenGameInstallerPath = async () => {
|
||||||
|
@ -78,9 +80,18 @@ export function GameOptionsModal({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
gap: `${SPACING_UNIT}px`,
|
gap: `${SPACING_UNIT}px`,
|
||||||
width: "700px",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<div className={styles.downloadSourceField}>
|
||||||
|
<Button
|
||||||
|
onClick={openRepacksModal}
|
||||||
|
theme="outline"
|
||||||
|
disabled={deleting}
|
||||||
|
>
|
||||||
|
{t("open_download_options")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<div className={styles.downloadSourceField}>
|
<div className={styles.downloadSourceField}>
|
||||||
<TextField
|
<TextField
|
||||||
label="Caminho do executável"
|
label="Caminho do executável"
|
||||||
|
@ -90,37 +101,44 @@ export function GameOptionsModal({
|
||||||
disabled
|
disabled
|
||||||
placeholder="Selecione um executável"
|
placeholder="Selecione um executável"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles.downloadSourceField}>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
theme="outline"
|
|
||||||
style={{ alignSelf: "flex-end" }}
|
|
||||||
onClick={handleOpenGameExecutablePath}
|
|
||||||
>
|
|
||||||
<FileDirectoryOpenFillIcon />
|
|
||||||
{"Abrir pasta"}
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
theme="outline"
|
theme="outline"
|
||||||
style={{ alignSelf: "flex-end" }}
|
style={{ alignSelf: "flex-end" }}
|
||||||
onClick={handleChangeExecutableLocation}
|
onClick={handleChangeExecutableLocation}
|
||||||
|
title={
|
||||||
|
game.executablePath
|
||||||
|
? "Trocar executável"
|
||||||
|
: "Selecionar executável"
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<FileSymlinkFileIcon />
|
<PencilIcon />
|
||||||
{"Alterar"}
|
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleCreateShortcut}
|
type="button"
|
||||||
theme="outline"
|
theme="outline"
|
||||||
disabled={deleting}
|
style={{ alignSelf: "flex-end" }}
|
||||||
|
onClick={handleOpenGameExecutablePath}
|
||||||
|
disabled={!game.executablePath}
|
||||||
|
title={"Abrir pasta"}
|
||||||
>
|
>
|
||||||
{"Criar atalho"}
|
<FileDirectoryOpenFillIcon />
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
onClick={handleCreateShortcut}
|
||||||
|
style={{ alignSelf: "flex-end" }}
|
||||||
|
theme="outline"
|
||||||
|
disabled={deleting || !game.executablePath}
|
||||||
|
title={"Criar atalho"}
|
||||||
|
>
|
||||||
|
<FileSymlinkFileIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.downloadSourceField}></div>
|
||||||
|
|
||||||
|
{game.folderName && (
|
||||||
<div className={styles.downloadSourceField}>
|
<div className={styles.downloadSourceField}>
|
||||||
<TextField
|
<TextField
|
||||||
label="Caminho do instalador"
|
label="Caminho do instalador"
|
||||||
|
@ -136,32 +154,25 @@ export function GameOptionsModal({
|
||||||
theme="outline"
|
theme="outline"
|
||||||
style={{ alignSelf: "flex-end" }}
|
style={{ alignSelf: "flex-end" }}
|
||||||
onClick={handleOpenGameInstallerPath}
|
onClick={handleOpenGameInstallerPath}
|
||||||
|
disabled={!game.downloadPath}
|
||||||
|
title={"Abrir pasta"}
|
||||||
>
|
>
|
||||||
<FileDirectoryOpenFillIcon />
|
<FileDirectoryOpenFillIcon />
|
||||||
{"Abrir pasta"}
|
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
theme="outline"
|
theme="outline"
|
||||||
style={{ alignSelf: "flex-end" }}
|
style={{ alignSelf: "flex-end" }}
|
||||||
|
disabled={!game.downloadPath}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowDeleteModal(true);
|
setShowDeleteModal(true);
|
||||||
}}
|
}}
|
||||||
|
title={"Remover instalador"}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
{"Remover"}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={styles.downloadSourceField}>
|
|
||||||
<Button
|
|
||||||
onClick={openRepacksModal}
|
|
||||||
theme="outline"
|
|
||||||
disabled={deleting}
|
|
||||||
>
|
|
||||||
{t("open_download_options")}
|
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue