// src/components/DeckCreator/CardsList.jsx // Bal oldali kártyák listája és új kártya létrehozás import React, { useState } from "react" import { FaPlus, FaEdit, FaTrash, FaQuestionCircle, FaCheck, FaTimes, FaDice, FaTheaterMasks } from "react-icons/fa" import { notifySuccess, notifyError } from "../../components/Toastify/toastifyServices" const cardTypeIcons = { task: { icon: FaQuestionCircle, color: "var(--color-question)" }, joker: { icon: FaTheaterMasks, color: "var(--color-fun)" }, luck: { icon: FaDice, color: "var(--color-luck)" } } const cardSubTypeLabels = { quiz: "Quiz", truefalse: "Igaz/Hamis", matching: "Párosítás", text: "Szöveges válasz" } export default function CardsList({ cards, selectedCard, onSelectCard, onCreateCard, onDeleteCard, isCreatingCard, newCardType }) { const [confirmingDelete, setConfirmingDelete] = useState(null) const getCardPreview = (card) => { if (card.type === "task") { return card.question || card.statement || "Új feladat kártya" } if (card.type === "joker") { return card.text || "Új joker kártya" } if (card.type === "luck") { return card.text || "Új szerencse kártya" } return "Ismeretlen kártya" } const getCardTypeLabel = (card) => { if (card.type === "task") { if (card.subType) { return cardSubTypeLabels[card.subType] || "Feladat" } return "Feladat" } if (card.type === "joker") { return "Joker" } if (card.type === "luck") { return "Szerencse" } return "Ismeretlen" } const handleConfirmDelete = () => { if (confirmingDelete) { onDeleteCard(confirmingDelete) notifySuccess("Kártya sikeresen törölve a pakliból!") setConfirmingDelete(null) } } const handleCancelDelete = () => { setConfirmingDelete(null) } return (
{/* Header */}

🃏 Kártyák

{/* New Card Dropdown */}
{/* Dropdown Menu */}
{/* Cards List */}
{/* Creating Card Indicator */} {isCreatingCard && (
{newCardType && (
{React.createElement(cardTypeIcons[newCardType]?.icon || FaQuestionCircle, { className: "text-[color:var(--color-success)] text-sm" })}
)}
Új {newCardType === "task" ? "feladat" : newCardType === "joker" ? "joker" : "szerencse"} kártya
Szerkesztés folyamatban...
)} {/* Existing Cards */} {cards.map((card, index) => { const cardIcon = cardTypeIcons[card.type] || cardTypeIcons.task const isSelected = selectedCard?.id === card.id return (
onSelectCard(card)} className={` p-4 rounded-xl border cursor-pointer transition-all duration-200 hover:scale-105 group ${ isSelected ? "bg-[color:var(--color-success)]/10 border-[color:var(--color-success)] shadow-lg" : "bg-[color:var(--color-background)]/50 border-[color:var(--color-surface-selected)] hover:bg-[color:var(--color-background)]/80" } `} > {/* Card Header */}
{React.createElement(cardIcon.icon, { style: { color: cardIcon.color }, className: "text-lg" })}
#{index + 1} - {getCardTypeLabel(card)}
{card.timeLimit && (
⏱️ {card.timeLimit} másodperc
)}
{/* Action Buttons */}
{/* Card Content Preview */}
{getCardPreview(card)}
) })} {/* Empty State */} {cards.length === 0 && !isCreatingCard && (
🃏
Még nincsenek kártyák.
Hozz létre az első kártyát!
)}
{/* Confirm Delete Popup */} {confirmingDelete && (

Biztosan törölni szeretnéd?

Ez a művelet nem visszavonható.

)} {/* Footer Stats */}
📊 Összesen: {cards.length} kártya
{cards.length > 0 && (
📋 {cards.filter((c) => c.type === "task").length} 🃏 {cards.filter((c) => c.type === "joker").length} 🎲 {cards.filter((c) => c.type === "luck").length}
)}
) }