From 083a13fdb7a7df68e014b0684d7ce2b5395da1b8 Mon Sep 17 00:00:00 2001 From: Gagan Suie Date: Mon, 11 Sep 2023 02:47:48 -0500 Subject: [PATCH] Fix: changed hours to minutes --- src/lib/components/Global/DrawerMain.svelte | 18 +++++++++--------- .../components/Profile/Elements/Stats.svelte | 18 +++++++++--------- src/lib/components/Profile/TabSection.svelte | 12 ++++++------ src/routes/[username]/+page.server.ts | 8 ++++---- src/routes/[username]/+page.svelte | 6 +++--- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/lib/components/Global/DrawerMain.svelte b/src/lib/components/Global/DrawerMain.svelte index a75fa674..682fdb56 100644 --- a/src/lib/components/Global/DrawerMain.svelte +++ b/src/lib/components/Global/DrawerMain.svelte @@ -22,7 +22,7 @@ } from '$lib/stores/remoteConfigStore' import IconMageText from '$lib/assets/icons/IconMageText.svelte' import { is_apps_modal_open, is_login_modal_open } from '$lib/stores/helperStore' - import { colorFromLevel, levelAndBarValueFromExp } from '$lib/utils' + import { colorFromLevel, getNumberInThousands, levelAndBarValueFromExp } from '$lib/utils' import { onMount } from 'svelte' import { isOnline } from '$lib/stores/userStore' import { get } from '$lib/api' @@ -40,7 +40,7 @@ let progressBarValue = 0 let progressBarColor = colorFromLevel(1) let streakCount: any = { current: 0, highest: 0 } - let hoursStreamed: number = 0 + let minsStreamed: number = 0 let followers: number = 0 onMount(async () => { if (currentUser) { @@ -50,9 +50,7 @@ progressBarValue = levelAndBarValue.barValue progressBarColor = colorFromLevel(progressBarLevel) streakCount = await get(`stats/stream/streak?userId=${$page.data.user?.userId}`) - hoursStreamed = await get( - `stats/stream/total-hours/24-hours?userId=${$page.data.user?.userId}` - ) + minsStreamed = await get(`stats/stream/total-mins/24-hours?userId=${$page.data.user?.userId}`) followers = await get(`follows/count?source=${$page.data.user?.userId}&sourceType=source1`, { userId: $page.data.user?.userId, token: $page.data.user?.token @@ -124,16 +122,18 @@
+ data-tip="{getNumberInThousands(minsStreamed || 0)} mins streamed today">

- {hoursStreamed} h + {getNumberInThousands(minsStreamed || 0)} m

-
+

- {followers} + {getNumberInThousands(followers || 0)}

diff --git a/src/lib/components/Profile/Elements/Stats.svelte b/src/lib/components/Profile/Elements/Stats.svelte index 27419502..be79e413 100644 --- a/src/lib/components/Profile/Elements/Stats.svelte +++ b/src/lib/components/Profile/Elements/Stats.svelte @@ -12,18 +12,18 @@ viewsMonthlyIncr: any, highestAndCurrentStreak: any, streakMonthlyIncr: any, - totalHours: any, - totalHoursMonthlyIncr: any, - avgHours: any + totalMins: any, + totalMinsMonthlyIncr: any, + avgMins: any onMount(async () => { if (profile) { viewsMonthlyIncr = (await viewsMonthlyIncr) || 0 highestAndCurrentStreak = (await highestAndCurrentStreak) || 0 streakMonthlyIncr = (await streakMonthlyIncr) || 0 - totalHours = (await totalHours) || 0 - totalHoursMonthlyIncr = (await totalHoursMonthlyIncr) || 0 - avgHours = (await avgHours) || 0 + totalMins = (await totalMins) || 0 + totalMinsMonthlyIncr = (await totalMinsMonthlyIncr) || 0 + avgMins = (await avgMins) || 0 } }) @@ -57,9 +57,9 @@
-
Total / Avg Hours
-
{totalHours} / {avgHours}
-
{totalHoursMonthlyIncr.monthlyChange} % more than last month
+
Total / Avg Mins
+
{totalMins} / {avgMins}
+
{totalMinsMonthlyIncr.monthlyChange} % more than last month