fix images insh

This commit is contained in:
AntoninoP 2024-08-12 19:18:59 +02:00
parent d92d85a8bc
commit 923191e189

View File

@ -4,12 +4,10 @@ import { getUserSubdomain } from "../../service/firebase";
import serviiApi from "../../service/api.tsx"; import serviiApi from "../../service/api.tsx";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
const frameworks = [ import vanilla from '../../assets/frameworks/vanilla.png';
{ name: 'vanilla', logo: new URL('../../assets/frameworks/vanilla.png', import.meta.url).href }, import bukkit from '../../assets/frameworks/bukkit.png';
{ name: 'bukkit', logo: new URL('../../assets/frameworks/bukkit.png', import.meta.url).href }, import spigot from '../../assets/frameworks/spigot.png';
{ name: 'spigot', logo: new URL('../../assets/frameworks/spigot.png', import.meta.url).href }, import paper from '../../assets/frameworks/paper.png';
{ name: 'paper', logo: new URL('../../assets/frameworks/paper.png', import.meta.url).href },
];
const versions = { const versions = {
vanilla: ['1.21', '1.20', '1.19'], vanilla: ['1.21', '1.20', '1.19'],
@ -34,8 +32,6 @@ const versions = {
], ],
}; };
const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noServers }) => { const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noServers }) => {
const [subdomain, setSubdomain] = useState(null); const [subdomain, setSubdomain] = useState(null);
const [subdomainInput, setSubdomainInput] = useState(''); const [subdomainInput, setSubdomainInput] = useState('');
@ -73,7 +69,7 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer
const handleCreateServer = async () => { const handleCreateServer = async () => {
try { try {
await onCreateServer(serverName, serverVersion , selectedFramework); await onCreateServer(serverName, serverVersion, selectedFramework);
} catch (error) { } catch (error) {
console.error('Error creating server:', error); console.error('Error creating server:', error);
} }
@ -83,12 +79,25 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer
return input.replace(/[^a-zA-Z]/g, ''); return input.replace(/[^a-zA-Z]/g, '');
}; };
const getFrameworkSource = () => {
switch (selectedFramework) {
case 'bukkit':
return bukkit;
case 'spigot':
return spigot;
case 'paper':
return paper;
default:
return vanilla;
}
};
return ( return (
<div className={styles.container}> <div className={styles.container}>
{noServers ? ( {noServers ? (
<div className={styles.mainCardNoserveur}> <div className={styles.mainCardNoserveur}>
<div className={styles.nsSubTitle}>Bonjour</div> <div className={styles.nsSubTitle}>Bonjour</div>
<div className={styles.nsTitle}>Aucun serveur </div> <div className={styles.nsTitle}>Aucun serveur</div>
<button className={styles.btnnoServCreate} onClick={onCreateServer}>Créer un nouveau serveur</button> <button className={styles.btnnoServCreate} onClick={onCreateServer}>Créer un nouveau serveur</button>
</div> </div>
) : ( ) : (
@ -128,20 +137,42 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer
<div className={styles.subtitle}>Sélection du framework</div> <div className={styles.subtitle}>Sélection du framework</div>
<div className={styles.carreContainer}> <div className={styles.carreContainer}>
<img
{frameworks.map((framework, index) => ( className={`${styles.carre} ${selectedFramework === 'vanilla' ? styles.selected : ''}`}
console.log(framework.logo), src={vanilla}
<img alt="Vanilla Logo"
key={index} onClick={() => {
className={`${styles.carre} ${selectedFramework === framework.name ? styles.selected : ''}`} setSelectedFramework('vanilla');
src={framework.logo.toLowerCase()} setServerVersion('');
alt={`${framework.name} Logo`} }}
onClick={() => { />
setSelectedFramework(framework.name); <img
setServerVersion(''); className={`${styles.carre} ${selectedFramework === 'bukkit' ? styles.selected : ''}`}
}} src={bukkit}
/> alt="Bukkit Logo"
))} onClick={() => {
setSelectedFramework('bukkit');
setServerVersion('');
}}
/>
<img
className={`${styles.carre} ${selectedFramework === 'spigot' ? styles.selected : ''}`}
src={spigot}
alt="Spigot Logo"
onClick={() => {
setSelectedFramework('spigot');
setServerVersion('');
}}
/>
<img
className={`${styles.carre} ${selectedFramework === 'paper' ? styles.selected : ''}`}
src={paper}
alt="Paper Logo"
onClick={() => {
setSelectedFramework('paper');
setServerVersion('');
}}
/>
</div> </div>
<div className={styles.subtitle}>Sélection de la version</div> <div className={styles.subtitle}>Sélection de la version</div>