mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-17 21:40:30 +00:00
+ max players show
This commit is contained in:
parent
7f1f2df84d
commit
9ba1c89da7
@ -191,7 +191,7 @@ CreateServer.propTypes = {
|
|||||||
]),
|
]),
|
||||||
onCreateServer: PropTypes.func.isRequired,
|
onCreateServer: PropTypes.func.isRequired,
|
||||||
onSubdomainUpdate: PropTypes.func.isRequired,
|
onSubdomainUpdate: PropTypes.func.isRequired,
|
||||||
onCancel: PropTypes.func.isRequired,
|
onCancel: PropTypes.func,
|
||||||
noServers: PropTypes.any
|
noServers: PropTypes.any
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,10 +5,9 @@ import paper from '../../assets/frameworks/paper.png';
|
|||||||
import spigot from '../../assets/frameworks/spigot.png';
|
import spigot from '../../assets/frameworks/spigot.png';
|
||||||
import bukkit from '../../assets/frameworks/bukkit.png';
|
import bukkit from '../../assets/frameworks/bukkit.png';
|
||||||
import vanilla from '../../assets/frameworks/vanilla.png';
|
import vanilla from '../../assets/frameworks/vanilla.png';
|
||||||
import delete_button from '../../assets/frameworks/delete.png';
|
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, onDeleteClick }) => {
|
const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, onDeleteClick , countPlayers , maxPlayers}) => {
|
||||||
|
|
||||||
const getFrameworkSource = () => {
|
const getFrameworkSource = () => {
|
||||||
switch (framework) {
|
switch (framework) {
|
||||||
@ -52,25 +51,31 @@ const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick,
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Link to={`/server/${name}`} className={styles.serverCard}>
|
<Link to={`/server/${name}`} className={styles.serverCard}>
|
||||||
<div className={styles.leftCard}>
|
<div className={styles.header}>
|
||||||
<div className={styles.status}>
|
<div className={styles.serverInfo}>
|
||||||
<div className={styles.name}>{name}</div>
|
|
||||||
<img src={getFrameworkSource()} alt={`${name} Icon`} className={styles.frameworkIcon} />
|
<img src={getFrameworkSource()} alt={`${name} Icon`} className={styles.frameworkIcon} />
|
||||||
<div className="tooltip"></div>
|
<div>
|
||||||
</div>
|
<div className={styles.serverName}>{name}</div>
|
||||||
<div className={styles.buttonContainer}>
|
|
||||||
{status === false && (
|
|
||||||
<button className={styles.stoppedButton} onClick={handleRun}>▶ Démarrer</button>
|
|
||||||
)}
|
|
||||||
{status === true && (
|
|
||||||
<button className={styles.runningButton} onClick={handleStop}>◼ Arrêter</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={styles.version}>Version: {version}</div>
|
<div className={styles.version}>Version: {version}</div>
|
||||||
<button className={styles.runningButton} onClick={handleDelete}><img src={delete_button} className={styles.deleteButton} /></button>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={styles.status}>
|
||||||
|
{status === false ? " " : countPlayers + "/" + maxPlayers + " joueurs"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={styles.actions}>
|
||||||
|
<div>
|
||||||
|
{status === false ? (
|
||||||
|
<button className={`${styles.startStopButton} ${styles.stoppedButton}`} onClick={handleRun}>▶ Démarrer</button>
|
||||||
|
) : (
|
||||||
|
<button className={`${styles.startStopButton} ${styles.runningButton}`} onClick={handleStop}>◼ Arrêter</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<button className={styles.deleteButton} onClick={handleDelete}>🗑 Supprimer</button>
|
||||||
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ServerCard.propTypes = {
|
ServerCard.propTypes = {
|
||||||
@ -82,6 +87,7 @@ ServerCard.propTypes = {
|
|||||||
onRunClick: PropTypes.func.isRequired,
|
onRunClick: PropTypes.func.isRequired,
|
||||||
onStopClick: PropTypes.func.isRequired,
|
onStopClick: PropTypes.func.isRequired,
|
||||||
onDeleteClick: PropTypes.func.isRequired,
|
onDeleteClick: PropTypes.func.isRequired,
|
||||||
|
countPlayers: PropTypes.number,
|
||||||
subdomain: PropTypes.string,
|
subdomain: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,88 +1,95 @@
|
|||||||
.serverCard {
|
.serverCard {
|
||||||
width: var(--card-width);
|
display: flex;
|
||||||
padding: var(--card-padding);
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
width: 35.5rem;
|
||||||
|
padding: 2rem;
|
||||||
border: 0.2rem solid var(--card-border-color);
|
border: 0.2rem solid var(--card-border-color);
|
||||||
border-radius: 0.8rem;
|
border-radius: 0.8rem;
|
||||||
text-decoration: none;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
background-color: var(--card-bg-color);
|
background-color: var(--card-bg-color);
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.serverInfo {
|
||||||
.status {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.frameworkIcon {
|
.frameworkIcon {
|
||||||
width: 2rem;
|
width: 2.5rem;
|
||||||
height: 2rem;
|
height: 2.5rem;
|
||||||
pointer-events: none;
|
margin-right: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stoppedButton{
|
.serverName {
|
||||||
background-color: #008d5f;
|
font-size: 1.6rem;
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 1rem 1.6rem;
|
|
||||||
border-radius: 0.6rem;
|
|
||||||
outline: none;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
margin-top: 1rem;
|
|
||||||
|
|
||||||
}
|
|
||||||
.runningButton{
|
|
||||||
background-color: #8d213e;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 1rem 1.6rem;
|
|
||||||
border-radius: 0.6rem;
|
|
||||||
outline: none;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.runningButton:hover{
|
|
||||||
background-color: #8d213ec1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stoppedButton:hover{
|
|
||||||
background-color: #008d5fc1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.deleteButton{
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
user-select: none;
|
|
||||||
pointer-events: none;
|
|
||||||
-webkit-user-select: none; /* Safari */
|
|
||||||
-moz-user-select: none; /* Firefox */
|
|
||||||
-ms-user-select: none; /* IE/Edge */
|
|
||||||
}
|
|
||||||
|
|
||||||
.name {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding-right: 0.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.version {
|
.version {
|
||||||
font-size: 1.5rem;
|
font-size: 1.2rem;
|
||||||
margin-left: auto;
|
color: var(--text-secondary-color);
|
||||||
margin-right: 2rem;
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.leftCard {
|
.status {
|
||||||
display: flex;
|
font-size: 1.2rem;
|
||||||
flex-direction: column;
|
font-weight: bold;
|
||||||
align-items: start;
|
color: var(--status-color);
|
||||||
justify-content: center;
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.startStopButton {
|
||||||
|
padding: 1rem 1.8rem;
|
||||||
|
border-radius: 0.6rem;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stoppedButton {
|
||||||
|
background-color: #008d5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.runningButton {
|
||||||
|
background-color: #8d213e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stoppedButton:hover {
|
||||||
|
background-color: #008d5fc1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.runningButton:hover {
|
||||||
|
background-color: #8d213ec1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deleteButton {
|
||||||
|
background-color: #d9534f;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0.6rem;
|
||||||
|
padding: 0.6rem 1rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deleteButton:hover {
|
||||||
|
background-color: #c9302c;
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,7 @@ const DashboardPage = ({ user }) => {
|
|||||||
<CreateServer
|
<CreateServer
|
||||||
user={user}
|
user={user}
|
||||||
onCreateServer={handleCreateServerPage}
|
onCreateServer={handleCreateServerPage}
|
||||||
|
onCancel={handleCancelCreateServer}
|
||||||
noServers
|
noServers
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@ -141,6 +142,8 @@ const DashboardPage = ({ user }) => {
|
|||||||
version={server.version}
|
version={server.version}
|
||||||
name={server.name}
|
name={server.name}
|
||||||
framework={server.framework}
|
framework={server.framework}
|
||||||
|
maxPlayers={server.maxPlayers}
|
||||||
|
countPlayers={server.onlinePlayers}
|
||||||
onRunClick={() => handleRunServer(server.name)}
|
onRunClick={() => handleRunServer(server.name)}
|
||||||
onStopClick={() => handleStopServer(server.name)}
|
onStopClick={() => handleStopServer(server.name)}
|
||||||
onDeleteClick={() => handleDeleteServer(server.name)}
|
onDeleteClick={() => handleDeleteServer(server.name)}
|
||||||
|
Loading…
Reference in New Issue
Block a user