@@ -67,6 +70,10 @@ const { t } = useI18n()
margin-top: 10px;
padding: 0 60px;
+ &--loading {
+ opacity: 0.5;
+ }
+
&__header {
display: flex;
justify-content: space-between;
@@ -94,6 +101,13 @@ const { t } = useI18n()
&__graph {
margin-top: 10px;
+
+ &--loading {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 255px;
+ }
}
&__holofuel-button {
diff --git a/src/interfaces/HposInterface.ts b/src/interfaces/HposInterface.ts
index 2a3f0ff1..ac6c785b 100644
--- a/src/interfaces/HposInterface.ts
+++ b/src/interfaces/HposInterface.ts
@@ -33,7 +33,8 @@ interface HposInterface {
getRedemptionHistory: () => Promise
getCoreAppVersion: () => Promise
redeemHoloFuel: (payload: RedeemHoloFuelPayload) => Promise
- getHoloFuelDailyStats: () => Promise
+ getHoloFuelDailyStats: () => Promise
+ resetHoloFuelDailyStats: () => void
HPOS_API_URL: string
}
diff --git a/src/pages/EarningsPage.vue b/src/pages/EarningsPage.vue
index 250a2310..753c9137 100644
--- a/src/pages/EarningsPage.vue
+++ b/src/pages/EarningsPage.vue
@@ -11,15 +11,11 @@ const dashboardStore = useDashboardStore()
const userStore = useUserStore()
const isLoading = ref(false)
+const isLoadingStats = ref(false)
+
const isError = computed(() => !!dashboardStore.hostEarnings.error)
-const rawWeeklyEarnings = computed((): string | number =>
- !isErrorPredicate(dashboardStore.hostEarnings)
- ? dashboardStore.hostEarnings.earnings?.last7days
- : 0
-)
/* eslint-enable @typescript-eslint/no-magic-numbers */
-
const redeemableHoloFuel = computed((): number =>
!isErrorPredicate(dashboardStore.hostEarnings)
? Number(dashboardStore.hostEarnings.holofuel.redeemable || 0)
@@ -29,7 +25,9 @@ const redeemableHoloFuel = computed((): number =>
const kycLevel = computed(() => userStore.kycLevel)
async function getHoloFuelDailyStats(): Promise {
+ isLoadingStats.value = true
await dashboardStore.getHoloFuelDailyStats()
+ isLoadingStats.value = false
}
async function getEarnings(): Promise {
@@ -39,10 +37,8 @@ async function getEarnings(): Promise {
}
onMounted(async (): Promise => {
- if (!rawWeeklyEarnings.value || !Number(rawWeeklyEarnings.value)) {
- await getEarnings()
- await getHoloFuelDailyStats()
- }
+ await getEarnings()
+ await getHoloFuelDailyStats()
})
@@ -55,6 +51,7 @@ onMounted(async (): Promise => {
{
this.earningsStats = await getHoloFuelDailyStats()
+ },
+
+ resetHoloFuelDailyStats(): void {
+ this.earningsStats = {
+ dailies: [],
+ redeemed: 0
+ }
}
}
})
diff --git a/src/types/types.ts b/src/types/types.ts
index 822c1384..c58e6d6e 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -108,8 +108,8 @@ export interface InvoiceDue {
export interface DailyEarningsData {
date: string
- paid: number
- unpaid: number
+ paid: string
+ unpaid: string
}
export interface EarningsData {
From ec997db710cbd3999a0ec125dfb23532c3a08926 Mon Sep 17 00:00:00 2001
From: Mateusz Rybczonek
Date: Tue, 21 May 2024 10:48:02 +0200
Subject: [PATCH 4/4] feat: histogram chart design update
---
src/components/earnings/EarningsChart.vue | 2 +-
src/components/earnings/EarningsData.vue | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/earnings/EarningsChart.vue b/src/components/earnings/EarningsChart.vue
index d9383acb..32915254 100644
--- a/src/components/earnings/EarningsChart.vue
+++ b/src/components/earnings/EarningsChart.vue
@@ -20,7 +20,7 @@ function presentCurrency(value: number): string {
}
if (value === 0) {
- return '0 HF'
+ return '0'
}
const k = 1000
diff --git a/src/components/earnings/EarningsData.vue b/src/components/earnings/EarningsData.vue
index 33efe7bc..62fbdcaa 100644
--- a/src/components/earnings/EarningsData.vue
+++ b/src/components/earnings/EarningsData.vue
@@ -33,7 +33,7 @@ const totalEarnings = computed(() =>
{{ t('earnings.earnings_in_the_past_days', { numberOfDays: 7 }) }}