diff --git a/InsightsPage.tsx b/InsightsPage.tsx
index 8842856..2196eed 100644
--- a/InsightsPage.tsx
+++ b/InsightsPage.tsx
@@ -1,5 +1,5 @@
import { useFocusEffect } from "@react-navigation/native";
-import { useCallback, useState } from "react";
+import { useCallback, useMemo, useState } from "react";
import { ActivityIndicator, ScrollView, View } from "react-native";
import { IconButton, Text } from "react-native-paper";
import AppPieChart from "./AppPieChart";
@@ -66,7 +66,6 @@ export default function InsightsPage() {
.then(() =>
AppDataSource.manager.query(selectHours).then(setHourCounts)
)
- .then(() => setLoadingHours(false))
.finally(() => {
setLoadingWeeks(false);
setLoadingHours(false);
@@ -85,6 +84,33 @@ export default function InsightsPage() {
return `${twelveHour} ${amPm}`;
};
+ const hourCharts = useMemo(() => {
+ if (loadingHours) return
+ if (hourCounts?.length === 0) return (
+ No entries yet! Start recording sets to see your most active days of
+ the week.
+ )
+ return hc.count)}
+ labels={hourCounts.map((hc) => hourLabel(hc.hour))}
+ />
+
+ }, [hourCounts, loadingHours])
+
+ const weekCharts = useMemo(() => {
+ if (loadingWeeks) return
+ if (weekCounts?.length === 0) return (
+ No entries yet! Start recording sets to see your most active days of
+ the week.
+ )
+ return ({
+ label: DAYS[weekCount.week],
+ value: weekCount.count,
+ }))}
+ />
+ }, [weekCounts, loadingWeeks])
+
return (
<>
@@ -136,23 +162,7 @@ export default function InsightsPage() {
/>
- {loadingWeeks ? (
-
- ) : (
- ({
- label: DAYS[weekCount.week],
- value: weekCount.count,
- }))}
- />
- )}
-
- {weekCounts?.length === 0 && (
-
- No entries yet! Start recording sets to see your most active days of
- the week.
-
- )}
+ {weekCharts}
- {loadingHours ? (
-
- ) : (
- hc.count)}
- labels={hourCounts.map((hc) => hourLabel(hc.hour))}
- />
- )}
-
- {hourCounts?.length === 0 && (
-
- No entries yet! Start recording sets to see your most active hours
- of the day.
-
- )}
+ {hourCharts}
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 7e08344..4dc858f 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -87,8 +87,8 @@ android {
applicationId "com.massive"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 36244
- versionName "2.29"
+ versionCode 36245
+ versionName "2.30"
}
signingConfigs {
release {
diff --git a/package-lock.json b/package-lock.json
index f3e798f..8b8edf2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "massive",
- "version": "2.27",
+ "version": "2.28",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "massive",
- "version": "2.27",
+ "version": "2.28",
"license": "GPL-3.0-only",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
diff --git a/package.json b/package.json
index d2f91db..1e2ae82 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "massive",
- "version": "2.29",
+ "version": "2.30",
"private": true,
"license": "GPL-3.0-only",
"scripts": {