diff --git a/src/components/serverCard/serverCard.module.scss b/src/components/serverCard/serverCard.module.scss index 16aaec3..34c4d52 100644 --- a/src/components/serverCard/serverCard.module.scss +++ b/src/components/serverCard/serverCard.module.scss @@ -9,6 +9,7 @@ align-items: center; background-color: var(--card-bg-color); color: var(--text-color); + margin-bottom: 1.5rem; } .status { diff --git a/src/main.css b/src/main.css index 70f7313..d65f2ab 100644 --- a/src/main.css +++ b/src/main.css @@ -11,8 +11,8 @@ html { --profile-pic-size: 3rem; --logout-button-bg: #ff4b4b; --logout-button-bg-hover: #ff1a1a; - --card-width: 100%; - --card-padding: 4rem; + --card-width: 80%; + --card-padding: 3.5rem; --card-border-color: #343947; --card-bg-color: #1D1836; --main-bg-color: #050816; diff --git a/src/pages/DashboardPage/DashboardPage.jsx b/src/pages/DashboardPage/DashboardPage.jsx index 7c6a6da..bde5d81 100644 --- a/src/pages/DashboardPage/DashboardPage.jsx +++ b/src/pages/DashboardPage/DashboardPage.jsx @@ -6,11 +6,13 @@ import NoServer from '../NoServer/NoServer'; import { getUserSubdomain } from "../../service/firebase"; import serviiApi from "../../service/api.tsx"; import Loading from '../Loading/loading'; +import CreateServer from '../../components/CreateServer/CreateServer'; const DashboardPage = ({ user }) => { const [servers, setServers] = useState([]); const [subdomain, setSubdomain] = useState(""); const [loading, setLoading] = useState(true); + const [showCreateServer, setShowCreateServer] = useState(false); const loadServers = async () => { try { @@ -38,11 +40,16 @@ const DashboardPage = ({ user }) => { if (!serverName || !serverVersion) return; await serviiApi.serverCreate(serverName, serverVersion, "paper"); await loadServers(); + setShowCreateServer(false); } catch (error) { console.error('Error creating server:', error); } }; + const handleCreateServerPage = () => { + setShowCreateServer(true); + }; + const handleRunServer = async (serverName) => { try { await serviiApi.serverRun(serverName); @@ -70,20 +77,33 @@ const DashboardPage = ({ user }) => { } }; + if (showCreateServer) { + return ; + } + return (
{loading ? ( - ) : -
-
Adresse de connexion à vos serveurs : {subdomain}.servii.fr
+ ) : ( +
{servers.length === 0 ? ( - - ) : ( - servers.map((server, index) => ( + + ) : ( +
+
+ Adresse de connexion à vos serveurs : {subdomain}.servii.fr +
+ + {servers.map((server) => ( { onDeleteClick={() => handleDeleteServer(server.name)} subdomain={subdomain} /> - ) - ) - )} -
- } + ))} +
+ )} +
+ )}
); }; diff --git a/src/pages/DashboardPage/DashboardPage.module.scss b/src/pages/DashboardPage/DashboardPage.module.scss index 0196573..269d465 100644 --- a/src/pages/DashboardPage/DashboardPage.module.scss +++ b/src/pages/DashboardPage/DashboardPage.module.scss @@ -36,4 +36,20 @@ html, body { .iptitle span { color: violet; +} + +.btncreate{ + display: flex; + justify-content: center; + align-items: center; + background-color: #1D1836; + width: 40rem; + height: 5rem; + color: white; + border: solid 0.1rem #090325; + cursor: pointer; + font-size: 2rem; + font-weight: 900; + border-radius: 1rem; + margin-bottom: 3rem; } \ No newline at end of file