Skip to content

Commit

Permalink
fix(front): fix map submission and editing ranked way
Browse files Browse the repository at this point in the history
  • Loading branch information
petrecheli authored and tsa96 committed Oct 23, 2024
1 parent 975d8e7 commit f4f998d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { DropdownModule } from 'primeng/dropdown';
imports: [CommonModule, FormsModule, DropdownModule]
})
export class MapLeaderboardSelectionComponent implements ControlValueAccessor {
public readonly LeaderboardType = LeaderboardType;

protected readonly Gamemodes = Enum.values(Gamemode).map((gamemode) => ({
gamemode,
label: GamemodeInfo.get(gamemode).name
Expand Down Expand Up @@ -142,9 +144,8 @@ export class MapLeaderboardSelectionComponent implements ControlValueAccessor {
this.onTouched = fn;
}

updateRankedCheckbox(item: MapSubmissionSuggestion, event: Event) {
item.type = (event.target as HTMLInputElement).checked
? LeaderboardType.RANKED
: LeaderboardType.UNRANKED;
updateRankedCheckbox(item: MapSubmissionSuggestion, isRanked: boolean) {
item.type = isRanked ? LeaderboardType.RANKED : LeaderboardType.UNRANKED;
this.onChange(this.value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@
<input
type="checkbox"
class="checkbox h-[2.625rem] before:h-1/2 before:w-1/2"
[ngModel]="item.type"
(change)="updateRankedCheckbox(item, $event)"
[ngModel]="item.type === LeaderboardType.RANKED"
(ngModelChange)="updateRankedCheckbox(item, $event)"
(blur)="onTouched()"
(ngModelChange)="onChange(value)"
/>
</td>
<td>
Expand Down

0 comments on commit f4f998d

Please sign in to comment.