diff --git a/SerpentRace_Frontend/src/App.jsx b/SerpentRace_Frontend/src/App.jsx
index 0314253e..7ed485e4 100644
--- a/SerpentRace_Frontend/src/App.jsx
+++ b/SerpentRace_Frontend/src/App.jsx
@@ -16,6 +16,9 @@ import ScrollToTop from "./components/ScrollToTop"
import GameScreen from "./pages/Game/GameScreen"
import Reports from "./pages/Report/Reports"
import Lobby from "./pages/Lobby/Lobby"
+import { ToastConfig } from "./components/Toastify/toastifyServices" // ✅ fontos: named import, nem default!
+
+
function App() {
const [isMobile, setIsMobile] = useState(false)
@@ -44,28 +47,31 @@ function App() {
// }
return (
-
-
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
+ <>
+
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
- {/* Add more routes as needed */}
-
-
+ {/* ✅ Toastify Container */}
+
+ >
)
}
diff --git a/SerpentRace_Frontend/src/components/DeckCreator/CardEditor.jsx b/SerpentRace_Frontend/src/components/DeckCreator/CardEditor.jsx
index 7597e813..9d853d24 100644
--- a/SerpentRace_Frontend/src/components/DeckCreator/CardEditor.jsx
+++ b/SerpentRace_Frontend/src/components/DeckCreator/CardEditor.jsx
@@ -7,6 +7,8 @@ import TaskCardEditor from "./TaskCardEditor.jsx"
import JokerCardEditor from "./JokerCardEditor.jsx"
import LuckCardEditor from "./LuckCardEditor.jsx"
import CardPreview from "./CardPreview.jsx"
+import { notifySuccess, notifyError,notifyWarning } from "../../components/Toastify/toastifyServices"
+
export default function CardEditor({ card, isCreating, cardType, onSave, onCancel }) {
const [cardData, setCardData] = useState(null)
@@ -65,33 +67,24 @@ export default function CardEditor({ card, isCreating, cardType, onSave, onCance
}
}, [card, isCreating, cardType])
- const handleSave = () => {
- if (!cardData) return
-
- // Validáció
- if (!validateCard(cardData)) return
-
- onSave(cardData)
- }
-
const validateCard = (data) => {
if (data.type === 'QUESTION') {
if (!data.question && !data.statement) {
- alert("❌ Kérdés vagy állítás megadása kötelező!")
+ notifyError("Kérdés vagy állítás megadása kötelező!")
return false
}
if (data.subType === 'quiz' && data.options.some(opt => !opt.trim())) {
- alert("❌ Minden válaszlehetőséget ki kell tölteni!")
+ notifyError("Minden válaszlehetőséget ki kell tölteni!")
return false
}
} else if (data.type === 'JOKER') {
if (!data.text || !data.text.trim()) {
- alert("❌ Joker kártya szövege nem lehet üres!")
+ notifyError("Joker kártya szövege nem lehet üres!")
return false
}
} else if (data.type === 'LUCK') {
if (!data.text || !data.text.trim()) {
- alert("❌ Szerencse kártya szövege nem lehet üres!")
+ notifyError("Szerencse kártya szövege nem lehet üres!")
return false
}
}
@@ -103,6 +96,19 @@ export default function CardEditor({ card, isCreating, cardType, onSave, onCance
setCardData(prev => prev ? { ...prev, ...updates } : null)
}
+ const handleSave = () => {
+ if (!cardData) return
+
+ if (!validateCard(cardData)) return
+
+ try {
+ onSave(cardData)
+ notifySuccess('Kártya sikeresen mentve!')
+ } catch (error) {
+ notifyError('Hiba történt a kártya mentése során: ' + (error?.message || String(error)))
+ }
+ }
+
// Ha nincs kiválasztott kártya vagy új kártya létrehozás
if (!cardData) {
return (
@@ -134,10 +140,17 @@ export default function CardEditor({ card, isCreating, cardType, onSave, onCance
+<<<<<<< HEAD
{isCreating ? 'Új' : 'Szerkesztés'} {' '}
{cardData.type === 'QUESTION' && 'Feladat kártya'}
{cardData.type === 'JOKER' && 'Joker kártya'}
{cardData.type === 'LUCK' && 'Szerencse kártya'}
+=======
+ {isCreating ? 'Új' : 'Szerkesztés'} {' '}
+ {cardData.type === 'QUESTION' && 'Feladat kártya'}
+ {cardData.type === 'JOKER' && 'Joker kártya'}
+ {cardData.type === 'LUCK' && 'Szerencse kártya'}
+>>>>>>> main
{cardData.type === 'QUESTION' && cardData.subType && (
@@ -157,8 +170,8 @@ export default function CardEditor({ card, isCreating, cardType, onSave, onCance
onClick={() => setShowPreview(!showPreview)}
className={`
flex items-center gap-2 px-4 py-2 rounded-xl font-medium transition-all duration-200
- ${showPreview
- ? 'bg-[color:var(--color-success)] text-[color:var(--color-text-inverse)]'
+ ${showPreview
+ ? 'bg-[color:var(--color-success)] text-[color:var(--color-text-inverse)]'
: 'bg-[color:var(--color-background)] text-[color:var(--color-text)] hover:bg-[color:var(--color-surface-selected)]'
}
`}
@@ -168,12 +181,15 @@ export default function CardEditor({ card, isCreating, cardType, onSave, onCance
+ onClick={() => {
+ notifyWarning('Kártya készítés megszakítva')
+ onCancel()
+ }}
+ className="flex items-center gap-2 px-4 py-2 rounded-xl bg-[color:var(--color-background)] hover:bg-[color:var(--color-surface-selected)] text-[color:var(--color-text)] transition-all duration-200"
+>
+
+ Mégse
+