diff --git a/components/CardItem.js b/components/CardItem.js index 51d33ba..1bfd0aa 100644 --- a/components/CardItem.js +++ b/components/CardItem.js @@ -1,4 +1,5 @@ import { useState } from 'react'; +import { useRouter } from 'next/router'; export default function CardItem({ card, @@ -11,6 +12,7 @@ export default function CardItem({ isFavorited = false }) { const [imageError, setImageError] = useState(false); + const router = useRouter(); const handleSelectChange = (e) => { e.stopPropagation(); @@ -21,6 +23,14 @@ export default function CardItem({ setImageError(true); }; + const handleCardClick = (e) => { + // Don't navigate if clicking on interactive elements + if (e.target.closest('input, button, a')) { + return; + } + router.push(`/card/${card.id}`); + }; + // Get rarity-based styling const getRarityEffects = (rarity) => { const rarityLower = rarity?.toLowerCase() || ''; @@ -67,11 +77,14 @@ export default function CardItem({ if (viewMode === 'list') { return ( -