Handle fresh user experience better for Plans - 2.9 🚀
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.
This commit is contained in:
parent
81421e5be7
commit
5a3b926dcf
24
EditPlan.tsx
24
EditPlan.tsx
|
@ -12,7 +12,12 @@ import {
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
View,
|
View,
|
||||||
} from "react-native";
|
} 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 AppInput from "./AppInput";
|
||||||
import { StackParams } from "./AppStack";
|
import { StackParams } from "./AppStack";
|
||||||
import PrimaryButton from "./PrimaryButton";
|
import PrimaryButton from "./PrimaryButton";
|
||||||
|
@ -23,6 +28,7 @@ import { DAYS } from "./days";
|
||||||
import { planRepo, setRepo } from "./db";
|
import { planRepo, setRepo } from "./db";
|
||||||
import { DrawerParams } from "./drawer-params";
|
import { DrawerParams } from "./drawer-params";
|
||||||
import GymSet, { defaultSet } from "./gym-set";
|
import GymSet, { defaultSet } from "./gym-set";
|
||||||
|
import { toast } from "./toast";
|
||||||
|
|
||||||
export default function EditPlan() {
|
export default function EditPlan() {
|
||||||
const { params } = useRoute<RouteProp<StackParams, "EditPlan">>();
|
const { params } = useRoute<RouteProp<StackParams, "EditPlan">>();
|
||||||
|
@ -62,12 +68,13 @@ export default function EditPlan() {
|
||||||
if (!days || !exercises) return;
|
if (!days || !exercises) return;
|
||||||
const newExercises = exercises.filter((exercise) => exercise).join(",");
|
const newExercises = exercises.filter((exercise) => exercise).join(",");
|
||||||
const newDays = days.filter((day) => day).join(",");
|
const newDays = days.filter((day) => day).join(",");
|
||||||
await planRepo.save({
|
const saved = await planRepo.save({
|
||||||
title: title,
|
title: title,
|
||||||
days: newDays,
|
days: newDays,
|
||||||
exercises: newExercises,
|
exercises: newExercises,
|
||||||
id: plan.id,
|
id: plan.id,
|
||||||
});
|
});
|
||||||
|
if (saved.id === 1) toast("Tap your plan again to begin using it");
|
||||||
}, [title, days, exercises, plan]);
|
}, [title, days, exercises, plan]);
|
||||||
|
|
||||||
const toggleExercise = useCallback(
|
const toggleExercise = useCallback(
|
||||||
|
@ -185,6 +192,19 @@ export default function EditPlan() {
|
||||||
{exercises.map((exercise, index) =>
|
{exercises.map((exercise, index) =>
|
||||||
renderExercise(exercise, index, true)
|
renderExercise(exercise, index, true)
|
||||||
)}
|
)}
|
||||||
|
{names?.length === 0 && (
|
||||||
|
<>
|
||||||
|
<Text>No exercises yet.</Text>
|
||||||
|
<Button
|
||||||
|
onPress={() =>
|
||||||
|
stackNavigate("EditExercise", { gymSet: defaultSet })
|
||||||
|
}
|
||||||
|
style={{ alignSelf: "flex-start" }}
|
||||||
|
>
|
||||||
|
Add some?
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{names !== undefined &&
|
{names !== undefined &&
|
||||||
names
|
names
|
||||||
.filter((name) => !exercises.includes(name))
|
.filter((name) => !exercises.includes(name))
|
||||||
|
|
|
@ -85,8 +85,8 @@ android {
|
||||||
applicationId "com.massive"
|
applicationId "com.massive"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 36223
|
versionCode 36224
|
||||||
versionName "2.8"
|
versionName "2.9"
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "massive",
|
"name": "massive",
|
||||||
"version": "2.8",
|
"version": "2.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue