From 805f982ccfc45ff4492cb037e55ef54dbe0f6db9 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Tue, 24 Oct 2023 16:23:07 +1300 Subject: [PATCH] =?UTF-8?q?Add=20graph=20button=20to=20start=20plan=20-=20?= =?UTF-8?q?1.164=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GraphsList.tsx | 2 +- GraphsPage.tsx | 3 +-- StartPlan.tsx | 2 +- StartPlanItem.tsx | 15 ++++++++++++++- ViewGraph.tsx | 6 +++--- android/app/build.gradle | 4 ++-- package.json | 2 +- 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/GraphsList.tsx b/GraphsList.tsx index 6819000..657462b 100644 --- a/GraphsList.tsx +++ b/GraphsList.tsx @@ -66,7 +66,7 @@ export default function GraphsList() { key={item.name} title={item.name} description={`${item.reps} x ${item.weight}${item.unit || "kg"}`} - onPress={() => navigation.navigate("ViewGraph", { best: item })} + onPress={() => navigation.navigate("ViewGraph", { name: item.name })} left={() => (settings?.images && item.image && ( (); export type GraphsPageParams = { GraphsList: {}; ViewGraph: { - best: GymSet; + name: string; }; }; diff --git a/StartPlan.tsx b/StartPlan.tsx index aadb5ee..50be86b 100644 --- a/StartPlan.tsx +++ b/StartPlan.tsx @@ -10,7 +10,7 @@ import { FlatList, NativeModules, TextInput, View } from "react-native"; import { Button, IconButton, ProgressBar } from "react-native-paper"; import AppInput from "./AppInput"; import { getBestSet } from "./best.service"; -import { MARGIN, PADDING } from "./constants"; +import { PADDING } from "./constants"; import CountMany from "./count-many"; import { AppDataSource } from "./data-source"; import { getNow, setRepo, settingsRepo } from "./db"; diff --git a/StartPlanItem.tsx b/StartPlanItem.tsx index bcc8fba..905b316 100644 --- a/StartPlanItem.tsx +++ b/StartPlanItem.tsx @@ -6,6 +6,7 @@ import { Like } from "typeorm"; import CountMany from "./count-many"; import { getNow, setRepo } from "./db"; import { emitter } from "./emitter"; +import { GraphsPageParams } from "./GraphsPage"; import { GYM_SET_DELETED } from "./gym-set"; import { HomePageParams } from "./home-page-params"; import { PlanPageParams } from "./plan-page-params"; @@ -25,6 +26,8 @@ export default function StartPlanItem(props: Props) { const { navigate } = useNavigation>(); const { navigate: navigateHome } = useNavigation>(); + const { navigate: navigateGraph } = + useNavigation>(); const undo = useCallback(async () => { const now = await getNow(); @@ -73,6 +76,11 @@ export default function StartPlanItem(props: Props) { navigateHome("Sets", { search: item.name }); }, [item.name, navigateHome]); + const graph = useCallback(() => { + setShowMenu(false); + navigateGraph("ViewGraph", { name: item.name }); + }, [item.name, navigateGraph]); + const left = useCallback( () => ( @@ -101,12 +109,17 @@ export default function StartPlanItem(props: Props) { onDismiss={() => setShowMenu(false)} > + ), - [anchor, showMenu, edit, undo, view] + [anchor, showMenu, edit, undo, view, graph] ); return ( diff --git a/ViewGraph.tsx b/ViewGraph.tsx index 93ffe90..035d96b 100644 --- a/ViewGraph.tsx +++ b/ViewGraph.tsx @@ -34,7 +34,7 @@ export default function ViewGraph() { .createQueryBuilder() .select("STRFTIME('%Y-%m-%d', created)", "created") .addSelect("unit") - .where("name = :name", { name: params.best.name }) + .where("name = :name", { name: params.name }) .andWhere("NOT hidden") .andWhere("DATE(created) >= DATE('now', 'weekday 0', :difference)", { difference, @@ -67,7 +67,7 @@ export default function ViewGraph() { setWeights(newWeights); }); } - }, [params.best.name, metric, period]); + }, [params.name, metric, period]); const charts = useMemo(() => { if ( @@ -108,7 +108,7 @@ export default function ViewGraph() { return ( <> - + captureScreen().then(async (uri) => { diff --git a/android/app/build.gradle b/android/app/build.gradle index b556d43..cdb5d2f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -85,8 +85,8 @@ android { applicationId "com.massive" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 36189 - versionName "1.163" + versionCode 36190 + versionName "1.164" } signingConfigs { release { diff --git a/package.json b/package.json index c252532..af01c0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "massive", - "version": "1.163", + "version": "1.164", "private": true, "license": "GPL-3.0-only", "scripts": {