Added more stuff on follow list
This commit is contained in:
parent
cc3fe8ae96
commit
024246fc5a
@ -34,8 +34,12 @@ class FollowsController(
|
||||
data class FollowsBanStatusEntry(
|
||||
val userId: Long,
|
||||
val username: String,
|
||||
val isBanned: Boolean,
|
||||
val lastUpdate: OffsetDateTime
|
||||
val secondsPlayed: Long?,
|
||||
val pp: Double?,
|
||||
val rank: Long?,
|
||||
val isBanned: Boolean?,
|
||||
val approximateBanTime: OffsetDateTime?,
|
||||
val lastUpdate: OffsetDateTime?
|
||||
)
|
||||
|
||||
@GetMapping("follows")
|
||||
@ -44,8 +48,12 @@ class FollowsController(
|
||||
val follows = dslContext.select(
|
||||
USERS.USER_ID,
|
||||
USERS.USERNAME,
|
||||
USERS.SECONDS_PLAYED,
|
||||
USERS.IS_BANNED,
|
||||
USERS.SYS_LAST_UPDATE
|
||||
USERS.PP_RAW,
|
||||
USERS.RANK,
|
||||
USERS.SYS_LAST_UPDATE,
|
||||
USERS.APPROX_BAN_DATE
|
||||
)
|
||||
.from(USER_FOLLOWS)
|
||||
.join(USERS).on(USER_FOLLOWS.FOLLOWS_USER_ID.eq(USERS.USER_ID))
|
||||
@ -55,8 +63,12 @@ class FollowsController(
|
||||
FollowsBanStatusEntry(
|
||||
it[USERS.USER_ID]!!,
|
||||
it[USERS.USERNAME]!!,
|
||||
it[USERS.IS_BANNED]!!,
|
||||
it[USERS.SYS_LAST_UPDATE]!!
|
||||
it[USERS.SECONDS_PLAYED],
|
||||
it[USERS.PP_RAW],
|
||||
it[USERS.RANK],
|
||||
it[USERS.IS_BANNED],
|
||||
it[USERS.APPROX_BAN_DATE],
|
||||
it[USERS.SYS_LAST_UPDATE]
|
||||
)
|
||||
}
|
||||
|
||||
@ -72,8 +84,12 @@ class FollowsController(
|
||||
val follows = dslContext.select(
|
||||
USERS.USER_ID,
|
||||
USERS.USERNAME,
|
||||
USERS.SECONDS_PLAYED,
|
||||
USERS.IS_BANNED,
|
||||
USERS.SYS_LAST_UPDATE
|
||||
USERS.PP_RAW,
|
||||
USERS.RANK,
|
||||
USERS.SYS_LAST_UPDATE,
|
||||
USERS.APPROX_BAN_DATE
|
||||
)
|
||||
.from(USER_FOLLOWS)
|
||||
.join(USERS).on(USER_FOLLOWS.FOLLOWS_USER_ID.eq(USERS.USER_ID))
|
||||
@ -83,8 +99,12 @@ class FollowsController(
|
||||
FollowsBanStatusEntry(
|
||||
it[USERS.USER_ID]!!,
|
||||
it[USERS.USERNAME]!!,
|
||||
it[USERS.IS_BANNED]!!,
|
||||
it[USERS.SYS_LAST_UPDATE]!!
|
||||
it[USERS.SECONDS_PLAYED],
|
||||
it[USERS.PP_RAW],
|
||||
it[USERS.RANK],
|
||||
it[USERS.IS_BANNED],
|
||||
it[USERS.APPROX_BAN_DATE],
|
||||
it[USERS.SYS_LAST_UPDATE]
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -2,39 +2,87 @@
|
||||
<div class="fade-stuff">
|
||||
<h1 class="mb-4"><span class="text-muted">hi,</span> {{ this.userService.currentUser?.username }}</h1>
|
||||
|
||||
<h1 class="mb-4"># follow-list</h1>
|
||||
<h1># follow-list</h1>
|
||||
<div class="text-center">
|
||||
<p>You can follow users by going on their profile and clicking the <code>(+) Add follow</code> buttan.</p>
|
||||
</div>
|
||||
<ng-template #noFollows>
|
||||
<div class="text-center">
|
||||
<p>You are not following anyone!</p>
|
||||
<p>You can follow users by going on their profile and clicking the <code>(+) Add follow</code> buttan.</p>
|
||||
<p>Then, they'll appear here, and you'll be able to check if they've been banned or not.</p>
|
||||
</div>
|
||||
</ng-template>
|
||||
<table *ngIf="this.follows && this.follows.follows.length > 0; else noFollows">
|
||||
<ng-template #nullTemplate>
|
||||
<code>null</code>
|
||||
</ng-template>
|
||||
<ng-container *ngIf="this.follows && this.follows.follows.length > 0; else noFollows">
|
||||
<fieldset class="mb-2">
|
||||
<legend>tools</legend>
|
||||
<div class="text-center">
|
||||
<button (click)="this.downloadFilesService.downloadCSV(this.follows.follows, ['userId', 'username', 'secondsPlayed', 'pp', 'rank', 'isBanned', 'approximateBanTime', 'lastUpdate'], 'nise-follows')">Download .csv</button>
|
||||
<button (click)="this.downloadFilesService.downloadJSON(this.follows.follows, 'nise-follows')">Download .json</button>
|
||||
<button (click)="this.downloadFilesService.downloadXLSX(this.follows.follows, 'nise-follows')">Download .xlsx</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Username</th>
|
||||
<th>Time played</th>
|
||||
<th>Total PP</th>
|
||||
<th>Rank</th>
|
||||
<th>Is banned?</th>
|
||||
<th>Last check</th>
|
||||
<th>Approximate ban date</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let user of this.follows.follows">
|
||||
<td>
|
||||
<img [src]="'https://a.ppy.sh/' + user.userId" class="avatar" style="width: 16px; min-height: 16px; height: 16px;">
|
||||
<img [src]="'https://a.ppy.sh/' + user.userId" class="avatar" style="width: 16px; min-height: 16px; height: 16px;" loading="lazy">
|
||||
</td>
|
||||
<td>
|
||||
<a [routerLink]="['/u', user.username]">
|
||||
{{ user.username }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ user.isBanned }}</td>
|
||||
<td>{{ calculateTimeAgo(user.lastUpdate) }}</td>
|
||||
<td>
|
||||
<ng-container *ngIf="user.secondsPlayed else nullTemplate">
|
||||
{{ formatDuration(user.secondsPlayed) }}
|
||||
</ng-container>
|
||||
</td>
|
||||
<td>
|
||||
<ng-container *ngIf="user.pp; else nullTemplate">
|
||||
{{ user.pp | number: '1.0-0' }}
|
||||
</ng-container>
|
||||
</td>
|
||||
<td>
|
||||
<ng-container *ngIf="user.rank; else nullTemplate">
|
||||
#{{ user.rank | number }}
|
||||
</ng-container>
|
||||
</td>
|
||||
<td>
|
||||
<ng-container *ngIf="user.isBanned;">
|
||||
yes
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!user.isBanned;">
|
||||
nope
|
||||
</ng-container>
|
||||
</td>
|
||||
<td>
|
||||
<ng-container *ngIf="user.lastUpdate; else nullTemplate">
|
||||
{{ calculateTimeAgo(user.lastUpdate) }}
|
||||
</ng-container>
|
||||
</td>
|
||||
<td>
|
||||
<ng-container *ngIf="user.approximateBanTime; else nullTemplate">
|
||||
{{ user.approximateBanTime | date: 'medium' }}
|
||||
</ng-container>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {environment} from "../../environments/environment";
|
||||
import {JsonPipe, NgForOf, NgIf} from "@angular/common";
|
||||
import {calculateTimeAgo} from "../format";
|
||||
import {DatePipe, DecimalPipe, JsonPipe, NgForOf, NgIf} from "@angular/common";
|
||||
import {calculateTimeAgo, formatDuration} from "../format";
|
||||
import {RouterLink} from "@angular/router";
|
||||
import {UserService} from "../../corelib/service/user.service";
|
||||
import {Title} from "@angular/platform-browser";
|
||||
import {DownloadFilesService} from "../../corelib/service/download-files.service";
|
||||
|
||||
interface FollowsBanStatusResponse {
|
||||
follows: FollowsBanStatusEntry[];
|
||||
@ -14,8 +15,12 @@ interface FollowsBanStatusResponse {
|
||||
interface FollowsBanStatusEntry {
|
||||
userId: number;
|
||||
username: string;
|
||||
isBanned: boolean;
|
||||
lastUpdate: string;
|
||||
secondsPlayed?: number;
|
||||
pp?: number;
|
||||
rank?: number;
|
||||
isBanned?: boolean;
|
||||
approximateBanTime?: string;
|
||||
lastUpdate?: string;
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +31,9 @@ interface FollowsBanStatusEntry {
|
||||
JsonPipe,
|
||||
NgForOf,
|
||||
NgIf,
|
||||
RouterLink
|
||||
RouterLink,
|
||||
DatePipe,
|
||||
DecimalPipe
|
||||
],
|
||||
templateUrl: './profile.component.html',
|
||||
styleUrl: './profile.component.css'
|
||||
@ -38,7 +45,8 @@ export class ProfileComponent implements OnInit {
|
||||
constructor(
|
||||
private httpClient: HttpClient,
|
||||
private title: Title,
|
||||
public userService: UserService
|
||||
public userService: UserService,
|
||||
public downloadFilesService: DownloadFilesService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -53,4 +61,5 @@ export class ProfileComponent implements OnInit {
|
||||
}
|
||||
|
||||
protected readonly calculateTimeAgo = calculateTimeAgo;
|
||||
protected readonly formatDuration = formatDuration;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user