feat(cards): add Deck tab to card detail page - #63
Open
gjuillot wants to merge 3 commits into
Open
Conversation
Adds a login-gated "Deck" tab after Lore showing the user's own decks in a compact list, filterable by name and by a single active faction (defaulting to the viewed card's faction). Hovering a deck reveals an "Add to deck" button that posts to a new deck-add-card endpoint, which fetches the deck's current card list and PATCHes back the updated quantities (the decks API has no incremental add operation). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Merge the name search and faction filter onto one row to save vertical space. - Fetch every page of the user's decks instead of only the first 21. - Show the faction icon/name in the "no decks" empty state. - Freeze a deck's row permanently in the "Added" state once a card is added, instead of reverting it a few seconds later and re-offering "Add to deck" on hover. - Drop the now-unused "view all my decks" link (superseded by full pagination). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
I would have used a fixed button instead of a hover thing to have the feature be usable on mobile and more easy to understand how it worked. |
Hover-to-reveal made the action hard to discover, especially on the touch devices the previous hover fallback was compensating for. The button now stays visible; it only changes appearance once clicked (frozen "Added" state). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Author
You're right. Done |
Contributor
Author
|
Closed by accident |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pages/card.php), after Général/Règles/Cartes Altérées/Lore — visible only to logged-in users.deck-add-cardplugin API endpoint, since the decks API has no incremental "add one card" operation: it fetches the deck's current card list, bumps/adds the quantity, and PATCHes the full list back (mirrors the existing save flow already used bydeckbuilder.php).Details
kcIsLoggedIn()— entirely absent from the HTML when logged out, not just hidden by CSS.?ajax=my&faction=param onpages/decks.php.?ajax=my(hardcoded to 21 items/page server-side) so the list is never silently truncated for users with more than 21 decks.plugins/core-altered-cards/api/deck-add-card.php(registered inplugin.json), gated on login + CSRF token, following the sameapi/favorites-toggle.phpproxy convention.Files changed
plugins/core-altered-cards/pages/card.php— tab markup, i18n, JSplugins/core-altered-cards/api/deck-add-card.php— new endpointplugins/core-altered-cards/plugin.json— endpoint registrationplugins/core-altered-cards/assets/style.css— compact row + hover-reveal button stylesTest plan