refactor: fix some styles in game details modals

This commit is contained in:
Hachi-R 2025-01-21 17:41:58 -03:00
parent c7bc868fbb
commit 28a2f1dda5
3 changed files with 189 additions and 116 deletions

View File

@ -10,11 +10,12 @@
&__downloads-path-field { &__downloads-path-field {
display: flex; display: flex;
flex-direction: column;
gap: globals.$spacing-unit; gap: globals.$spacing-unit;
} }
&__hint-text { &__hint-text {
font-size: globals.$small-font-size; font-size: 12px;
color: globals.$body-color; color: globals.$body-color;
} }

View File

@ -7,18 +7,80 @@
flex-direction: column; flex-direction: column;
} }
&__header { &__section {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: globals.$spacing-unit; gap: globals.$spacing-unit;
} }
&__header-description { &__header {
display: flex;
flex-direction: column;
gap: globals.$spacing-unit;
&-description {
font-weight: 400; font-weight: 400;
} }
}
&__row { &__row {
display: flex; display: flex;
gap: globals.$spacing-unit; gap: globals.$spacing-unit;
} }
&__executable-field {
display: flex;
flex-direction: column;
gap: globals.$spacing-unit;
&-input {
width: 100%;
}
&-buttons {
display: flex;
gap: globals.$spacing-unit;
}
}
&__wine-prefix {
display: flex;
flex-direction: column;
gap: calc(globals.$spacing-unit * 2);
&-input {
width: 100%;
}
}
&__launch-options {
display: flex;
flex-direction: column;
gap: globals.$spacing-unit;
&-input {
width: 100%;
}
}
&__downloads {
display: flex;
flex-direction: column;
gap: globals.$spacing-unit;
}
&__danger-zone {
display: flex;
flex-direction: column;
gap: globals.$spacing-unit;
&-description {
font-weight: 400;
}
&-buttons {
display: flex;
gap: globals.$spacing-unit;
}
}
} }

View File

