@@ -30,14 +30,17 @@ const bn = 'nomination-dialog';
30
30
export class Nominator extends React . Component < Props > {
31
31
private readonly checkboxContainerRef = React . createRef < HTMLDivElement > ( ) ;
32
32
@observable private loading = false ;
33
- @observable private selectedModes : GameMode [ ] = [ ] ;
34
33
@observable private visible = false ;
35
34
private xhr ?: JQuery . jqXHR < BeatmapsetWithDiscussionsJson > ;
36
35
37
36
private get beatmapset ( ) {
38
37
return this . props . discussionsState . beatmapset ;
39
38
}
40
39
40
+ private get calculatedMainRuleset ( ) {
41
+ return this . props . discussionsState . calculatedMainRuleset ;
42
+ }
43
+
41
44
private get currentHype ( ) {
42
45
return this . props . discussionsState . totalHypeCount ;
43
46
}
@@ -73,6 +76,10 @@ export class Nominator extends React.Component<Props> {
73
76
: Object . keys ( this . beatmapset . nominations . required ) as GameMode [ ] ;
74
77
}
75
78
79
+ private get selectedModes ( ) {
80
+ return this . props . discussionsState . selectedNominatedRulesets ;
81
+ }
82
+
76
83
private get users ( ) {
77
84
return this . props . store . users ;
78
85
}
@@ -128,13 +135,6 @@ export class Nominator extends React.Component<Props> {
128
135
) ;
129
136
}
130
137
131
- private get calculatedMode ( ) {
132
- return this . beatmapset . main_ruleset
133
- // The main ruleset not being set yet implies there are either no nominations
134
- // or an equal number of nominations for each ruleset, so the next selection should make it the main ruleset.
135
- ?? ( this . selectedModes . length === 1 ? this . selectedModes [ 0 ] : null ) ;
136
- }
137
-
138
138
private hasFullNomination ( mode : GameMode ) {
139
139
return this . nominationEvents . some ( ( event ) => {
140
140
const user = this . users . get ( event . user_id ) ;
@@ -186,7 +186,7 @@ export class Nominator extends React.Component<Props> {
186
186
}
187
187
188
188
return curr >= req
189
- || this . calculatedMode != null && this . calculatedMode !== mode && this . nominationCountWithSelections ( mode ) > 0 ;
189
+ || this . calculatedMainRuleset != null && this . calculatedMainRuleset !== mode && this . nominationCountWithSelections ( mode ) > 0 ;
190
190
}
191
191
192
192
private nominationCountWithSelections ( mode : GameMode ) {
@@ -259,7 +259,7 @@ export class Nominator extends React.Component<Props> {
259
259
}
260
260
261
261
private renderModalContentHybrid ( ) {
262
- const currentMode = this . calculatedMode ?? 'undefined' ;
262
+ const currentMode = this . calculatedMainRuleset ?? 'undefined' ;
263
263
264
264
return (
265
265
< >
@@ -324,7 +324,7 @@ export class Nominator extends React.Component<Props> {
324
324
@action
325
325
private readonly updateCheckboxes = ( ) => {
326
326
const checkedBoxes = map ( this . checkboxContainerRef . current ?. querySelectorAll < HTMLInputElement > ( 'input[type=checkbox]:checked' ) , ( node ) => node . value ) ;
327
- this . selectedModes = checkedBoxes as GameMode [ ] ;
327
+ this . props . discussionsState . selectedNominatedRulesets = checkedBoxes as GameMode [ ] ;
328
328
} ;
329
329
330
330
private userCanNominateMode ( mode : GameMode ) {
0 commit comments