@@ -21,11 +21,12 @@ export function RoleSheet({
2121
2222 function onSubmitCheckboxes ( e ) {
2323 e . preventDefault ( ) ;
24- // Only count checkboxes within this specific form for this role
2524 const checkboxes = e . target . querySelectorAll ( `input[type="checkbox"][id^="${ role } -"]:checked` ) ;
2625 const amount = checkboxes . length ;
27- scorePoints ( role , amount ) ;
28- setPointsScored ( true ) ;
26+ if ( amount > 0 ) {
27+ scorePoints ( role , amount ) ;
28+ setPointsScored ( true ) ;
29+ }
2930 }
3031
3132 return < div className = "role" >
@@ -43,14 +44,16 @@ export function RoleSheet({
4344 < EarnPointsForRole role = { role } scorePoints = { scorePoints } />
4445 < div >
4546 < form onSubmit = { onSubmitCheckboxes } >
46- { role == position && roles [ role ] . todos . map ( ( s , index ) => < div key = { s } >
47- < input type = "checkbox" id = { `${ role } -${ index } ` } className = "earn-points-checkbox" style = { { float : "left" , display : "block" , marginTop : "6px" , width : "9%" , minHeight : "20px" } } />
48- < div style = { { marginLeft : "32px" , margin : "4px" , padding : "4px" } } > { s } </ div >
49- </ div > ) }
47+ { role == position && roles [ role ] . todos . map ( ( todo , index ) =>
48+ < div key = { todo } >
49+ < input type = "checkbox" id = { `${ role } -${ index } ` } className = "earn-points-checkbox" style = { { float : "left" , display : "block" , marginTop : "6px" , width : "9%" , minHeight : "20px" } } />
50+ < div style = { { marginLeft : "32px" , margin : "4px" , padding : "4px" } } > { todo } </ div >
51+ </ div >
52+ ) }
5053
5154 { ! pointsScored && (
5255 < button
53- className = "rpgui-button add-points-button "
56+ className = "rpgui-button"
5457 aria-label = { "Earn Points" } >
5558 < p > Earn</ p >
5659 </ button >
0 commit comments