@@ -55,7 +55,7 @@ const CardsInSetPage = () => {
5555 }
5656
5757 try {
58- const { set, rarity , printing } = selectedOptions ;
58+ const { set, condition } = selectedOptions ;
5959
6060 const response = await fetch ( `/api/Yugioh/cards` , {
6161 method : "POST" ,
@@ -69,9 +69,9 @@ const CardsInSetPage = () => {
6969 productName : selectedCard . name ,
7070 setName : set . set_name ,
7171 number : set . set_code ,
72- printing : printing || set . set_edition ,
73- rarity : rarity || set . set_rarity ,
74- condition : `Near Mint ${ printing } ` ,
72+ printing : set . set_edition || "Unknown Edition" ,
73+ rarity : set . set_rarity ,
74+ condition : condition + " " + ( set . set_edition || "Unknown Edition" ) ,
7575 marketPrice : set . set_price || 0 ,
7676 quantity : 1 ,
7777 } ,
@@ -126,12 +126,13 @@ const CardsInSetPage = () => {
126126 onSubmit = { ( e ) => {
127127 e . preventDefault ( ) ;
128128 const formData = new FormData ( e . target ) ;
129- const selectedOptions = {
130- set : JSON . parse ( formData . get ( "set" ) ) ,
131- rarity : formData . get ( "rarity" ) ,
132- printing : formData . get ( "printing" ) ,
133- } ;
134- handleAddToCollection ( selectedOptions ) ;
129+ const selectedSet = JSON . parse ( formData . get ( "set" ) ) ;
130+ const selectedCondition = formData . get ( "condition" ) ;
131+
132+ handleAddToCollection ( {
133+ set : selectedSet ,
134+ condition : selectedCondition ,
135+ } ) ;
135136 } }
136137 >
137138 < label className = "block mb-2" >
@@ -147,31 +148,26 @@ const CardsInSetPage = () => {
147148 </ option >
148149 { selectedCard . card_sets ?. map ( ( set , index ) => (
149150 < option key = { index } value = { JSON . stringify ( set ) } >
150- { set . set_name } - { set . set_rarity } - { set . set_edition } - $
151- { set . set_price }
151+ { set . set_name } - { set . set_rarity } - { set . set_edition || "Unknown Edition" } - ${ set . set_price || "0.00" }
152152 </ option >
153153 ) ) }
154154 </ select >
155155 </ label >
156156
157- < label className = "block mb-2" >
158- Select Rarity:
159- < input
160- type = "text"
161- name = "rarity"
162- className = "w-full border rounded p-2"
163- placeholder = "Enter rarity"
164- />
165- </ label >
166-
167157 < label className = "block mb-4" >
168- Select Printing:
169- < input
170- type = "text"
171- name = "printing"
172- className = "w-full border rounded p-2"
173- placeholder = "Enter printing"
174- />
158+ Select Condition:
159+ < select
160+ name = "condition"
161+ className = "w-full border rounded p-2 text-black"
162+ required
163+ defaultValue = "Near Mint"
164+ >
165+ < option value = "Near Mint" > Near Mint</ option >
166+ < option value = "Lightly Played" > Lightly Played</ option >
167+ < option value = "Moderately Played" > Moderately Played</ option >
168+ < option value = "Heavily Played" > Heavily Played</ option >
169+ < option value = "Damaged" > Damaged</ option >
170+ </ select >
175171 </ label >
176172
177173 < div className = "flex justify-between" >
0 commit comments