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 PropTypes from "prop-types";
const frameworks = [
{ name: 'vanilla', logo: new URL('../../assets/frameworks/vanilla.png', import.meta.url).href },
{ name: 'bukkit', logo: new URL('../../assets/frameworks/bukkit.png', import.meta.url).href },
{ name: 'spigot', logo: new URL('../../assets/frameworks/spigot.png', import.meta.url).href },
{ name: 'paper', logo: new URL('../../assets/frameworks/paper.png', import.meta.url).href },
];
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';
const versions = {
vanilla: ['1.21', '1.20', '1.19'],
@ -34,8 +32,6 @@ const versions = {
],
};
const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noServers }) => {
const [subdomain, setSubdomain] = useState(null);
const [subdomainInput, setSubdomainInput] = useState('');
@ -73,7 +69,7 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer
const handleCreateServer = async () => {
try {
await onCreateServer(serverName, serverVersion , selectedFramework);
await onCreateServer(serverName, serverVersion, selectedFramework);
} catch (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, '');
};
const getFrameworkSource = () => {
switch (selectedFramework) {
case 'bukkit':
return bukkit;
case 'spigot':
return spigot;
case 'paper':
return paper;
default:
return vanilla;
}
};
return (
<div className={styles.container}>
{noServers ? (
<div className={styles.mainCardNoserveur}>
<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>
</div>
) : (
@ -128,20 +137,42 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer
<div className={styles.subtitle}>Sélection du framework</div>
<div className={styles.carreContainer}>
{frameworks.map((framework, index) => (
console.log(framework.logo),
<img
key={index}
className={`${styles.carre} ${selectedFramework === framework.name ? styles.selected : ''}`}
src={framework.logo.toLowerCase()}
alt={`${framework.name} Logo`}
onClick={() => {
setSelectedFramework(framework.name);
setServerVersion('');
}}
/>
))}
<img
className={`${styles.carre} ${selectedFramework === 'vanilla' ? styles.selected : ''}`}
src={vanilla}
alt="Vanilla Logo"
onClick={() => {
setSelectedFramework('vanilla');
setServerVersion('');
}}
/>
<img
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 className={styles.subtitle}>Sélection de la version</div>