Updated styling and components for punishment history

This commit is contained in:
Peter 2025-04-12 17:05:08 +02:00
parent 1264003a44
commit 6a70428c75
8 changed files with 96 additions and 19 deletions

View File

@ -1,8 +1,9 @@
<ng-container> <ng-container>
<app-header [current_page]="'bans'" height="200px" background_image="/public/img/backgrounds/staff.png" <app-header [current_page]="'bans'" height="250px" background_image="/public/img/backgrounds/staff.png"
[overlay_gradient]="0.5">> [overlay_gradient]="0.5">>
<div class="title" header-content> <div class="title" header-content>
<h1>Punishment History</h1> <h1>Punishment History</h1>
<h2>Minecraft</h2>
</div> </div>
</app-header> </app-header>
@ -10,11 +11,23 @@
<section class="darkmodeSection"> <section class="darkmodeSection">
<div class="container"> <div class="container">
<div class="columnSection"> <div class="columnSection">
<div class="historyTypeContainer"> <div class="historyButtonContainer">
<button class="button-outer" (click)="changeHistoryPunishment('all')">All</button> <div [id]="getCurrentButtonId('all')" class="button-outer">
<button class="button-outer" (click)="changeHistoryPunishment('ban')">Bans</button> <span class="button-inner" (click)="changeHistoryPunishment('all')"
<button class="button-outer" (click)="changeHistoryPunishment('mute')">Mutes</button> [ngClass]="active">All</span>
<button class="button-outer" (click)="changeHistoryPunishment('warn')">Warnings</button> </div>
<div [id]="getCurrentButtonId('ban')" class="button-outer">
<span class="button-inner" (click)="changeHistoryPunishment('ban')"
[ngClass]="active">Bans</span>
</div>
<div [id]="getCurrentButtonId('mute')" class="button-outer">
<span class="button-inner" (click)="changeHistoryPunishment('mute')"
[ngClass]="active">Mutes</span>
</div>
<div [id]="getCurrentButtonId('warn')" class="button-outer">
<span class="button-inner" (click)="changeHistoryPunishment('warn')"
[ngClass]="active">Warnings</span>
</div>
</div> </div>
<div class="historySearchContainer"> <div class="historySearchContainer">
<input class="historySearch" <input class="historySearch"

View File

