Add activity indicator for insights

Also update the help descriptions.
This commit is contained in:
Brandon Presley 2023-11-09 13:20:08 +13:00
parent 307ad4c9dd
commit 9fee26f7c8
1 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import { useFocusEffect } from "@react-navigation/native"; import { useFocusEffect } from "@react-navigation/native";
import { useCallback, useState } from "react"; import { useCallback, useState } from "react";
import { ScrollView, View } from "react-native"; import { ActivityIndicator, ScrollView, View } from "react-native";
import { IconButton, Text } from "react-native-paper"; import { IconButton, Text } from "react-native-paper";
import AppPieChart from "./AppPieChart"; import AppPieChart from "./AppPieChart";
import Chart from "./Chart"; import Chart from "./Chart";
@ -125,6 +125,8 @@ export default function InsightsPage() {
/> />
</View> </View>
{weekCounts === undefined && <ActivityIndicator />}
{weekCounts?.length > 0 && ( {weekCounts?.length > 0 && (
<AppPieChart <AppPieChart
options={weekCounts.map((weekCount) => ({ options={weekCounts.map((weekCount) => ({
@ -163,6 +165,8 @@ export default function InsightsPage() {
/> />
</View> </View>
{hourCounts === undefined && <ActivityIndicator />}
{hourCounts?.length > 0 && ( {hourCounts?.length > 0 && (
<Chart <Chart
data={hourCounts.map((hc) => hc.count)} data={hourCounts.map((hc) => hc.count)}
@ -184,8 +188,8 @@ export default function InsightsPage() {
setShow={setShowWeek} setShow={setShowWeek}
onOk={() => setShowWeek(false)} onOk={() => setShowWeek(false)}
> >
If your plan expects an equal # of sets each day of the week, then this Are mondays your weak-spot? Find out here. This counts the # of sets you
pie graph should be evenly sliced. tend to do based on the day of the week.
</ConfirmDialog> </ConfirmDialog>
<ConfirmDialog <ConfirmDialog
@ -195,7 +199,8 @@ export default function InsightsPage() {
onOk={() => setShowHour(false)} onOk={() => setShowHour(false)}
> >
If you find yourself giving up on the gym after 5pm, consider starting If you find yourself giving up on the gym after 5pm, consider starting
earlier! Or vice-versa. earlier! Or vice-versa. This counts the # of sets you tend to do, based
on what time of day you began your workout.
</ConfirmDialog> </ConfirmDialog>
</> </>
); );