diff --git a/bot/src/bot_data/model/user.py b/bot/src/bot_data/model/user.py index bfb65ae6..bfc7be34 100644 --- a/bot/src/bot_data/model/user.py +++ b/bot/src/bot_data/model/user.py @@ -168,6 +168,13 @@ class User(TableABC): game_idents_repo: UserGameIdentRepositoryABC = services.get_service(UserGameIdentRepositoryABC) return game_idents_repo.get_user_game_idents_by_user_id(self.id) + @property + @ServiceProviderABC.inject + def profile_picture_url(self, bot: DiscordBotServiceABC) -> str: + guild = bot.get_guild(self.server.discord_id) + user = guild.get_member(self._discord_id) + return None if user is None else user.avatar.url + @staticmethod def get_select_all_string() -> str: return str( diff --git a/bot/src/bot_graphql/graphql/user.gql b/bot/src/bot_graphql/graphql/user.gql index e4ed9ea1..029bd7ce 100644 --- a/bot/src/bot_graphql/graphql/user.gql +++ b/bot/src/bot_graphql/graphql/user.gql @@ -11,6 +11,8 @@ type User implements TableWithHistoryQuery { level: Level activityScore: Int + profilePictureURL: String + joinedServers(filter: UserJoinedServerFilter, page: Page, sort: Sort): [UserJoinedServer] joinedServerCount: Int diff --git a/bot/src/bot_graphql/queries/user_query.py b/bot/src/bot_graphql/queries/user_query.py index 1d31312f..6ea49d9a 100644 --- a/bot/src/bot_graphql/queries/user_query.py +++ b/bot/src/bot_graphql/queries/user_query.py @@ -88,3 +88,4 @@ class UserQuery(DataQueryWithHistoryABC): self.set_field("server", lambda user, *_: user.server) self.set_field("leftServer", lambda user, *_: user.left_server) + self.set_field("profilePictureURL", lambda user, *_: user.profile_picture_url) diff --git a/web/src/app/models/data/user.model.ts b/web/src/app/models/data/user.model.ts index f7ae3454..a21884bc 100644 --- a/web/src/app/models/data/user.model.ts +++ b/web/src/app/models/data/user.model.ts @@ -36,6 +36,8 @@ export interface User extends DataWithHistory { userWarningCount?: number; userWarnings?: UserWarning[]; + + profilePictureURL?: string; } export interface UserFilter { diff --git a/web/src/app/models/graphql/queries.model.ts b/web/src/app/models/graphql/queries.model.ts index 2db56afa..d5ceb096 100644 --- a/web/src/app/models/graphql/queries.model.ts +++ b/web/src/app/models/graphql/queries.model.ts @@ -406,6 +406,7 @@ export class Queries { joinedOn leavedOn } + profilePictureURL createdAt modifiedAt diff --git a/web/src/app/modules/shared/shared.module.ts b/web/src/app/modules/shared/shared.module.ts index af9e8ea8..55abd3ad 100644 --- a/web/src/app/modules/shared/shared.module.ts +++ b/web/src/app/modules/shared/shared.module.ts @@ -40,6 +40,7 @@ import { TabViewModule } from "primeng/tabview"; import { RadioButtonModule } from "primeng/radiobutton"; import { InputTextareaModule } from "primeng/inputtextarea"; import { InputMaskModule } from "primeng/inputmask"; +import { KnobModule } from "primeng/knob"; const PrimeNGModules = [ @@ -73,7 +74,8 @@ const PrimeNGModules = [ TabViewModule, RadioButtonModule, InputTextareaModule, - InputMaskModule + InputMaskModule, + KnobModule ]; @NgModule({ diff --git a/web/src/app/modules/view/server/profile/profile.component.html b/web/src/app/modules/view/server/profile/profile.component.html index ea14ad09..ba88ccfe 100644 --- a/web/src/app/modules/view/server/profile/profile.component.html +++ b/web/src/app/modules/view/server/profile/profile.component.html @@ -2,119 +2,94 @@ {{'view.server.profile.header' | translate}}
-
-

- {{user.name}} -

-
-
-
{{'common.id' | translate}}:
-
{{user.id}}
+
-
-
{{'common.discord_id' | translate}}:
-
{{user.discordId}}
+
+
+

{{user.name}}

+
+
+
{{'common.id' | translate}}:
+
{{user.id}}
+
+
+
{{'common.discord_id' | translate}}:
+
{{user.discordId}}
+
+
+
{{'view.server.profile.message_count' | translate}}:
+
{{user.messageCount}}
+
+
+
{{'view.server.profile.reaction_count' | translate}}:
+
{{user.reactionCount}}
+
+
+
{{'view.server.profile.birthday' | translate}}:
+
{{user.birthday}}
+
+ +
+
+
+
+
{{'view.server.profile.left_server' | translate}}:
+
{{user.leftServer | bool}}
+
+
+
{{'common.created_at' | translate}}:
+
{{user.createdAt | date:'dd.MM.yyyy HH:mm:ss'}}
+
+
+
{{'common.modified_at' | translate}}:
+
{{user.modifiedAt | date:'dd.MM.yyyy HH:mm:ss'}}
+
-
+
+
+
+ +
+
+ -
-
-
{{'view.server.profile.name' | translate}}:
-
{{user.name}}
-
-
- -
-
-
{{'view.server.profile.xp' | translate}}:
-
{{user.xp}}
-
-
-
- -
-
-
{{'view.server.profile.message_count' | translate}}:
-
{{user.messageCount}}
-
-
- -
-
-
{{'view.server.profile.reaction_count' | translate}}:
-
{{user.reactionCount}}
-
-
- -
-
-
{{'view.server.profile.birthday' | translate}}:
-
{{user.birthday}}
-
- +
+ {{user.level.name}} +
+
+
+
+
+
{{'common.ontime' | translate}}:
+
{{user.ontime}}
+
+
+
{{'common.game_ontime' | translate}}:
+
{{user.gameOntime}}
+
+
+
{{'common.activity' | translate}}:
+
{{user.activityScore}}
+
-
-
-
{{'common.ontime' | translate}}:
-
{{user.ontime}}
-
-
- -
-
-
{{'common.game_ontime' | translate}}:
-
{{user.gameOntime}}
-
-
- -
-
-
{{'common.activity' | translate}}:
-
{{user.activityScore}}
-
-
- -
-
-
{{'view.server.profile.level' | translate}}:
-
{{user.level?.name}}
-
- - -
-
-
- -
-
-
{{'view.server.profile.left_server' | translate}}:
-
{{user.leftServer | bool}}
-
-
- -
-
-
{{'common.created_at' | translate}}:
-
{{user.createdAt | date:'dd.MM.yyyy HH:mm:ss'}}
-
-
- -
-
-
{{'common.modified_at' | translate}}:
-
{{user.modifiedAt | date:'dd.MM.yyyy HH:mm:ss'}}
-
-
+
-