import { useEffect, useState } from 'react'; import '../style/AppCard.css'; import { getIconUrl } from '../services/api'; import { FaEdit, FaTrash } from 'react-icons/fa'; function AppCard({ app, section, onEdit, onDelete }) { const [iconUrl, setIconUrl] = useState(null); useEffect(() => { if (app.icon) { getIconUrl(app.icon) .then((url) => setIconUrl(url)) .catch((err) => console.error(`Failed to load icon for ${app.name}:`, err)); } }, [app.icon, app.name]); return (
{ e.preventDefault(); if (typeof onDelete === 'function') { onDelete({ ...app, section }); } }} /> { e.preventDefault(); if (typeof onEdit === 'function') { onEdit({ ...app, section }); } }} />
{iconUrl ? {app.name} : ⚠️}

{app.name}

{app.description}

); } export default AppCard;