diff --git a/src/components/CreateServer/CreateServer.jsx b/src/components/CreateServer/CreateServer.jsx index b0c2c68..7cc7f3d 100644 --- a/src/components/CreateServer/CreateServer.jsx +++ b/src/components/CreateServer/CreateServer.jsx @@ -191,7 +191,7 @@ CreateServer.propTypes = { ]), onCreateServer: PropTypes.func.isRequired, onSubdomainUpdate: PropTypes.func.isRequired, - onCancel: PropTypes.func.isRequired, + onCancel: PropTypes.func, noServers: PropTypes.any }; diff --git a/src/components/serverCard/serverCard.jsx b/src/components/serverCard/serverCard.jsx index 7c5d1b6..65a1b07 100644 --- a/src/components/serverCard/serverCard.jsx +++ b/src/components/serverCard/serverCard.jsx @@ -5,10 +5,9 @@ import paper from '../../assets/frameworks/paper.png'; import spigot from '../../assets/frameworks/spigot.png'; import bukkit from '../../assets/frameworks/bukkit.png'; import vanilla from '../../assets/frameworks/vanilla.png'; -import delete_button from '../../assets/frameworks/delete.png'; 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 = () => { switch (framework) { @@ -52,25 +51,31 @@ const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, return ( -
-
-
{name}
+
+
{`${name} -
+
+
{name}
+
Version: {version}
+
-
- {status === false && ( - - )} - {status === true && ( - - )} +
+ {status === false ? " " : countPlayers + "/" + maxPlayers + " joueurs"}
-
Version: {version}
- +
+
+ {status === false ? ( + + ) : ( + + )} +
+ +
); + }; ServerCard.propTypes = { @@ -82,6 +87,7 @@ ServerCard.propTypes = { onRunClick: PropTypes.func.isRequired, onStopClick: PropTypes.func.isRequired, onDeleteClick: PropTypes.func.isRequired, + countPlayers: PropTypes.number, subdomain: PropTypes.string, }; diff --git a/src/components/serverCard/serverCard.module.scss b/src/components/serverCard/serverCard.module.scss index a35a962..1889809 100644 --- a/src/components/serverCard/serverCard.module.scss +++ b/src/components/serverCard/serverCard.module.scss @@ -1,88 +1,95 @@ .serverCard { - width: var(--card-width); - padding: var(--card-padding); + display: flex; + 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-radius: 0.8rem; - text-decoration: none; - display: flex; - flex-direction: row; - align-items: center; background-color: var(--card-bg-color); color: var(--text-color); margin-bottom: 1.5rem; cursor: pointer; + text-decoration: none; } +.header { + display: flex; + justify-content: space-between; + width: 100%; +} - -.status { +.serverInfo { display: flex; align-items: center; } .frameworkIcon { - width: 2rem; - height: 2rem; - pointer-events: none; + width: 2.5rem; + height: 2.5rem; + margin-right: 0.8rem; } -.stoppedButton{ - background-color: #008d5f; - 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; +.serverName { + font-size: 1.6rem; font-weight: bold; - padding-right: 0.5rem; } .version { - font-size: 1.5rem; - margin-left: auto; - margin-right: 2rem; + font-size: 1.2rem; + color: var(--text-secondary-color); + margin-top: 0.5rem; } -.leftCard { - display: flex; - flex-direction: column; - align-items: start; - justify-content: center; +.status { + font-size: 1.2rem; + font-weight: bold; + color: var(--status-color); +} + +.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; } diff --git a/src/pages/DashboardPage/DashboardPage.jsx b/src/pages/DashboardPage/DashboardPage.jsx index 7ad63f2..965bd52 100644 --- a/src/pages/DashboardPage/DashboardPage.jsx +++ b/src/pages/DashboardPage/DashboardPage.jsx @@ -118,6 +118,7 @@ const DashboardPage = ({ user }) => { ) : ( @@ -141,6 +142,8 @@ const DashboardPage = ({ user }) => { version={server.version} name={server.name} framework={server.framework} + maxPlayers={server.maxPlayers} + countPlayers={server.onlinePlayers} onRunClick={() => handleRunServer(server.name)} onStopClick={() => handleStopServer(server.name)} onDeleteClick={() => handleDeleteServer(server.name)}