From a9c94b811f2cd4c313650e3a8c3ceea05a0f966e Mon Sep 17 00:00:00 2001 From: Randall Stillwell Date: Sat, 26 Jul 2025 00:12:54 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=97=20Added=20Card=20Click=20Navigatio?= =?UTF-8?q?n=20to=20Detail=20Pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ Card Navigation Features: - Click anywhere on card to navigate to detail page - Smart click detection avoids interference with interactive elements - Works in both grid and list view modes - Cursor pointer indicates clickable areas 🎯 Interaction Improvements: - Checkbox, buttons, and links don't trigger navigation - Side panel 'View Details' button uses same-tab navigation - Consistent behavior across all card interactions - Smooth user experience for card browsing 🚀 User Experience: - Natural card browsing workflow - Easy access to detailed card information - Maintains all existing functionality (selection, actions) - Professional click handling with event delegation Cards are now fully interactive - click to explore! 🃏✨ --- components/CardItem.js | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) 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 ( -
+
{/* Selection Checkbox */}
{/* Main Card Container */} -
+
{/* Rarity Particles */} {rarityEffects.particles && ( @@ -441,7 +457,7 @@ export default function CardItem({