diff --git a/components/DeckDetailCardList.js b/components/DeckDetailCardList.js
new file mode 100644
index 0000000..217e7fa
--- /dev/null
+++ b/components/DeckDetailCardList.js
@@ -0,0 +1,91 @@
+/* eslint-disable @next/next/no-img-element -- External card image URLs; next/image migration is out of scope. */
+import { ManaCost } from './ManaSymbols';
+
+export default function DeckDetailCardList({ cards, groupedCards }) {
+ const isEmpty = !cards || cards.length === 0;
+
+ return (
+
+
+ {isEmpty ? (
+
+
🃏
+
+ Empty Deck
+
+
+ This deck doesn't have any cards yet
+
+
+ ) : (
+
+ {Object.entries(groupedCards)
+ .sort(([a], [b]) => a.localeCompare(b))
+ .map(([group, groupCards]) => (
+
+
+ {group} ({groupCards.reduce((sum, card) => sum + card.quantity, 0)})
+
+
+ {groupCards
+ .sort((a, b) => a.name.localeCompare(b.name))
+ .map((card) => (
+
+ {card.image_url && (
+

+ )}
+
+
+
+ {card.name}
+
+
+ {card.quantity}x
+
+
+
+ {card.set_name}
+
+
+ {card.mana_cost && (
+
+ )}
+ {card.rarity && (
+ {card.rarity}
+ )}
+
+
+
+ ))}
+
+
+ ))}
+
+ )}
+
+
+ );
+}
diff --git a/pages/deck/[id].js b/pages/deck/[id].js
index 54d3808..4e546ee 100644
--- a/pages/deck/[id].js
+++ b/pages/deck/[id].js
@@ -1,10 +1,9 @@
-/* eslint-disable @next/next/no-img-element -- External or generated image URLs; next/image migration is out of scope. */
import { useState, useEffect } from 'react';
import { useRouter } from 'next/router';
import Link from 'next/link';
import Layout from '../../components/Layout';
+import DeckDetailCardList from '../../components/DeckDetailCardList';
import DeckDetailStatsSidebar from '../../components/DeckDetailStatsSidebar';
-import { ManaCost } from '../../components/ManaSymbols';
import { Button } from '../../components/ui';
import { computeDeckStats } from '../../lib/deck-builder-stats.js';
import { groupDeckCards } from '../../lib/deck-detail-grouping.js';
@@ -164,95 +163,7 @@ export default function DeckDetail() {
onGroupByChange={setGroupBy}
/>
- {/* Card List */}
-
-
- {deck.cards && deck.cards.length === 0 ? (
-
-
🃏
-
- Empty Deck
-
-
- This deck doesn't have any cards yet
-
-
- ) : (
-
- {Object.entries(groupedCards)
- .sort(([a], [b]) => a.localeCompare(b))
- .map(([group, cards]) => (
-
-
- {group} ({cards.reduce((sum, card) => sum + card.quantity, 0)})
-
-
- {cards
- .sort((a, b) => a.name.localeCompare(b.name))
- .map((card) => (
-
- {card.image_url && (
-

- )}
-
-
-
- {card.name}
-
-
- {card.quantity}x
-
-
-
- {card.set_name}
-
-
- {card.mana_cost && (
-
- )}
- {card.rarity && (
- {card.rarity}
- )}
-
-
-
- ))}
-
-
- ))}
-
- )}
-
-
+