@@ -37,6 +37,8 @@ export default function Rewards({ id, hackathons }) {
3737 const [ alertMsg , setAlertMsg ] = useState ( '' )
3838 const { email : user } = useAuth ( ) . user
3939
40+ const REWARD_TYPES = [ { label : 'Reward' } , { label : 'Raffle' } ]
41+
4042 const fetchRewards = async ( ) => {
4143 const rewardsFetched = await getRewards ( id )
4244 if ( Object . keys ( rewardsFetched ) . length > 0 ) {
@@ -116,6 +118,7 @@ export default function Rewards({ id, hackathons }) {
116118 return (
117119 < TableRow >
118120 < TableData > { props . reward } </ TableData >
121+ < TableData > { props . type } </ TableData >
119122 < TableData > { props . blurb } </ TableData >
120123 < TableData > { props . prizesAvailable } </ TableData >
121124 < TableData > { props . requiredPoints } </ TableData >
@@ -143,11 +146,12 @@ export default function Rewards({ id, hackathons }) {
143146 < CardButtonContainer >
144147 < Button
145148 type = { NEW }
146- onClick = { ( ) =>
149+ onClick = { ( ) => {
147150 setNewReward ( {
148151 date : setHours ( setMinutes ( new Date ( ) , 0 ) , 13 ) ,
152+ type : 'Reward' ,
149153 } )
150- }
154+ } }
151155 >
152156 New Reward
153157 </ Button >
@@ -175,6 +179,7 @@ export default function Rewards({ id, hackathons }) {
175179 < thead >
176180 < TableRow >
177181 < TableHeader > Reward</ TableHeader >
182+ < TableHeader > Type</ TableHeader >
178183 < TableHeader > Blurb</ TableHeader >
179184 < TableHeader > Number of Prizes Available</ TableHeader >
180185 < TableHeader > Required Points</ TableHeader >
@@ -189,6 +194,7 @@ export default function Rewards({ id, hackathons }) {
189194 key = { rewards [ curr ] . rewardID }
190195 rewardID = { rewards [ curr ] . rewardID }
191196 reward = { rewards [ curr ] . reward }
197+ type = { rewards [ curr ] . type }
192198 blurb = { rewards [ curr ] . blurb }
193199 prizesAvailable = { rewards [ curr ] . prizesAvailable }
194200 requiredPoints = { rewards [ curr ] . requiredPoints }
@@ -216,6 +222,17 @@ export default function Rewards({ id, hackathons }) {
216222 onChange = { reward => handleInput ( 'reward' , reward . target . value , newReward , setNewReward ) }
217223 />
218224 </ ModalContent >
225+ < ModalContent columns = { 1 } >
226+ < ModalField
227+ label = "Type"
228+ modalAction = { NEW }
229+ dropdown
230+ dropdownOptions = { REWARD_TYPES }
231+ onChange = { type => {
232+ handleInput ( 'type' , type . label , newReward , setNewReward )
233+ } }
234+ />
235+ </ ModalContent >
219236 < ModalContent columns = { 1 } >
220237 < ModalField
221238 label = "Blurb"
@@ -271,6 +288,9 @@ export default function Rewards({ id, hackathons }) {
271288 < ModalContent columns = { 1 } >
272289 < ModalField label = "Reward" value = { rewardViewing . reward } modalAction = { VIEW } />
273290 </ ModalContent >
291+ < ModalContent columns = { 1 } >
292+ < ModalField label = "Type" value = { rewardViewing . type } modalAction = { VIEW } />
293+ </ ModalContent >
274294 < ModalContent columns = { 1 } >
275295 < ModalField label = "Blurb" value = { rewardViewing . blurb } modalAction = { VIEW } />
276296 </ ModalContent >
@@ -303,6 +323,18 @@ export default function Rewards({ id, hackathons }) {
303323 } }
304324 />
305325 </ ModalContent >
326+ < ModalContent columns = { 1 } >
327+ < ModalField
328+ label = "Type"
329+ modalAction = { NEW }
330+ dropdown
331+ dropdownOptions = { REWARD_TYPES }
332+ value = { rewardEditing ?. type || undefined }
333+ onChange = { type => {
334+ handleInput ( 'type' , type . label , rewardEditing , setRewardEditing )
335+ } }
336+ />
337+ </ ModalContent >
306338 < ModalContent columns = { 1 } >
307339 < ModalField
308340 label = "Blurb"
@@ -363,6 +395,9 @@ export default function Rewards({ id, hackathons }) {
363395 < ModalContent columns = { 1 } >
364396 < ModalField label = "Reward" value = { rewardConfirm . rewardConfirm } modalAction = { VIEW } />
365397 </ ModalContent >
398+ < ModalContent columns = { 1 } >
399+ < ModalField label = "Type" value = { rewardConfirm . type } modalAction = { VIEW } />
400+ </ ModalContent >
366401 < ModalContent columns = { 1 } >
367402 < ModalField label = "Blurb" value = { rewardConfirm . blurb } modalAction = { VIEW } />
368403 </ ModalContent >
0 commit comments