Fix card sizing consistency across all TCGs
- Added wrapper div with max-width constraint to ensure consistent card sizes - Updated image rendering to use object-cover with proper positioning - Removed maxWidth from Card3D component since it's now handled by wrapper - Ensures all cards (MTG, Pokemon, Lorcana) have identical dimensions - Fixed responsive grid layout to maintain consistent card sizes
This commit is contained in:
parent
e046515a38
commit
73a0c652b2
5 changed files with 129 additions and 57 deletions
34
lorcana-import-results-2025-07-24T17-27-46-410Z.json
Normal file
34
lorcana-import-results-2025-07-24T17-27-46-410Z.json
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"total": 0,
|
||||||
|
"successful": 3,
|
||||||
|
"failed": 0,
|
||||||
|
"sets": [
|
||||||
|
{
|
||||||
|
"code": "tfc",
|
||||||
|
"name": "The First Chapter",
|
||||||
|
"lorcastCode": "1",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 0,
|
||||||
|
"skippedCount": 216,
|
||||||
|
"total": 216
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "rotf",
|
||||||
|
"name": "Rise of the Floodborn",
|
||||||
|
"lorcastCode": "2",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 0,
|
||||||
|
"skippedCount": 216,
|
||||||
|
"total": 216
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "ink",
|
||||||
|
"name": "Into the Inklands",
|
||||||
|
"lorcastCode": "3",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 0,
|
||||||
|
"skippedCount": 226,
|
||||||
|
"total": 226
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
25
lorcana-import-results-2025-07-24T17-32-10-187Z.json
Normal file
25
lorcana-import-results-2025-07-24T17-32-10-187Z.json
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"total": 658,
|
||||||
|
"successful": 3,
|
||||||
|
"failed": 0,
|
||||||
|
"sets": [
|
||||||
|
{
|
||||||
|
"code": "tfc",
|
||||||
|
"name": "The First Chapter",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 216
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "rotf",
|
||||||
|
"name": "Rise of the Floodborn",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 216
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "ink",
|
||||||
|
"name": "Into the Inklands",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 226
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
34
lorcana-import-results-2025-07-24T17-34-04-839Z.json
Normal file
34
lorcana-import-results-2025-07-24T17-34-04-839Z.json
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"total": 0,
|
||||||
|
"successful": 3,
|
||||||
|
"failed": 0,
|
||||||
|
"sets": [
|
||||||
|
{
|
||||||
|
"code": "tfc",
|
||||||
|
"name": "The First Chapter",
|
||||||
|
"lorcastCode": "1",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 0,
|
||||||
|
"skippedCount": 216,
|
||||||
|
"total": 216
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "rotf",
|
||||||
|
"name": "Rise of the Floodborn",
|
||||||
|
"lorcastCode": "2",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 0,
|
||||||
|
"skippedCount": 216,
|
||||||
|
"total": 216
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "ink",
|
||||||
|
"name": "Into the Inklands",
|
||||||
|
"lorcastCode": "3",
|
||||||
|
"success": true,
|
||||||
|
"importedCount": 0,
|
||||||
|
"skippedCount": 226,
|
||||||
|
"total": 226
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -593,6 +593,7 @@ export default function Cards() {
|
||||||
<div className={viewMode === 'grid' ? 'grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-8 gap-6 p-6' : 'space-y-4'}>
|
<div className={viewMode === 'grid' ? 'grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-8 gap-6 p-6' : 'space-y-4'}>
|
||||||
{cards.map(card => (
|
{cards.map(card => (
|
||||||
<div key={card.id} onClick={() => router.push(`/card/${card.id}`)} className="flex justify-center">
|
<div key={card.id} onClick={() => router.push(`/card/${card.id}`)} className="flex justify-center">
|
||||||
|
<div className="w-full max-w-[200px]">
|
||||||
<Card3D
|
<Card3D
|
||||||
card={card}
|
card={card}
|
||||||
viewMode={viewMode}
|
viewMode={viewMode}
|
||||||
|
|
@ -600,6 +601,7 @@ export default function Cards() {
|
||||||
getRarityColor={getRarityColor}
|
getRarityColor={getRarityColor}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -767,10 +769,8 @@ function Card3D({ card, viewMode, getRarityLabel, getRarityColor }) {
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
{/* Card Container with proper ratio and rarity glow */}
|
{/* Card Container with proper ratio and rarity glow */}
|
||||||
<div
|
<div
|
||||||
className="relative cursor-pointer transition-transform duration-300 hover:scale-105"
|
className="relative cursor-pointer transition-transform duration-300 hover:scale-105 w-full"
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
|
||||||
maxWidth: '200px',
|
|
||||||
aspectRatio: '5/7',
|
aspectRatio: '5/7',
|
||||||
boxShadow: getRarityGlow(card.rarity),
|
boxShadow: getRarityGlow(card.rarity),
|
||||||
borderRadius: '12px',
|
borderRadius: '12px',
|
||||||
|
|
@ -926,12 +926,17 @@ function Card3D({ card, viewMode, getRarityLabel, getRarityColor }) {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* Card Image */}
|
{/* Card Image */}
|
||||||
<div className="w-full h-full">
|
<div className="w-full h-full relative">
|
||||||
{card.image_url ? (
|
{card.image_url ? (
|
||||||
<img
|
<img
|
||||||
src={card.image_url}
|
src={card.image_url}
|
||||||
alt={card.name}
|
alt={card.name}
|
||||||
className="w-full h-full object-cover"
|
className="w-full h-full object-cover"
|
||||||
|
style={{
|
||||||
|
objectFit: 'cover',
|
||||||
|
objectPosition: 'center',
|
||||||
|
borderRadius: '10px'
|
||||||
|
}}
|
||||||
onError={(e) => {
|
onError={(e) => {
|
||||||
e.target.style.display = 'none';
|
e.target.style.display = 'none';
|
||||||
e.target.nextSibling.style.display = 'flex';
|
e.target.nextSibling.style.display = 'flex';
|
||||||
|
|
@ -941,7 +946,7 @@ function Card3D({ card, viewMode, getRarityLabel, getRarityColor }) {
|
||||||
|
|
||||||
{/* Card Back placeholder when no image */}
|
{/* Card Back placeholder when no image */}
|
||||||
<div
|
<div
|
||||||
className={`w-full h-full ${!card.image_url ? 'block' : 'hidden'}`}
|
className={`w-full h-full absolute inset-0 ${!card.image_url ? 'block' : 'hidden'}`}
|
||||||
style={{ borderRadius: '10px' }}
|
style={{ borderRadius: '10px' }}
|
||||||
>
|
>
|
||||||
<CardBack game={card.game} />
|
<CardBack game={card.game} />
|
||||||
|
|
|
||||||
|
|
@ -69,30 +69,7 @@ async function importLorcanaSet(setCode, setName, lorcastCode) {
|
||||||
let importedCount = 0;
|
let importedCount = 0;
|
||||||
let skippedCount = 0;
|
let skippedCount = 0;
|
||||||
|
|
||||||
for (const card of cards) {
|
// Import all cards via our API in a single batch
|
||||||
try {
|
|
||||||
// Check if card already exists in database
|
|
||||||
const checkResponse = await fetch('http://localhost:3000/api/cards/search', {
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
query: card.name,
|
|
||||||
game: 'Lorcana',
|
|
||||||
set: card.set.code
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
const checkData = await checkResponse.json();
|
|
||||||
const existingCard = checkData.cards?.find(c => c.scryfall_id === card.id);
|
|
||||||
|
|
||||||
if (existingCard) {
|
|
||||||
skippedCount++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Import card via our API
|
|
||||||
const importResponse = await fetch('http://localhost:3000/api/cards/import-lorcana', {
|
const importResponse = await fetch('http://localhost:3000/api/cards/import-lorcana', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -100,24 +77,21 @@ async function importLorcanaSet(setCode, setName, lorcastCode) {
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
setCode: setCode,
|
setCode: setCode,
|
||||||
cardData: card
|
setName: setName
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const importResult = await importResponse.json();
|
const importResult = await importResponse.json();
|
||||||
|
|
||||||
if (importResult.success) {
|
if (importResult.success) {
|
||||||
importedCount++;
|
importedCount = importResult.imported || 0;
|
||||||
|
skippedCount = importResult.skipped || 0;
|
||||||
|
console.log(`✅ Import completed for ${setName}: ${importedCount} imported, ${skippedCount} skipped`);
|
||||||
} else {
|
} else {
|
||||||
skippedCount++;
|
console.log(`❌ Failed to import ${setName}: ${importResult.error}`);
|
||||||
}
|
return { success: false, error: importResult.error };
|
||||||
} catch (error) {
|
|
||||||
console.error(`Error processing card ${card.name}:`, error.message);
|
|
||||||
skippedCount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`✅ Import completed for ${setName}: ${importedCount} imported, ${skippedCount} skipped`);
|
|
||||||
return { success: true, importedCount, skippedCount, total: cards.length };
|
return { success: true, importedCount, skippedCount, total: cards.length };
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue