From ee5c07d10a8977f1f6b4451214efb0403d9ad57b Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 5 Sep 2022 15:12:24 +0200 Subject: [PATCH] displaying longest streak on profile --- backend/src/api/controllers/user.ts | 1 + frontend/src/ts/elements/profile.ts | 8 +++++++- frontend/src/ts/pages/profile.ts | 2 +- frontend/static/html/pages/account.html | 2 +- frontend/static/html/pages/profile.html | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/src/api/controllers/user.ts b/backend/src/api/controllers/user.ts index 0a27c573b..317fc5ab0 100644 --- a/backend/src/api/controllers/user.ts +++ b/backend/src/api/controllers/user.ts @@ -472,6 +472,7 @@ export async function getProfile( discordAvatar, xp, streak: streak?.length ?? 0, + maxStreak: streak?.maxLength ?? 0, }; if (banned) { diff --git a/frontend/src/ts/elements/profile.ts b/frontend/src/ts/elements/profile.ts index f8c33eadf..0d29a4b9c 100644 --- a/frontend/src/ts/elements/profile.ts +++ b/frontend/src/ts/elements/profile.ts @@ -79,9 +79,15 @@ export async function update( `Current streak: ${profile.streak} ${ profile.streak === 1 ? "day" : "days" }` + ) + .attr( + "aria-label", + `Longest streak: ${profile.maxStreak} ${ + profile.maxStreak === 1 ? "day" : "days" + }` ); } else { - details.find(".streak").text(""); + details.find(".streak").text("").attr("aria-label", ""); } const typingStatsEl = details.find(".typingStats"); diff --git a/frontend/src/ts/pages/profile.ts b/frontend/src/ts/pages/profile.ts index be193999b..7f6eb66b5 100644 --- a/frontend/src/ts/pages/profile.ts +++ b/frontend/src/ts/pages/profile.ts @@ -20,7 +20,7 @@ function reset(): void {
-
-
-
+
-
-
diff --git a/frontend/static/html/pages/account.html b/frontend/static/html/pages/account.html index 15bd58b33..ab5b86906 100644 --- a/frontend/static/html/pages/account.html +++ b/frontend/static/html/pages/account.html @@ -33,7 +33,7 @@
-
-
-
+
-
-
diff --git a/frontend/static/html/pages/profile.html b/frontend/static/html/pages/profile.html index 1c9b02d00..78644d9fc 100644 --- a/frontend/static/html/pages/profile.html +++ b/frontend/static/html/pages/profile.html @@ -17,7 +17,7 @@
-
-
-
+
-
-