@ -2,7 +2,6 @@ import { useContext, useRef, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Button, Modal, TextField } from "@renderer/components"; import { Button, Modal, TextField } from "@renderer/components";
import type { Game } from "@types"; import type { Game } from "@types";
import * as styles from "./game-options-modal.css";
import { gameDetailsContext } from "@renderer/context"; import { gameDetailsContext } from "@renderer/context";
import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal"; import { DeleteGameModal } from "@renderer/pages/downloads/delete-game-modal";
import { useDownload, useToast, useUserDetails } from "@renderer/hooks"; import { useDownload, useToast, useUserDetails } from "@renderer/hooks";
@ -179,14 +178,12 @@ export function GameOptionsModal({
onClose={() => setShowDeleteModal(false)} onClose={() => setShowDeleteModal(false)}
deleteGame={handleDeleteGame} deleteGame={handleDeleteGame}
/> />
<RemoveGameFromLibraryModal <RemoveGameFromLibraryModal
visible={showRemoveGameModal} visible={showRemoveGameModal}
onClose={() => setShowRemoveGameModal(false)} onClose={() => setShowRemoveGameModal(false)}
removeGameFromLibrary={handleRemoveGameFromLibrary} removeGameFromLibrary={handleRemoveGameFromLibrary}
game={game} game={game}
/> />
<ResetAchievementsModal <ResetAchievementsModal
visible={showResetAchievementsModal} visible={showResetAchievementsModal}
onClose={() => setShowResetAchievementsModal(false)} onClose={() => setShowResetAchievementsModal(false)}
@ -201,6 +198,7 @@ export function GameOptionsModal({
large={true} large={true}
> >
<div className="game-options-modal__container"> <div className="game-options-modal__container">
<div className="game-options-modal__section">
<div className="game-options-modal__header"> <div className="game-options-modal__header">
<h2>{t("executable_section_title")}</h2> <h2>{t("executable_section_title")}</h2>
<h4 className="game-options-modal__header-description"> <h4 className="game-options-modal__header-description">
@ -208,6 +206,7 @@ export function GameOptionsModal({
</h4> </h4>
</div> </div>
<div className="game-options-modal__executable-field">
<TextField <TextField
value={game.executablePath || ""} value={game.executablePath || ""}
readOnly readOnly
@ -225,7 +224,10 @@ export function GameOptionsModal({
{t("select_executable")} {t("select_executable")}
</Button> </Button>
{game.executablePath && ( {game.executablePath && (
<Button onClick={handleClearExecutablePath} theme="outline"> <Button
onClick={handleClearExecutablePath}
theme="outline"
>
{t("clear")} {t("clear")}
</Button> </Button>
)} )}
@ -234,7 +236,7 @@ export function GameOptionsModal({
/> />
{game.executablePath && ( {game.executablePath && (
<div className={styles.gameOptionRow}> <div className="game-options-modal__executable-field-buttons">
<Button <Button
type="button" type="button"
theme="outline" theme="outline"
@ -247,12 +249,14 @@ export function GameOptionsModal({
</Button> </Button>
</div> </div>
)} )}
</div>
</div>
{shouldShowWinePrefixConfiguration && ( {shouldShowWinePrefixConfiguration && (
<div className={styles.optionsContainer}> <div className="game-options-modal__wine-prefix">
<div className={styles.gameOptionHeader}> <div className="game-options-modal__header">
<h2>{t("wine_prefix")}</h2> <h2>{t("wine_prefix")}</h2>
<h4 className={styles.gameOptionHeaderDescription}> <h4 className="game-options-modal__header-description">
{t("wine_prefix_description")} {t("wine_prefix_description")}
</h4> </h4>
</div> </div>
@ -287,11 +291,13 @@ export function GameOptionsModal({
)} )}
{shouldShowLaunchOptionsConfiguration && ( {shouldShowLaunchOptionsConfiguration && (
<div className={styles.gameOptionHeader}> <div className="game-options-modal__launch-options">
<div className="game-options-modal__header">
<h2>{t("launch_options")}</h2> <h2>{t("launch_options")}</h2>
<h4 className={styles.gameOptionHeaderDescription}> <h4 className="game-options-modal__header-description">
{t("launch_options_description")} {t("launch_options_description")}
</h4> </h4>
</div>
<TextField <TextField
value={launchOptions} value={launchOptions}
theme="dark" theme="dark"
@ -308,14 +314,15 @@ export function GameOptionsModal({
</div> </div>
)} )}
<div className={styles.gameOptionHeader}> <div className="game-options-modal__downloads">
<div className="game-options-modal__header">
<h2>{t("downloads_secion_title")}</h2> <h2>{t("downloads_secion_title")}</h2>
<h4 className={styles.gameOptionHeaderDescription}> <h4 className="game-options-modal__header-description">
{t("downloads_section_description")} {t("downloads_section_description")}
</h4> </h4>
</div> </div>
<div className={styles.gameOptionRow}> <div className="game-options-modal__row">
<Button <Button
onClick={() => setShowRepacksModal(true)} onClick={() => setShowRepacksModal(true)}
theme="outline" theme="outline"
@ -333,15 +340,17 @@ export function GameOptionsModal({
</Button> </Button>
)} )}
</div> </div>
</div>
<div className={styles.gameOptionHeader}> <div className="game-options-modal__danger-zone">
<div className="game-options-modal__header">
<h2>{t("danger_zone_section_title")}</h2> <h2>{t("danger_zone_section_title")}</h2>
<h4 className={styles.gameOptionHeaderDescription}> <h4 className="game-options-modal__danger-zone-description">
{t("danger_zone_section_description")} {t("danger_zone_section_description")}
</h4> </h4>
</div> </div>
<div className={styles.gameOptionRow}> <div className="game-options-modal__danger-zone-buttons">
<Button <Button
onClick={() => setShowRemoveGameModal(true)} onClick={() => setShowRemoveGameModal(true)}
theme="danger" theme="danger"
@ -374,6 +383,7 @@ export function GameOptionsModal({
</Button> </Button>
</div> </div>
</div> </div>
</div>
</Modal> </Modal>
</> </>
); );