@ -11,7 +11,7 @@ main .container {
max-width: 1300px; max-width: 1300px;
} }
.historyTypeContainer { .historyButtonContainer {
width: 70%; width: 70%;
box-sizing: border-box; box-sizing: border-box;
} }
@ -24,6 +24,18 @@ main .container {
.button-outer { .button-outer {
margin-right: 15px; 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 { .historySearch {

View File

@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {HeaderComponent} from "../header/header.component"; import {HeaderComponent} from "../header/header.component";
import {HistoryComponent} from './history/history.component'; import {HistoryComponent} from './history/history.component';
import {HistoryCount, HistoryService} from '../../api'; import {HistoryCount, HistoryService} from '../../api';
import {NgForOf, NgIf} from '@angular/common'; import {NgClass, NgForOf, NgIf} from '@angular/common';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
@Component({ @Component({
@ -12,16 +12,26 @@ import {FormsModule} from '@angular/forms';
HistoryComponent, HistoryComponent,
NgIf, NgIf,
FormsModule, FormsModule,
NgForOf NgForOf,
NgClass
], ],
templateUrl: './bans.component.html', templateUrl: './bans.component.html',
styleUrl: './bans.component.scss' styleUrl: './bans.component.scss'
}) })
export class BansComponent implements OnInit { 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) { constructor(public historyApi: HistoryService) {
} }
public active: string = '';
public userType: 'player' | 'staff' = "player"; public userType: 'player' | 'staff' = "player";
public punishmentType: 'all' | 'ban' | 'mute' | 'kick' | 'warn' = "all"; public punishmentType: 'all' | 'ban' | 'mute' | 'kick' | 'warn' = "all";
public page: number = 0; public page: number = 0;
@ -121,17 +131,22 @@ export class BansComponent implements OnInit {
} }
public getMaxPage() { public getMaxPage() {
// @ts-ignore
const all = this.historyCount.bans + this.historyCount.mutes + this.historyCount.warnings; const all = this.historyCount.bans + this.historyCount.mutes + this.historyCount.warnings;
switch (this.punishmentType) { switch (this.punishmentType) {
case 'all': case 'all':
return Math.ceil(all / 10); return Math.ceil(all / 10);
case 'ban': case 'ban':
// @ts-ignore
return Math.ceil(this.historyCount.bans / 10); return Math.ceil(this.historyCount.bans / 10);
case 'mute': case 'mute':
// @ts-ignore
return Math.ceil(this.historyCount.mutes / 10); return Math.ceil(this.historyCount.mutes / 10);
case 'kick': case 'kick':
// @ts-ignore
return Math.ceil(this.historyCount.kicks / 10); return Math.ceil(this.historyCount.kicks / 10);
case 'warn': case 'warn':
// @ts-ignore
return Math.ceil(this.historyCount.warnings / 10); return Math.ceil(this.historyCount.warnings / 10);
default: default:
return 0; return 0;

View File

@ -7,6 +7,7 @@
<div style="width: 1300px; background-color: #dadada;"> <div style="width: 1300px; background-color: #dadada;">
<thead> <thead>
<tr> <tr>
<th class="historyType">Type</th>
<th class="historyPlayer">Player</th> <th class="historyPlayer">Player</th>
<th class="historyPlayer">Banned By</th> <th class="historyPlayer">Banned By</th>
<th class="historyReason">Reason</th> <th class="historyReason">Reason</th>
@ -18,7 +19,12 @@
<div> <div>
<tbody> <tbody>
<tr *ngFor="let entry of history"> <tr *ngFor="let entry of history">
<td class="historyPlayer">{{ entry.username }}</td> <td class="historyType">{{ getType(entry) }}</td>
<td class="historyPlayer">
<img class="avatar" ngSrc="https://cravatar.eu/avatar/cba80e47fcbc407aa5ad37a933b7fe30/25" width="25px"
height="25px" alt="">
{{ entry.username }}
</td>
<td class="historyPlayer">{{ entry.punishedBy }}</td> <td class="historyPlayer">{{ entry.punishedBy }}</td>
<td class="historyReason">{{ entry.reason }}</td> <td class="historyReason">{{ entry.reason }}</td>
<td class="historyDate">{{ getPunishmentTime(entry) }}</td> <td class="historyDate">{{ getPunishmentTime(entry) }}</td>

View File

@ -14,17 +14,41 @@ tbody {
td { td {
padding: 5px 0 5px 0; padding: 5px 0 5px 0;
height: 55px;
}
th {
padding: 5px 0 5px 0;
} }
th, td { th, td {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
table tr td {
vertical-align: middle;
}
.historyType {
width: 100px;
}
.historyPlayer { .historyPlayer {
width: 200px; width: 200px;
text-overflow: clip; text-overflow: clip;
} }
img {
vertical-align: middle;
border-style: none;
}
.avatar {
margin-bottom: 5px;
margin-right: 5px;
border-radius: 2px;
}
.historyReason { .historyReason {
width: 920px; width: 920px;
} }

View File

@ -1,14 +1,15 @@
import {Component, Input, OnChanges, OnInit} from '@angular/core'; import {Component, Input, OnChanges, OnInit} from '@angular/core';
import {BASE_PATH, HistoryService, PunishmentHistoryInner} from '../../../api'; import {BASE_PATH, HistoryService, PunishmentHistoryInner} from '../../../api';
import {map, Observable, shareReplay} from 'rxjs'; 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'; import {CookieService} from 'ngx-cookie-service';
@Component({ @Component({
selector: 'app-history', selector: 'app-history',
imports: [ imports: [
NgIf, NgIf,
NgForOf NgForOf,
NgOptimizedImage
], ],
templateUrl: './history.component.html', templateUrl: './history.component.html',
styleUrl: './history.component.scss', 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) { public getExpiredTime(entry: PunishmentHistoryInner) {
if (entry.expiryTime === 0) { 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); const date = new Date(entry.expiryTime);
return date.toLocaleString(navigator.language, { return date.toLocaleString(navigator.language, {

View File

@ -67,7 +67,7 @@
</div> </div>
<a href="/"><img ngSrc="/public/img/logos/logo.png" priority alt="Altitude Server Logo" height="319" <a href="/"><img ngSrc="/public/img/logos/logo.png" priority alt="Altitude Server Logo" height="319"
width="550"></a> width="550"></a>
<ul id="nav_list"> <ul>
<li class="nav_li"><a [id]="getCurrentPageId(['home'])" class="nav_link" href="/" [ngClass]="active">Home</a> <li class="nav_li"><a [id]="getCurrentPageId(['home'])" class="nav_link" href="/" [ngClass]="active">Home</a>
</li> </li>
<li class="nav_li"> <li class="nav_li">

View File

@ -13,14 +13,15 @@
.theme-light { .theme-light {
--color-primary: #FBFBFE; --color-primary: #FBFBFE;
--color-secondary: #FBFBFE; --color-secondary: #FBFBFE;
--color-tertiary: #e3f1f8; --color-tertiary: #E3F1F8;
--color-quaternary: #EFEFEF; --color-quaternary: #EFEFEF;
--color-quinary: #FBFBFE; --color-quinary: #FBFBFE;
--color-accent: #FD6F53; --color-accent: #FD6F53;
--font-color: #000000; --font-color: #000000;
--font-color-hover: #454545; --font-color-hover: #454545;
--navlink-color: #4b4b4b; --navlink-color: #4B4B4B;
--link-color: #1f9bde; --link-color: #1F9BDE;
--history-link-color: #A3A3A3;
--hamburger: #232323; --hamburger: #232323;
--dropdown-color: #DFDFDF; --dropdown-color: #DFDFDF;
--footer-color: #202020; --footer-color: #202020;
@ -36,7 +37,8 @@
--font-color: #FFFFFF; --font-color: #FFFFFF;
--font-color-hover: #9C9C9C; --font-color-hover: #9C9C9C;
--navlink-color: #FFFFFF; --navlink-color: #FFFFFF;
--link-color: #20729e; --link-color: #20729E;
--history-link-color: #4A4A4A;
--hamburger: #CDCDCD; --hamburger: #CDCDCD;
--dropdown-color: #303233; --dropdown-color: #303233;
--footer-color: #242526; --footer-color: #242526;