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,
|
||||
objectID: string,
|
||||
title: string,
|
||||
shop: GameShop,
|
||||
executablePath: string | null
|
||||
shop: GameShop
|
||||
) => {
|
||||
return gameRepository
|
||||
.update(
|
||||
|
@ -22,7 +21,6 @@ const addGameToLibrary = async (
|
|||
{
|
||||
shop,
|
||||
status: null,
|
||||
executablePath,
|
||||
isDeleted: false,
|
||||
}
|
||||
)
|
||||
|
@ -42,7 +40,6 @@ const addGameToLibrary = async (
|
|||
iconUrl,
|
||||
objectID,
|
||||
shop,
|
||||
executablePath,
|
||||
})
|
||||
.then(() => {
|
||||
if (iconUrl) {
|
||||
|
|
|
@ -61,19 +61,8 @@ contextBridge.exposeInMainWorld("electron", {
|
|||
syncDownloadSources: () => ipcRenderer.invoke("syncDownloadSources"),
|
||||
|
||||
/* Library */
|
||||
addGameToLibrary: (
|
||||
objectID: string,
|
||||
title: string,
|
||||
shop: GameShop,
|
||||
executablePath: string
|
||||
) =>
|
||||
ipcRenderer.invoke(
|
||||
"addGameToLibrary",
|
||||
objectID,
|
||||
title,
|
||||
shop,
|
||||
executablePath
|
||||
),
|
||||
addGameToLibrary: (objectID: string, title: string, shop: GameShop) =>
|
||||
ipcRenderer.invoke("addGameToLibrary", objectID, title, shop),
|
||||
createGameShortcut: (id: number) =>
|
||||
ipcRenderer.invoke("createGameShortcut", id),
|
||||
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: (
|
||||
objectID: string,
|
||||
title: string,
|
||||
shop: GameShop,
|
||||
executablePath: string | null
|
||||
shop: GameShop
|
||||
) => Promise<void>;
|
||||
createGameShortcut: (id: number) => Promise<boolean>;
|
||||
updateExecutablePath: (id: number, executablePath: string) => Promise<void>;
|
||||
|
|
|
@ -79,12 +79,7 @@ export function HeroPanelActions() {
|
|||
if (game) {
|
||||
await removeGameFromLibrary(game.id);
|
||||
} else {
|
||||
await window.electron.addGameToLibrary(
|
||||
objectID!,
|
||||
gameTitle,
|
||||
"steam",
|
||||
null
|
||||
);
|
||||
await window.electron.addGameToLibrary(objectID!, gameTitle, "steam");
|
||||
}
|
||||
|
||||
updateLibrary();
|
||||
|
|
|
@ -11,6 +11,7 @@ import { gameDetailsContext } from "../game-details.context";
|
|||
import {
|
||||
FileDirectoryOpenFillIcon,
|
||||
FileSymlinkFileIcon,
|
||||
PencilIcon,
|
||||
TrashIcon,
|
||||
} from "@primer/octicons-react";
|
||||
import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal";
|
||||
|
@ -54,6 +55,7 @@ export function GameOptionsModal({
|
|||
|
||||
const handleDeleteGame = async () => {
|
||||
await removeGameInstaller(game.id);
|
||||
updateGame();
|
||||
};
|
||||
|
||||
const handleOpenGameInstallerPath = async () => {
|
||||
|
@ -78,81 +80,9 @@ export function GameOptionsModal({
|
|||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: `${SPACING_UNIT}px`,
|
||||
width: "700px",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<div className={styles.downloadSourceField}>
|
||||
<TextField
|
||||
label="Caminho do executável"
|
||||
value={game.executablePath || ""}
|
||||
readOnly
|
||||
theme="dark"
|
||||
disabled
|
||||
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
|
||||
type="button"
|
||||
theme="outline"
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
onClick={handleChangeExecutableLocation}
|
||||
>
|
||||
<FileSymlinkFileIcon />
|
||||
{"Alterar"}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleCreateShortcut}
|
||||
theme="outline"
|
||||
disabled={deleting}
|
||||
>
|
||||
{"Criar atalho"}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className={styles.downloadSourceField}>
|
||||
<TextField
|
||||
label="Caminho do instalador"
|
||||
value={`${game.downloadPath}\\${game.folderName}`}
|
||||
readOnly
|
||||
theme="dark"
|
||||
disabled
|
||||
placeholder=""
|
||||
/>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
theme="outline"
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
onClick={handleOpenGameInstallerPath}
|
||||
>
|
||||
<FileDirectoryOpenFillIcon />
|
||||
{"Abrir pasta"}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
theme="outline"
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
onClick={() => {
|
||||
setShowDeleteModal(true);
|
||||
}}
|
||||
>
|
||||
<TrashIcon />
|
||||
{"Remover"}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className={styles.downloadSourceField}>
|
||||
<Button
|
||||
onClick={openRepacksModal}
|
||||
|
@ -162,6 +92,87 @@ export function GameOptionsModal({
|
|||
{t("open_download_options")}
|
||||
</Button>
|
||||
</div>
|
||||
<div className={styles.downloadSourceField}>
|
||||
<TextField
|
||||
label="Caminho do executável"
|
||||
value={game.executablePath || ""}
|
||||
readOnly
|
||||
theme="dark"
|
||||
disabled
|
||||
placeholder="Selecione um executável"
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
theme="outline"
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
onClick={handleChangeExecutableLocation}
|
||||
title={
|
||||
game.executablePath
|
||||
? "Trocar executável"
|
||||
: "Selecionar executável"
|
||||
}
|
||||
>
|
||||
<PencilIcon />
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
theme="outline"
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
onClick={handleOpenGameExecutablePath}
|
||||
disabled={!game.executablePath}
|
||||
title={"Abrir pasta"}
|
||||
>
|
||||
<FileDirectoryOpenFillIcon />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
onClick={handleCreateShortcut}
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
theme="outline"
|
||||
disabled={deleting || !game.executablePath}
|
||||
title={"Criar atalho"}
|
||||
>
|
||||
<FileSymlinkFileIcon />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className={styles.downloadSourceField}></div>
|
||||
|
||||
{game.folderName && (
|
||||
<div className={styles.downloadSourceField}>
|
||||
<TextField
|
||||
label="Caminho do instalador"
|
||||
value={`${game.downloadPath}\\${game.folderName}`}
|
||||
readOnly
|
||||
theme="dark"
|
||||
disabled
|
||||
placeholder=""
|
||||
/>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
theme="outline"
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
onClick={handleOpenGameInstallerPath}
|
||||
disabled={!game.downloadPath}
|
||||
title={"Abrir pasta"}
|
||||
>
|
||||
<FileDirectoryOpenFillIcon />
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
theme="outline"
|
||||
style={{ alignSelf: "flex-end" }}
|
||||
disabled={!game.downloadPath}
|
||||
onClick={() => {
|
||||
setShowDeleteModal(true);
|
||||
}}
|
||||
title={"Remover instalador"}
|
||||
>
|
||||
<TrashIcon />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue