[~] Dynamic framework icon handling.

This commit is contained in:
Charles Le Maux 2024-07-04 13:28:33 +01:00
parent 3aeb6567df
commit 2d2144fc05
3 changed files with 16 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,18 +1,25 @@
import React from 'react';
import styles from './serverCard.module.scss';
import paper_mc from '../../assets/frameworks/paper_mc.png'
import paper from '../../assets/frameworks/paper_mc.png'
import spigot from '../../assets/frameworks/spigot.png'
import bukkit from '../../assets/frameworks/bukkit.png'
import vanilla from '../../assets/frameworks/vanilla.png'
const ServerCard = ({status, version, link, name, onRunClick, onStopClick, onDeleteClick }) => {
const ServerCard = ({status, version, link, name, framework, onRunClick, onStopClick, onDeleteClick }) => {
const getStatusColor = () => {
switch (status) {
case true:
return 'green';
const getFrameworkSource = () => {
switch (framework) {
case "bukkit":
return bukkit;
case "spigot":
return spigot;
case "paper":
return paper;
default:
return 'gray';
return vanilla;
}
};
}
const handleRun = async () => {
try {
@ -43,7 +50,7 @@ const ServerCard = ({status, version, link, name, onRunClick, onStopClick, onDel
<div className={styles.leftCard}>
<div className={styles.status}>
<div className={styles.name}>{name}</div>
<img src={paper_mc} alt={`${name} Icon`} className={styles.statusInnerDot}/>
<img src={getFrameworkSource()} alt={`${name} Icon`} className={styles.statusInnerDot}/>
<div className="tooltip"></div>
</div>
<div className={styles.buttonContainer}>

View File

@ -30,7 +30,6 @@
.statusInnerDot {
width: 27px;
height: 27px;
border-radius: 50%;
}
.name {