Improved spinner logic and table design #130
This commit is contained in:
parent
7d67b08ce6
commit
43b6df2ba3
@ -1,4 +1,5 @@
|
|||||||
<main [class]="themeName">
|
<main [class]="themeName">
|
||||||
|
|
||||||
<ng-container *ngIf="isLoggedIn; else login">
|
<ng-container *ngIf="isLoggedIn; else login">
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<ng-container *ngIf="spinnerService.showSpinnerState">
|
<ng-container *ngIf="showSpinnerState">
|
||||||
<div class="spinner-component-wrapper">
|
<div class="spinner-component-wrapper">
|
||||||
<div class="spinner-wrapper">
|
<div class="spinner-wrapper">
|
||||||
<p-progressSpinner styleClass="custom-spinner" animationDuration=".8s"></p-progressSpinner>
|
<p-progressSpinner styleClass="custom-spinner" animationDuration=".8s"></p-progressSpinner>
|
||||||
|
@ -8,9 +8,15 @@ import { SpinnerService } from 'src/app/services/spinner/spinner.service';
|
|||||||
})
|
})
|
||||||
export class SpinnerComponent implements OnInit {
|
export class SpinnerComponent implements OnInit {
|
||||||
|
|
||||||
|
showSpinnerState: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public spinnerService: SpinnerService
|
public spinnerService: SpinnerService
|
||||||
) { }
|
) {
|
||||||
|
this.spinnerService.showSpinnerState$.subscribe(value => {
|
||||||
|
this.showSpinnerState = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,9 @@ export class Queries {
|
|||||||
id
|
id
|
||||||
gameServer
|
gameServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createdAt
|
||||||
|
modifiedAt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<ng-template pTemplate="header">
|
<ng-template pTemplate="header">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="table-header-small" pSortableColumn="id">
|
<th pSortableColumn="id">
|
||||||
<div class="table-header-label">
|
<div class="table-header-label">
|
||||||
<div class="table-header-text">{{'view.server.members.headers.id' | translate}}</div>
|
<div class="table-header-text">{{'view.server.members.headers.id' | translate}}</div>
|
||||||
<p-sortIcon field="id" class="table-header-icon"></p-sortIcon>
|
<p-sortIcon field="id" class="table-header-icon"></p-sortIcon>
|
||||||
@ -61,33 +61,46 @@
|
|||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th class="table-header-actions" pSortableColumn="leftServer">
|
<th pSortableColumn="leftServer">
|
||||||
<div class="table-header-label">
|
<div class="table-header-label">
|
||||||
<div class="table-header-text">{{'view.server.members.headers.left_server' | translate}}</div>
|
<div class="table-header-text">{{'view.server.members.headers.left_server' | translate}}</div>
|
||||||
<p-sortIcon field="leftServer" class="table-header-icon"></p-sortIcon>
|
<p-sortIcon field="leftServer" class="table-header-icon"></p-sortIcon>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th class="table-header-small-dropdown" pSortableColumn="level.name">
|
<th pSortableColumn="level.name">
|
||||||
<div class="table-header-label">
|
<div class="table-header-label">
|
||||||
<div class="table-header-text">{{'view.server.members.headers.level' | translate}}</div>
|
<div class="table-header-text">{{'view.server.members.headers.level' | translate}}</div>
|
||||||
<p-sortIcon field="level.name" class="table-header-icon"></p-sortIcon>
|
<p-sortIcon field="level.name" class="table-header-icon"></p-sortIcon>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<th class="table-header-actions">
|
<th>
|
||||||
|
<div class="table-header-label">
|
||||||
|
<div class="table-header-text">{{'common.created_at' | translate}}</div>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th>
|
||||||
|
<div class="table-header-label">
|
||||||
|
<div class="table-header-text">{{'common.modified_at' | translate}}</div>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th>
|
||||||
<div class="table-header-label">
|
<div class="table-header-label">
|
||||||
<div class="table-header-text">{{'view.server.members.headers.actions' | translate}}</div>
|
<div class="table-header-text">{{'view.server.members.headers.actions' | translate}}</div>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th class="table-header-small">
|
||||||
<form [formGroup]="filterForm">
|
<form [formGroup]="filterForm">
|
||||||
<input type="text" pInputText formControlName="id" placeholder="{{'view.server.members.headers.id' | translate}}">
|
<input type="text" pInputText formControlName="id" placeholder="{{'view.server.members.headers.id' | translate}}">
|
||||||
</form>
|
</form>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th class="table-header-medium">
|
||||||
<form [formGroup]="filterForm">
|
<form [formGroup]="filterForm">
|
||||||
<input type="text" pInputText formControlName="discordId" placeholder="{{'view.server.members.headers.discord_id' | translate}}">
|
<input type="text" pInputText formControlName="discordId" placeholder="{{'view.server.members.headers.discord_id' | translate}}">
|
||||||
</form>
|
</form>
|
||||||
@ -99,17 +112,19 @@
|
|||||||
</th>
|
</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th>
|
<th class="table-header-small-dropdown">
|
||||||
<form [formGroup]="filterForm">
|
<form [formGroup]="filterForm">
|
||||||
<p-dropdown formControlName="leftServer" [options]="leftServerOptions" placeholder="{{'view.server.members.headers.left_server' | translate}}"></p-dropdown>
|
<p-dropdown formControlName="leftServer" [options]="leftServerOptions" placeholder="{{'view.server.members.headers.left_server' | translate}}"></p-dropdown>
|
||||||
</form>
|
</form>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th class="table-header-small-dropdown">
|
||||||
<form [formGroup]="filterForm">
|
<form [formGroup]="filterForm">
|
||||||
<p-dropdown formControlName="level" [options]="levels" placeholder="{{'view.server.members.headers.level' | translate}}"></p-dropdown>
|
<p-dropdown formControlName="level" [options]="levels" placeholder="{{'view.server.members.headers.level' | translate}}"></p-dropdown>
|
||||||
</form>
|
</form>
|
||||||
</th>
|
</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th class="table-header-actions"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
@ -185,6 +200,26 @@
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
</p-cellEditor>
|
</p-cellEditor>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<p-cellEditor>
|
||||||
|
<ng-template pTemplate="input">
|
||||||
|
{{member.createdAt | date:'dd.MM.yy HH:mm'}}
|
||||||
|
</ng-template>
|
||||||
|
<ng-template pTemplate="output">
|
||||||
|
{{member.createdAt | date:'dd.MM.yy HH:mm'}}
|
||||||
|
</ng-template>
|
||||||
|
</p-cellEditor>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<p-cellEditor>
|
||||||
|
<ng-template pTemplate="input">
|
||||||
|
{{member.modifiedAt | date:'dd.MM.yy HH:mm'}}
|
||||||
|
</ng-template>
|
||||||
|
<ng-template pTemplate="output">
|
||||||
|
{{member.modifiedAt | date:'dd.MM.yy HH:mm'}}
|
||||||
|
</ng-template>
|
||||||
|
</p-cellEditor>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-wrapper">
|
<div class="btn-wrapper">
|
||||||
<button *ngIf="!editing" pButton pInitEditableRow class="btn icon-btn" icon="pi pi-pencil"
|
<button *ngIf="!editing" pButton pInitEditableRow class="btn icon-btn" icon="pi pi-pencil"
|
||||||
|
@ -35,18 +35,17 @@ export class ProfileComponent implements OnInit {
|
|||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.data.getServerFromRoute(this.route);
|
this.data.getServerFromRoute(this.route);
|
||||||
|
|
||||||
this.spinner.showSpinner();
|
|
||||||
if (!this.route.snapshot.params["memberId"]) {
|
if (!this.route.snapshot.params["memberId"]) {
|
||||||
this.spinner.hideSpinner();
|
|
||||||
this.router.navigate(["/dashboard"]);
|
this.router.navigate(["/dashboard"]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let authUser = await this.auth.getLoggedInUser();
|
let authUser = await this.auth.getLoggedInUser();
|
||||||
|
this.spinner.showSpinner();
|
||||||
let user: UserDTO | null = authUser?.users?.find(u => u.server == this.sidebar.server$.value?.id) ?? null;
|
let user: UserDTO | null = authUser?.users?.find(u => u.server == this.sidebar.server$.value?.id) ?? null;
|
||||||
if (!user || user?.id != this.route.snapshot.params["memberId"] && !user?.isModerator) {
|
if (!user || user?.id != this.route.snapshot.params["memberId"] && !user?.isModerator) {
|
||||||
this.toast.error(this.translate.instant("view.server.profile.permission_denied"), this.translate.instant("view.server.profile.permission_denied_d"));
|
this.toast.error(this.translate.instant("view.server.profile.permission_denied"), this.translate.instant("view.server.profile.permission_denied_d"));
|
||||||
|
this.spinner.hideSpinner();
|
||||||
this.router.navigate(["/server", this.sidebar.server$.value?.id]);
|
this.router.navigate(["/server", this.sidebar.server$.value?.id]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { BehaviorSubject } from "rxjs";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class SpinnerService {
|
export class SpinnerService {
|
||||||
|
|
||||||
showSpinnerState = false;
|
showSpinnerState$ = new BehaviorSubject<boolean>(false);
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
showSpinner() {
|
showSpinner() {
|
||||||
this.showSpinnerState = true;
|
this.showSpinnerState$.next(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
hideSpinner() {
|
hideSpinner() {
|
||||||
this.showSpinnerState = false;
|
this.showSpinnerState$.next(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSpinner() {
|
toggleSpinner() {
|
||||||
this.showSpinnerState = !this.showSpinnerState;
|
this.showSpinnerState$.next(!this.showSpinnerState$.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,8 +115,10 @@ header {
|
|||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
|
||||||
form {
|
form {
|
||||||
|
input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.content-row {
|
.content-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -213,7 +215,11 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.table-header-small {
|
.table-header-small {
|
||||||
width: 25px;
|
width: 75px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-header-medium {
|
||||||
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-header-actions {
|
.table-header-actions {
|
||||||
|
Loading…
Reference in New Issue
Block a user