fix commander on DeckCard component
This commit is contained in:
@@ -11,7 +11,7 @@ interface DeckCardProps {
|
||||
export default function DeckCard({ deck, onEdit }: DeckCardProps) {
|
||||
const validation = validateDeck(deck);
|
||||
const commander = deck.format === 'commander' ? deck.cards.find(card =>
|
||||
card.card.type_line?.toLowerCase().includes('legendary creature')
|
||||
card.is_commander
|
||||
)?.card : null;
|
||||
|
||||
return (
|
||||
|
||||
@@ -27,6 +27,11 @@ const DeckList = ({ onDeckEdit }: DeckListProps) => {
|
||||
.select('*')
|
||||
.eq('deck_id', deck.id);
|
||||
|
||||
if(deck.id === "410ed539-a8f4-4bc4-91f1-6c113b9b7e25"){
|
||||
console.log("deck", deck.name);
|
||||
console.log("cardEntities", cardEntities);
|
||||
}
|
||||
|
||||
if (cardsError) {
|
||||
console.error(`Error fetching cards for deck ${deck.id}:`, cardsError);
|
||||
return { ...deck, cards: [] };
|
||||
@@ -35,6 +40,8 @@ const DeckList = ({ onDeckEdit }: DeckListProps) => {
|
||||
const cardIds = cardEntities.map((entity) => entity.card_id);
|
||||
const uniqueCardIds = [...new Set(cardIds)];
|
||||
|
||||
console.log("uniqueCardIds", uniqueCardIds);
|
||||
|
||||
try {
|
||||
const scryfallCards = await getCardsByIds(uniqueCardIds);
|
||||
|
||||
@@ -48,6 +55,7 @@ const DeckList = ({ onDeckEdit }: DeckListProps) => {
|
||||
return {
|
||||
card,
|
||||
quantity: entity.quantity,
|
||||
is_commander: entity.is_commander,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user