From 31795357af2f216cc3158b6104c257f2948c4e2d Mon Sep 17 00:00:00 2001 From: AntoninoP Date: Sat, 24 Aug 2024 13:26:47 +0200 Subject: [PATCH] newcreatepage --- src/components/CreateServer/CreateServer.jsx | 105 +++++------------- .../CreateServer/CreateServer.module.scss | 39 +++++++ 2 files changed, 64 insertions(+), 80 deletions(-) diff --git a/src/components/CreateServer/CreateServer.jsx b/src/components/CreateServer/CreateServer.jsx index 0b1eda1..85d9512 100644 --- a/src/components/CreateServer/CreateServer.jsx +++ b/src/components/CreateServer/CreateServer.jsx @@ -3,26 +3,18 @@ import styles from './CreateServer.module.scss'; import { getUserSubdomain } from "../../service/firebase"; import serviiApi from "../../service/api.tsx"; import PropTypes from "prop-types"; - -import vanilla from '../../assets/frameworks/vanilla.png'; -import bukkit from '../../assets/frameworks/bukkit.png'; -import spigot from '../../assets/frameworks/spigot.png'; -import paper from '../../assets/frameworks/paper.png'; +import { GoTag, GoCheck } from "react-icons/go"; const versions = { - vanilla:[ "1.21.1", "1.21", "1.20.6", "1.20.5", "1.20.4", "1.20.2", "1.20.1", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.18.2", "1.18.1", "1.17.1", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.15.2", "1.15.1", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.13.2", "1.13.1", "1.12.2", "1.12.1", "1.11.2", "1.10.2", "1.9.4"], - bukkit: [ "1.20.6", "1.20.4", "1.20.2", "1.20.1", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.18.2", "1.17.5", "1.17.4", "1.17.3", "1.17.2", "1.17.0", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.15.5", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.13.5", "1.13.4", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.12.5", "1.12.4", "1.12.3", "1.12.2", "1.12.1", "1.12.0", "1.11.5", "1.11.4", "1.11.3", "1.11.2", "1.11.1", "1.11.0", "1.10.5", "1.10.4", "1.10.3", "1.10.2", "1.10.1", "1.10.0", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.1", "1.9.0", "1.8.5", "1.8.4", "1.8.3", "1.8.2", "1.8.1", "1.8.0", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.0", "1.6.5", "1.6.4", "1.6.3", "1.6.2", "1.6.1", "1.6.0", "1.5.5", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.4.5", "1.4.4", "1.4.3", "1.4.2", "1.4.1", "1.4.0", "1.3.5", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.0.5", "1.0.4", "1.0.3", "1.0.2", "1.0.1", "1.0.0"], - spigot: [ "1.21", "1.20.6", "1.20.4", "1.20.2", "1.20.1", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.18.2", "1.18.1", "1.17.1", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.15.2", "1.15.1", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.13.2", "1.13.1", "1.12.2", "1.12.1", "1.11.2", "1.11.1", "1.10.2", "1.9.4", "1.9.2", "1.8.8", "1.8.7", "1.8.6", "1.8.5", "1.8.4", "1.8.3", "1.7.10", "1.7.9", "1.7.8", "1.7.5", "1.7.2", "1.6.4", "1.6.2", "1.5.2", "1.5.1", "1.4.7", "1.4.6"], - paper: [ "1.21.1", "1.21", "1.20.6", "1.20.5", "1.20.4", "1.20.2", "1.20.1", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.18.2", "1.18.1", "1.17.1", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.15.2", "1.15.1", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.13.2", "1.13.1", "1.12.2", "1.12.1", "1.11.2", "1.10.2", "1.9.4"] + paper: [ "1.21.1", "1.21", "1.20.6", "1.20.5", "1.20.4", "1.20.2", "1.20.1", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.18.2", "1.18.1", "1.17.1", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.15.2", "1.15.1", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.13.2", "1.13.1", "1.12.2", "1.12.1", "1.11.2", "1.10.2", "1.9.4"] }; const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noServers }) => { const [subdomain, setSubdomain] = useState(null); const [subdomainInput, setSubdomainInput] = useState(''); const [serverName, setServerName] = useState(''); - const [serverVersion, setServerVersion] = useState(); - const [selectedFramework, setSelectedFramework] = useState("paper"); - + const [serverVersion, setServerVersion] = useState('1.21.1'); + const loadSubdomain = async () => { try { if (user && user.uid) { @@ -53,13 +45,18 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer const handleCreateServer = async () => { try { - const frameworkToSend = selectedFramework === 'vanilla' ? 'paper' : selectedFramework; + const frameworkToSend = 'paper'; await onCreateServer(serverName, serverVersion, frameworkToSend); } catch (error) { console.error('Error creating server:', error); } -}; + }; + const VersionChoice = (version) => { + return () => { + setServerVersion(version); + }; + }; const validateInput = (input) => { return input.replace(/[^a-zA-Z]/g, ''); @@ -81,7 +78,7 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer
Ecrivez votre sous domaine
- Le sous-domaine est le nom sous lequel vos amis et vous rejoignez le serveur, un peu comme une adresse. Choisissez-le bien, car il n'est pas facilement modifiable ! + Le sous-domaine est le nom sous lequel vos amis et vous rejoignez le serveur, un peu comme une adresse. Choisissez-le bien, car il nest pas facilement modifiable !
setServerName(validateInput(e.target.value))} /> -
Sélection du framework
-
-
- Vanilla Logo { - setSelectedFramework('vanilla'); - setServerVersion(''); - }} - /> -
- -
- Bukkit Logo { - setSelectedFramework('bukkit'); - setServerVersion(''); - }} - /> -
+
Sélection de la version
-
- Spigot Logo { - setSelectedFramework('spigot'); - setServerVersion(''); - }} - /> +
+ {versions['paper'].map((version, index) => ( +
+ {serverVersion === version ? : } + {version} +
+ ))}
- -
- Paper Logo { - setSelectedFramework('paper'); - setServerVersion(''); - }} - /> - {} -
-
-
Sélection de la version
- - -