From 024246fc5a36277d8701d0e83d168da5e0410140 Mon Sep 17 00:00:00 2001 From: "nise.moe" Date: Sun, 10 Mar 2024 15:00:15 +0100 Subject: [PATCH] Added more stuff on follow list --- .../nise/controller/FollowsController.kt | 36 ++++-- .../src/app/profile/profile.component.html | 106 +++++++++++++----- .../src/app/profile/profile.component.ts | 21 +++- 3 files changed, 120 insertions(+), 43 deletions(-) diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/FollowsController.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/FollowsController.kt index 357a5c1..32cea92 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/FollowsController.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/controller/FollowsController.kt @@ -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] ) } diff --git a/nise-frontend/src/app/profile/profile.component.html b/nise-frontend/src/app/profile/profile.component.html index 2ac4354..4cce6f4 100644 --- a/nise-frontend/src/app/profile/profile.component.html +++ b/nise-frontend/src/app/profile/profile.component.html @@ -2,39 +2,87 @@

hi, {{ this.userService.currentUser?.username }}

-

# follow-list

+

# follow-list

+
+

You can follow users by going on their profile and clicking the (+) Add follow buttan.

+

You are not following anyone!

-

You can follow users by going on their profile and clicking the (+) Add follow buttan.

-

Then, they'll appear here, and you'll be able to check if they've been banned or not.

- - - - - - - - - - - - - - - - - -
UsernameIs banned?Last check
- - - - {{ user.username }} - - {{ user.isBanned }}{{ calculateTimeAgo(user.lastUpdate) }} -
- + + null + + +
+ tools +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
UsernameTime playedTotal PPRankIs banned?Last checkApproximate ban date
+ + + + {{ user.username }} + + + + {{ formatDuration(user.secondsPlayed) }} + + + + {{ user.pp | number: '1.0-0' }} + + + + #{{ user.rank | number }} + + + + yes + + + nope + + + + {{ calculateTimeAgo(user.lastUpdate) }} + + + + {{ user.approximateBanTime | date: 'medium' }} + + +
+
diff --git a/nise-frontend/src/app/profile/profile.component.ts b/nise-frontend/src/app/profile/profile.component.ts index c262f3b..3073337 100644 --- a/nise-frontend/src/app/profile/profile.component.ts +++ b/nise-frontend/src/app/profile/profile.component.ts @@ -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; }