diff --git a/public/js/quickmenu/carddeck.js b/public/js/quickmenu/carddeck.js index 6ddc71d..b1594e2 100644 --- a/public/js/quickmenu/carddeck.js +++ b/public/js/quickmenu/carddeck.js @@ -1,11 +1,11 @@ const CARDS_PER_PAGE = 18; -let currentGroupId = null; -let currentPage = 1; -let currentDeckId = null; -let deckCards = []; // [{card_id, level, amount}] -let userCardsCache = []; // aktuelle Seite: [{card_id, level, amount, name, image, attack, defense}] -let decks = []; // [{id, name}] +let currentGroupId = null; +let currentPage = 1; +let currentDeckId = null; +let deckCards = []; // [{card_id, level, amount}] +let userCardsCache = []; // aktuelle Seite: [{card_id, level, amount, name, image, attack, defense}] +let decks = []; // [{id, name}] /* ══════════════════════════════════════════════ INIT @@ -386,17 +386,16 @@ function renderShell() { } .kd-deck-card-footer-counts { display: flex; - justify-content: space-between; + justify-content: center; align-items: center; - padding: 2px 6px; + padding: 3px 6px; background: rgba(0,0,0,0.85); border-top: 1px solid #2a3a10; border-radius: 0 0 6px 6px; - height: 20px; + height: 22px; flex-shrink: 0; } - .kd-deck-count-owned { font-family: "Cinzel", serif; font-size: 10px; color: #c8a86a; font-weight: bold; } - .kd-deck-count-indeck { font-family: "Cinzel", serif; font-size: 10px; color: #88cc44; font-weight: bold; } + .kd-deck-count-indeck { font-family: "Cinzel", serif; font-size: 13px; color: #88cc44; font-weight: bold; } /* ── Empty / Loading States ──────────────── */ .kd-empty { @@ -460,18 +459,16 @@ function renderTabs(groups) { const container = document.getElementById("kd-tabs"); if (!container) return; - container.innerHTML = groups - .map((g, i) => { - const color = g.color || "#6b4b2a"; - return ` + container.innerHTML = groups.map((g, i) => { + const color = g.color || "#6b4b2a"; + return ` `; - }) - .join(""); + }).join(""); container.querySelectorAll(".kd-tab").forEach((btn) => { btn.addEventListener("click", async () => { @@ -496,7 +493,7 @@ function renderTabs(groups) { totalPages, total } ══════════════════════════════════════════════ */ async function loadUserCards() { - const grid = document.getElementById("kd-grid"); + const grid = document.getElementById("kd-grid"); const pagination = document.getElementById("kd-pagination"); if (!grid) return; @@ -504,9 +501,7 @@ async function loadUserCards() { pagination.innerHTML = ""; try { - const res = await fetch( - `/api/user-cards?group_id=${currentGroupId}&page=${currentPage}&limit=${CARDS_PER_PAGE}`, - ); + const res = await fetch(`/api/user-cards?group_id=${currentGroupId}&page=${currentPage}&limit=${CARDS_PER_PAGE}`); if (!res.ok) throw new Error("API Fehler"); const data = await res.json(); userCardsCache = data.cards || []; @@ -536,14 +531,8 @@ async function loadDecks() { function renderDeckSelect() { const sel = document.getElementById("kd-deck-select"); if (!sel) return; - sel.innerHTML = - `` + - decks - .map( - (d) => - ``, - ) - .join(""); + sel.innerHTML = `` + + decks.map(d => ``).join(""); } /* ══════════════════════════════════════════════ @@ -597,9 +586,7 @@ async function addCardToDeck(card) { // Level > 5: max. 1 Exemplar im Deck if (card.level > 5) { - const already = deckCards.find( - (c) => c.card_id === card.card_id && c.level === card.level, - ); + const already = deckCards.find(c => c.card_id === card.card_id && c.level === card.level); if (already) { showToast("Karten ab Level 6 dürfen nur 1x im Deck sein."); return; @@ -696,33 +683,29 @@ function renderCollectionGrid(grid, cards) { const totalInDeck = deckCards.reduce((s, c) => s + c.amount, 0); - grid.innerHTML = cards - .map((c) => { - const inDeck = getDeckCount(c.card_id, c.level); - const maxed = isMaxedOut(c, inDeck, totalInDeck); - return ` + grid.innerHTML = cards.map(c => { + const inDeck = getDeckCount(c.card_id, c.level); + const maxed = isMaxedOut(c, inDeck, totalInDeck); + return `