From 5a3b926dcf4fa98c4fbdc8cc197e38effedaea89 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Wed, 29 Nov 2023 09:38:56 +1300 Subject: [PATCH] =?UTF-8?q?Handle=20fresh=20user=20experience=20better=20f?= =?UTF-8?q?or=20Plans=20-=202.9=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add a button to insert some Exercises if none exist 2. Show a toast for the first plan, explaining you should tap it to begin the plan. --- EditPlan.tsx | 24 ++++++++++++++++++++++-- android/app/build.gradle | 4 ++-- package.json | 2 +- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/EditPlan.tsx b/EditPlan.tsx index 30357b0..2f24349 100644 --- a/EditPlan.tsx +++ b/EditPlan.tsx @@ -12,7 +12,12 @@ import { StyleSheet, View, } from "react-native"; -import { IconButton, Switch as PaperSwitch, Text } from "react-native-paper"; +import { + Button, + IconButton, + Switch as PaperSwitch, + Text, +} from "react-native-paper"; import AppInput from "./AppInput"; import { StackParams } from "./AppStack"; import PrimaryButton from "./PrimaryButton"; @@ -23,6 +28,7 @@ import { DAYS } from "./days"; import { planRepo, setRepo } from "./db"; import { DrawerParams } from "./drawer-params"; import GymSet, { defaultSet } from "./gym-set"; +import { toast } from "./toast"; export default function EditPlan() { const { params } = useRoute>(); @@ -62,12 +68,13 @@ export default function EditPlan() { if (!days || !exercises) return; const newExercises = exercises.filter((exercise) => exercise).join(","); const newDays = days.filter((day) => day).join(","); - await planRepo.save({ + const saved = await planRepo.save({ title: title, days: newDays, exercises: newExercises, id: plan.id, }); + if (saved.id === 1) toast("Tap your plan again to begin using it"); }, [title, days, exercises, plan]); const toggleExercise = useCallback( @@ -185,6 +192,19 @@ export default function EditPlan() { {exercises.map((exercise, index) => renderExercise(exercise, index, true) )} + {names?.length === 0 && ( + <> + No exercises yet. + + + )} {names !== undefined && names .filter((name) => !exercises.includes(name)) diff --git a/android/app/build.gradle b/android/app/build.gradle index e6c6095..b809713 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 36223 - versionName "2.8" + versionCode 36224 + versionName "2.9" } signingConfigs { release { diff --git a/package.json b/package.json index cfa6ce6..3c9e65b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "massive", - "version": "2.8", + "version": "2.9", "private": true, "license": "GPL-3.0-only", "scripts": {