new properties panel

This commit is contained in:
AntoninoP 2024-08-20 16:56:00 +02:00
parent fcdbf628d8
commit 034336a40d
3 changed files with 181 additions and 167 deletions

View File

@ -37,8 +37,6 @@ const ServerConsole = ({ user }) => {
logString = logString.replace(/'{2,}/g, ''); logString = logString.replace(/'{2,}/g, '');
logString = logString.trim(); logString = logString.trim();
setLogs(logString); setLogs(logString);
} else {
setError(`Erreur lors de la récupération des logs: ${response.message}`);
} }
} catch (err) { } catch (err) {
setError(`Erreur: ${err.message}`); setError(`Erreur: ${err.message}`);

View File

@ -84,8 +84,10 @@ const ServerProprieties = ({ user }) => {
<div className={styles.serverDetailsContainer}> <div className={styles.serverDetailsContainer}>
<div className={styles.details}> <div className={styles.details}>
<h1>Propriétés du serveur {server.name}</h1> <h1>Propriétés du serveur {server.name}</h1>
<div className={styles.formRow}>
<div className={styles.formGroup}> <div className={styles.formGroup}>
<label htmlFor="difficulty">Difficultée:</label> <label htmlFor="difficulty">Difficulté:</label>
<select id="difficulty" name="difficulty" value={server.difficulty} onChange={handleChange}> <select id="difficulty" name="difficulty" value={server.difficulty} onChange={handleChange}>
<option value="easy">Facile</option> <option value="easy">Facile</option>
<option value="normal">Normal</option> <option value="normal">Normal</option>
@ -99,6 +101,9 @@ const ServerProprieties = ({ user }) => {
<option value="false">Désactivé</option> <option value="false">Désactivé</option>
</select> </select>
</div> </div>
</div>
<div className={styles.formRow}>
<div className={styles.formGroup}> <div className={styles.formGroup}>
<label htmlFor="gamemode">Gamemode:</label> <label htmlFor="gamemode">Gamemode:</label>
<select id="gamemode" name="gamemode" value={server.gamemode} onChange={handleChange}> <select id="gamemode" name="gamemode" value={server.gamemode} onChange={handleChange}>
@ -115,6 +120,9 @@ const ServerProprieties = ({ user }) => {
<option value="false">Désactivé</option> <option value="false">Désactivé</option>
</select> </select>
</div> </div>
</div>
<div className={styles.formRow}>
<div className={styles.formGroup}> <div className={styles.formGroup}>
<label htmlFor="maxPlayers">Max de joueurs:</label> <label htmlFor="maxPlayers">Max de joueurs:</label>
<input type="number" id="maxPlayers" name="maxPlayers" value={server.maxPlayers} onChange={handleChange} /> <input type="number" id="maxPlayers" name="maxPlayers" value={server.maxPlayers} onChange={handleChange} />
@ -123,6 +131,9 @@ const ServerProprieties = ({ user }) => {
<label htmlFor="motd">Description du serveur:</label> <label htmlFor="motd">Description du serveur:</label>
<input type="text" id="motd" name="motd" value={server.motd} onChange={handleChange} /> <input type="text" id="motd" name="motd" value={server.motd} onChange={handleChange} />
</div> </div>
</div>
<div className={styles.formRow}>
<div className={styles.formGroup}> <div className={styles.formGroup}>
<label htmlFor="onlineMode">Mode en ligne:</label> <label htmlFor="onlineMode">Mode en ligne:</label>
<select id="onlineMode" name="onlineMode" value={server.onlineMode} onChange={handleChange}> <select id="onlineMode" name="onlineMode" value={server.onlineMode} onChange={handleChange}>
@ -137,6 +148,8 @@ const ServerProprieties = ({ user }) => {
<option value="false">Désactivé</option> <option value="false">Désactivé</option>
</select> </select>
</div> </div>
</div>
<button className={styles.saveButton} onClick={handleSave}>Sauvegarder</button> <button className={styles.saveButton} onClick={handleSave}>Sauvegarder</button>
</div> </div>
</div> </div>
@ -144,13 +157,11 @@ const ServerProprieties = ({ user }) => {
}; };
ServerProprieties.propTypes = { ServerProprieties.propTypes = {
user: PropTypes.oneOfType([ user: PropTypes.shape({
PropTypes.shape({
uid: PropTypes.string.isRequired, uid: PropTypes.string.isRequired,
displayName: PropTypes.string, displayName: PropTypes.string,
email: PropTypes.string, email: PropTypes.string,
}), }),
]),
}; };
export default ServerProprieties; export default ServerProprieties;

View File

@ -10,54 +10,62 @@
} }
.details { .details {
padding: 3rem; padding: 2rem;
padding-top: 0; background-color: #100D25;
background-color: var(--card-bg-color); width: 50rem;
width: 100%; box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
max-width: 60rem; border-radius: 0.5rem;
border-radius: 1.5rem; border: 0.1rem solid #343947;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
box-sizing: border-box; box-sizing: border-box;
} }
.formRow {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.formGroup { .formGroup {
margin-bottom: 2.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 1;
margin-right: 0.625rem;
margin-bottom: 1.5rem;
&:last-child {
margin-right: 0;
} }
.formGroup label { label {
font-weight: 600; font-weight: 600;
margin-bottom: 1rem; margin-bottom: 0.5rem;
font-size: 1.4rem; font-size: 1rem;
color: var(--label-color); color: #EAEAEA;
} }
.formGroup input, input,
.formGroup select { select {
width: 100%; width: 15rem;
padding: 1.2rem; max-width: 20rem;
height: auto; padding: 0.7rem;
background-color: var(--input-bg-color); background-color: #2C2C44;
border: 1px solid var(--input-border-color); border: 0.1rem solid #44476A;
border-radius: 0.75rem; border-radius: 0.5rem;
color: var(--text-color); color: #EAEAEA;
font-size: 1.2rem; font-size: 1rem;
line-height: 1.5rem;
box-sizing: border-box; box-sizing: border-box;
transition: border-color 0.3s ease, box-shadow 0.3s ease; transition: border-color 0.3s ease, box-shadow 0.3s ease;
} }
.formGroup input:focus, input:focus,
.formGroup select:focus { select:focus {
border-color: var(--focus-border-color); border-color: #5B5EE6;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 0.5rem rgba(91, 94, 230, 0.5);
outline: none; outline: none;
} }
/* Chrome- styles */
@supports (-webkit-appearance: none) { @supports (-webkit-appearance: none) {
.formGroup select { select {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
appearance: none; appearance: none;
@ -68,66 +76,63 @@
padding-right: 3rem; padding-right: 3rem;
} }
} }
.saveButton,
.quitButton {
padding: 1.2rem 2.5rem;
color: var(--button-text-color);
border: none;
border-radius: 0.75rem;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.3s ease;
font-size: 1.2rem;
margin-top: 1rem;
} }
.saveButton { .saveButton {
background-color: #05a771; width: 10rem;
} padding: .5rem .5rem;
color: #FFF;
border: none;
border-radius: 0.5rem;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.3s ease;
font-size: 1.1rem;
background-color: #1D1836;
.saveButton:hover {
background-color: #05a77183;
}
.quitButton {
background-color: gray;
margin-left: 1rem;
}
&:active {
transform: translateY(0);
}
}
.error { .error {
color: var(--error-color); color: #FF5C5C;
font-size: 1.2rem; font-size: 1.2rem;
} }
.details h1 { .details h1 {
font-size: 2.5rem; font-size: 1.75rem;
margin-bottom: 3rem; margin-bottom: 2rem;
color: var(--header-color); color: #FFF;
text-align: center;
} }
@media (max-width: 768px) { @media (max-width: 48rem) {
.details { .details {
width: 90%; width: 90%;
padding: 2rem; padding: 1.5rem;
}
.formGroup {
margin-right: 0;
} }
.formGroup input, .formGroup input,
.formGroup select { .formGroup select {
height: auto; width: 100%;
font-size: 1.1rem; font-size: 1rem;
padding: 1rem; padding: 0.75rem;
} }
.saveButton, .saveButton,
.quitButton { .quitButton {
padding: 1rem 2rem; padding: 0.75rem;
font-size: 1.1rem; font-size: 1rem;
} }
.details h1 { .details h1 {
font-size: 2rem; font-size: 1.5rem;
margin-bottom: 2rem; margin-bottom: 1.25rem;
} }
} }