From 8657a33e65d64a791c4f29e28effa84f2e76b334 Mon Sep 17 00:00:00 2001 From: akastijn Date: Sun, 1 Mar 2026 02:38:29 +0100 Subject: [PATCH] Replace `@Input` with `input` decorator in HistoryComponent --- .../bans/history/history.component.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/pages/reference/bans/history/history.component.ts b/frontend/src/app/pages/reference/bans/history/history.component.ts index 1fbeaaa..365e0e1 100644 --- a/frontend/src/app/pages/reference/bans/history/history.component.ts +++ b/frontend/src/app/pages/reference/bans/history/history.component.ts @@ -1,4 +1,4 @@ -import {Component, EventEmitter, inject, Input, OnChanges, OnInit, Output} from '@angular/core'; +import {Component, EventEmitter, inject, input, OnChanges, OnInit, Output} from '@angular/core'; import {HistoryService, PunishmentHistory} from '@api'; import {catchError, map, Observable, shareReplay} from 'rxjs'; import {NgOptimizedImage} from '@angular/common'; @@ -28,10 +28,10 @@ import {MatIconModule} from '@angular/material/icon'; }) export class HistoryComponent implements OnInit, OnChanges { - @Input() userType: 'player' | 'staff' = "player"; - @Input() punishmentType: 'all' | 'ban' | 'mute' | 'kick' | 'warn' = "all"; - @Input() page: number = 0; - @Input() searchTerm: string = ''; + userType = input<'player' | 'staff'>("player"); + punishmentType = input<'all' | 'ban' | 'mute' | 'kick' | 'warn'>("all"); + page = input(0); + searchTerm = input(''); @Output() pageChange = new EventEmitter(); @Output() selectItem = new EventEmitter(); @@ -56,13 +56,13 @@ export class HistoryComponent implements OnInit, OnChanges { private reloadHistory(): void { let historyObservable: Observable; - if (this.searchTerm.length === 0) { - historyObservable = this.historyApi.getHistoryForAll(this.userType, this.punishmentType, this.page); + if (this.searchTerm().length === 0) { + historyObservable = this.historyApi.getHistoryForAll(this.userType(), this.punishmentType(), this.page()); } else { - if (this.uuidRegex.test(this.searchTerm)) { - historyObservable = this.historyApi.getHistoryForUuid(this.userType, this.punishmentType, this.searchTerm, this.page); + if (this.uuidRegex.test(this.searchTerm())) { + historyObservable = this.historyApi.getHistoryForUuid(this.userType(), this.punishmentType(), this.searchTerm(), this.page()); } else { - historyObservable = this.historyApi.getHistoryForUsers(this.userType, this.punishmentType, this.searchTerm, this.page); + historyObservable = this.historyApi.getHistoryForUsers(this.userType(), this.punishmentType(), this.searchTerm(), this.page()); } } historyObservable.pipe(