Skip to content

Commit 738db68

Browse files
hh
1 parent c385f34 commit 738db68

9 files changed

Lines changed: 37 additions & 24 deletions

File tree

components/Navigation/Breadcrumb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const Breadcrumb = () => {
6262
} else if ( query.source === 'collection' ) {
6363
crumbs.push( {
6464
label: 'My Collection',
65-
href: '/yugioh/my-collection'
65+
href: '/yugioh/'
6666
} );
6767
}
6868

components/Navigation/SideNav.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Link from "next/link";
2-
import { useEffect, useState } from "react";
2+
import { useMemo, useState } from "react";
33
import { useRouter } from "next/router";
44

55
export default function SideNav() {
66
const [ isAuthenticated, setIsAuthenticated ] = useState( false );
77
const router = useRouter();
88

9-
useEffect( () => {
9+
useMemo( () => {
1010
const checkAuth = async () => {
1111
try {
1212
const res = await fetch( "/api/auth/validate", {
@@ -71,7 +71,7 @@ export default function SideNav() {
7171
</li>
7272

7373
<li className="navButton mb-2 rounded">
74-
<Link href="/yugioh/my-collection">
74+
<Link href="/yugioh/">
7575
<span className="rounded block w-full text-left p-2 text-white bg-clip-padding border border-zinc-600 font-semibold backdrop-opacity-90 backdrop-blur-md hover:bg-zinc-400 bg-gradient-to-tr to-neutral-400 from-purple-800 hover:text-white">
7676
My Collection
7777
</span>

components/Yugioh/Card.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const Card = ( { cardData } ) => {
2020
card: cardData.id,
2121
letter: letter,
2222
set_name: setName, // only set name passed
23+
source: setName
24+
2325
},
2426
} }
2527
>

components/Yugioh/CardFilter.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ const CardFilter = ( {
4040
"Moderately Played Unlimited", "Heavily Played Unlimited",
4141
"Damaged Unlimited"
4242
]
43+
},
44+
{
45+
id: 'printing',
46+
label: 'Printing',
47+
values: [
48+
"1st Edition",
49+
"Unlimited",
50+
"Limited"
51+
]
4352
}
4453
];
4554

components/Yugioh/GridView.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const GridView = ( { aggregatedData, onDeleteCard, onUpdateCard } ) => {
1212
const [ editValues, setEditValues ] = useState( {} );
1313
const [ notification, setNotification ] = useState( { show: false, message: '' } );
1414
const [ flippedCards, setFlippedCards ] = useState( {} );
15-
const [ sortField, setSortField ] = useState( 'setName' );
15+
const [ sortField, setSortField ] = useState( '' );
1616
const [ sortDirection, setSortDirection ] = useState( 'asc' );
1717

1818

@@ -113,6 +113,7 @@ const GridView = ( { aggregatedData, onDeleteCard, onUpdateCard } ) => {
113113
onChange={ ( e ) => setSortField( e.target.value ) }
114114
className="px-2 py-1 rounded bg-white text-black font-semibold text-start"
115115
>
116+
<option disabled></option>
116117
<option value="productName">Card Name</option>
117118
<option value="setName">Set Name</option>
118119
<option value="number">Card Number</option>
@@ -123,6 +124,7 @@ const GridView = ( { aggregatedData, onDeleteCard, onUpdateCard } ) => {
123124
</select>
124125

125126
<button
127+
type="button"
126128
onClick={ () => setSortDirection( prev => prev === 'asc' ? 'desc' : 'asc' ) }
127129
className="px-2 py-1 rounded bg-white text-black font-semibold text-center"
128130
>

components/Yugioh/YugiohCardDataTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ const YugiohCardDataTable = ( { matchedCardData, setMatchedCardData } ) => {
216216
}, [ selectedKeys, matchedCardData, setMatchedCardData, itemUniqueIds ] );
217217

218218
const handleGoToCollectionPage = useCallback( () => {
219-
router.push( '/yugioh/my-collection' );
219+
router.push( '/yugioh/' );
220220
}, [ router ] );
221221

222222
// Format helper for prices

pages/login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function LoginPage() {
2929
const data = await response.json();
3030

3131
if ( response.ok ) {
32-
router.push( "/yugioh/my-collection" );
32+
router.push( "/yugioh/" );
3333
} else {
3434
setError( data.error || "Login failed. Please try again." );
3535
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ const MyCollection = () => {
2525
const [ isSidebarOpen, setIsSidebarOpen ] = useState( false );
2626
const [ viewMode, setViewMode ] = useState( 'grid' );
2727
const [ isAuthenticated, setIsAuthenticated ] = useState( false );
28-
const [ token, setToken ] = useState( null );
2928
const [ isUpdatingPrices, setIsUpdatingPrices ] = useState( false );
3029
const [ searchTerm, setSearchTerm ] = useState( "" );
3130
const [ isLoading, setIsLoading ] = useState( false );
3231
const [ initialData, setInitialData ] = useState( [] );
3332
const [ aggregatedData, setAggregatedData ] = useState( [] );
34-
const [ filters, setFilters ] = useState( { rarity: [], condition: [] } );
35-
const [ sortConfig, setSortConfig ] = useState( { key: "number", direction: "ascending" } );
33+
const [ filters, setFilters ] = useState( { rarity: [], condition: [], printing: [] } );
34+
const [ sortConfig, setSortConfig ] = useState( { key: 'number', direction: "ascending" } );
3635
const [ isFilterMenuOpen, setIsFilterMenuOpen ] = useState( false );
3736
const [ currentPage, setCurrentPage ] = useState( 1 );
3837
const [ itemsPerPage ] = useState( 20 );
@@ -42,7 +41,7 @@ const MyCollection = () => {
4241

4342
// Effect to check authentication
4443
// Effect to check authentication
45-
useEffect( () => {
44+
useMemo( () => {
4645
const validateAuth = async () => {
4746
try {
4847
const response = await fetch( "/api/auth/validate", {
@@ -66,11 +65,12 @@ const MyCollection = () => {
6665

6766
const applyFilters = useCallback(
6867
data => {
69-
if ( !filters.rarity.length && !filters.condition.length ) return data;
68+
if ( !filters.rarity.length && !filters.condition.length && !filters.printing.length ) return data;
7069
return data.filter( card => {
7170
return (
7271
( !filters.rarity.length || filters.rarity.includes( card.rarity ) ) &&
73-
( !filters.condition.length || filters.condition.includes( card.condition ) )
72+
( !filters.condition.length || filters.condition.includes( card.condition ) ) &&
73+
( !filters.printing.length || filters.printing.includes( card.printing ) )
7474
);
7575
} );
7676
},
@@ -346,9 +346,9 @@ const MyCollection = () => {
346346
) }
347347
</div>
348348
{/* Collection Stats */ }
349-
<div className="w-3/4 sm:max-w-[55%] mx-auto p-4 mt-8">
350-
<div className="glass p-4 rounded-lg">
351-
<h3 className="text-sm font-semibold text-white/80 mb-3">Collection Value</h3>
349+
<div className="sm:w-1/3 p-4 mt-8">
350+
<div className="text-shadow font-semibold glass p-4 rounded-lg">
351+
<h3 className="text-lg text-white/80 mb-3">Collection Value</h3>
352352
<div className="space-y-2">
353353
<div className="flex justify-between">
354354
<span className="text-sm">Total Cards:</span>
@@ -390,7 +390,7 @@ const MyCollection = () => {
390390
setIsModalOpen={ setIsFilterMenuOpen }
391391
/>
392392
{/* View Toggle */ }
393-
<div className="glass flex border border-white/20 rounded-lg overflow-ellipsis w-fit">
393+
<div className="glass font-semibold text-shadow flex border border-white/20 rounded-lg overflow-ellipsis w-fit">
394394
<div className='float-left w-1/2'>
395395
<button
396396
onClick={ () => setViewMode( 'grid' ) }

pages/yugioh/sets/[letter]/[setName].js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import { SpeedInsights } from "@vercel/speed-insights/next";
1313

1414
const CardsInSetPage = () => {
1515
const [ cards, setCards ] = useState( [] );
16-
const [ selectedCard, setSelectedCard ] = useState( null );
16+
const [ selectedCard, setSelectedCard ] = useState( [] );
1717
const [ modalVisible, setModalVisible ] = useState( false );
1818
const [ bulkModalVisible, setBulkModalVisible ] = useState( false );
1919
const [ isAuthenticated, setIsAuthenticated ] = useState( false );
2020

21-
const [ searchTerm, setSearchTerm ] = useState( "" );
22-
const [ sortBy, setSortBy ] = useState( "name-asc" );
21+
const [ searchTerm, setSearchTerm ] = useState( null );
22+
const [ sortBy, setSortBy ] = useState( "asc" );
2323
const [ viewMode, setViewMode ] = useState( "grid" );
2424

2525
// ✅ lifted persistent selection
@@ -111,8 +111,8 @@ const CardsInSetPage = () => {
111111
( c.archetype && c.archetype.toLowerCase().includes( term ) )
112112
);
113113
}
114-
if ( sortBy === "name-asc" ) data.sort( ( a, b ) => a.name.localeCompare( b.name ) );
115-
if ( sortBy === "name-desc" ) data.sort( ( a, b ) => b.name.localeCompare( a.name ) );
114+
if ( sortBy === "asc" ) data.sort( ( a, b ) => a.name.localeCompare( b.name ) );
115+
if ( sortBy === "desc" ) data.sort( ( a, b ) => b.name.localeCompare( a.name ) );
116116
return data;
117117
}, [ cards, searchTerm, sortBy ] );
118118

@@ -222,8 +222,8 @@ const CardsInSetPage = () => {
222222
onChange={ ( e ) => setSortBy( e.target.value ) }
223223
className="px-2 py-1 rounded border"
224224
>
225-
<option value="name-asc">Name (A-Z)</option>
226-
<option value="name-desc">Name (Z-A)</option>
225+
<option value="asc">Name (A-Z)</option>
226+
<option value="desc">Name (Z-A)</option>
227227
</select>
228228
<button
229229
onClick={ () => setViewMode( ( v ) => ( v === "grid" ? "table" : "grid" ) ) }

0 commit comments

Comments
 (0)