diff --git a/frontend/src/app/bans/bans.component.html b/frontend/src/app/bans/bans.component.html index 240784c..52c658b 100644 --- a/frontend/src/app/bans/bans.component.html +++ b/frontend/src/app/bans/bans.component.html @@ -1,8 +1,9 @@ - >

Punishment History

+

Minecraft

@@ -10,18 +11,30 @@
-
- - - - +
+
+ All +
+
+ Bans +
+
+ Mutes +
+
+ Warnings +
diff --git a/frontend/src/app/bans/bans.component.scss b/frontend/src/app/bans/bans.component.scss index b01ad69..13d7924 100644 --- a/frontend/src/app/bans/bans.component.scss +++ b/frontend/src/app/bans/bans.component.scss @@ -11,7 +11,7 @@ main .container { max-width: 1300px; } -.historyTypeContainer { +.historyButtonContainer { width: 70%; box-sizing: border-box; } @@ -24,6 +24,18 @@ main .container { .button-outer { margin-right: 15px; + background: var(--history-link-color); +} + +.button-outer.active { + color: var(--navlink-color); +} + +#currentButton { + text-decoration: none; + color: var(--white); + background: var(--link-color); + border-radius: 5px; } .historySearch { diff --git a/frontend/src/app/bans/bans.component.ts b/frontend/src/app/bans/bans.component.ts index 9a5bf94..0c0d437 100644 --- a/frontend/src/app/bans/bans.component.ts +++ b/frontend/src/app/bans/bans.component.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core'; import {HeaderComponent} from "../header/header.component"; import {HistoryComponent} from './history/history.component'; import {HistoryCount, HistoryService} from '../../api'; -import {NgForOf, NgIf} from '@angular/common'; +import {NgClass, NgForOf, NgIf} from '@angular/common'; import {FormsModule} from '@angular/forms'; @Component({ @@ -12,16 +12,26 @@ import {FormsModule} from '@angular/forms'; HistoryComponent, NgIf, FormsModule, - NgForOf + NgForOf, + NgClass ], templateUrl: './bans.component.html', styleUrl: './bans.component.scss' }) export class BansComponent implements OnInit { + + public getCurrentButtonId(options: 'all' | 'ban' | 'mute' | 'kick' | 'warn') { + if (options == this.punishmentType) { + return 'currentButton' + } + return null; + } + constructor(public historyApi: HistoryService) { } + public active: string = ''; public userType: 'player' | 'staff' = "player"; public punishmentType: 'all' | 'ban' | 'mute' | 'kick' | 'warn' = "all"; public page: number = 0; @@ -121,17 +131,22 @@ export class BansComponent implements OnInit { } public getMaxPage() { + // @ts-ignore const all = this.historyCount.bans + this.historyCount.mutes + this.historyCount.warnings; switch (this.punishmentType) { case 'all': return Math.ceil(all / 10); case 'ban': + // @ts-ignore return Math.ceil(this.historyCount.bans / 10); case 'mute': + // @ts-ignore return Math.ceil(this.historyCount.mutes / 10); case 'kick': + // @ts-ignore return Math.ceil(this.historyCount.kicks / 10); case 'warn': + // @ts-ignore return Math.ceil(this.historyCount.warnings / 10); default: return 0; diff --git a/frontend/src/app/bans/history/history.component.html b/frontend/src/app/bans/history/history.component.html index 0a3de74..ff018be 100644 --- a/frontend/src/app/bans/history/history.component.html +++ b/frontend/src/app/bans/history/history.component.html @@ -7,6 +7,7 @@
+ Type Player Banned By Reason @@ -18,7 +19,12 @@
- {{ entry.username }} + {{ getType(entry) }} + + + {{ entry.username }} + {{ entry.punishedBy }} {{ entry.reason }} {{ getPunishmentTime(entry) }} diff --git a/frontend/src/app/bans/history/history.component.scss b/frontend/src/app/bans/history/history.component.scss index 40472e8..084a1e6 100644 --- a/frontend/src/app/bans/history/history.component.scss +++ b/frontend/src/app/bans/history/history.component.scss @@ -14,17 +14,41 @@ tbody { td { padding: 5px 0 5px 0; + height: 55px; +} + +th { + padding: 5px 0 5px 0; } th, td { text-overflow: ellipsis; } +table tr td { + vertical-align: middle; +} + +.historyType { + width: 100px; +} + .historyPlayer { width: 200px; text-overflow: clip; } +img { + vertical-align: middle; + border-style: none; +} + +.avatar { + margin-bottom: 5px; + margin-right: 5px; + border-radius: 2px; +} + .historyReason { width: 920px; } diff --git a/frontend/src/app/bans/history/history.component.ts b/frontend/src/app/bans/history/history.component.ts index a480cc3..e58e7c5 100644 --- a/frontend/src/app/bans/history/history.component.ts +++ b/frontend/src/app/bans/history/history.component.ts @@ -1,14 +1,15 @@ import {Component, Input, OnChanges, OnInit} from '@angular/core'; import {BASE_PATH, HistoryService, PunishmentHistoryInner} from '../../../api'; import {map, Observable, shareReplay} from 'rxjs'; -import {NgForOf, NgIf} from '@angular/common'; +import {NgForOf, NgIf, NgOptimizedImage} from '@angular/common'; import {CookieService} from 'ngx-cookie-service'; @Component({ selector: 'app-history', imports: [ NgIf, - NgForOf + NgForOf, + NgOptimizedImage ], templateUrl: './history.component.html', styleUrl: './history.component.scss', @@ -70,9 +71,13 @@ export class HistoryComponent implements OnInit, OnChanges { }); } + public getType(entry: PunishmentHistoryInner) { + return entry.type.charAt(0).toUpperCase() + entry.type.slice(1); + } + public getExpiredTime(entry: PunishmentHistoryInner) { if (entry.expiryTime === 0) { - return "Permanent " + entry.type.charAt(0).toUpperCase() + entry.type.slice(1); + return "Permanent " + this.getType(entry); } const date = new Date(entry.expiryTime); return date.toLocaleString(navigator.language, { diff --git a/frontend/src/app/header/header.component.html b/frontend/src/app/header/header.component.html index 4834b15..3d03a7f 100644 --- a/frontend/src/app/header/header.component.html +++ b/frontend/src/app/header/header.component.html @@ -67,7 +67,7 @@
Altitude Server Logo -