[~] 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 React from 'react';
import styles from './serverCard.module.scss'; 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 = () => { const getFrameworkSource = () => {
switch (status) { switch (framework) {
case true: case "bukkit":
return 'green'; return bukkit;
case "spigot":
return spigot;
case "paper":
return paper;
default: default:
return 'gray'; return vanilla;
} }
}; }
const handleRun = async () => { const handleRun = async () => {
try { try {
@ -43,7 +50,7 @@ const ServerCard = ({status, version, link, name, onRunClick, onStopClick, onDel
<div className={styles.leftCard}> <div className={styles.leftCard}>
<div className={styles.status}> <div className={styles.status}>
<div className={styles.name}>{name}</div> <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 className="tooltip"></div>
</div> </div>
<div className={styles.buttonContainer}> <div className={styles.buttonContainer}>

View File

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