From bc3a39c4b6f2cd37265c8d693db6a5a112d5a2aa Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Wed, 24 Aug 2022 15:36:49 +1200 Subject: [PATCH] Show list of current workouts when adding set --- EditSet.tsx | 2 +- HomePage.tsx | 2 +- SetForm.tsx | 17 +++++++++++++---- SetList.tsx | 8 ++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/EditSet.tsx b/EditSet.tsx index 83d4310..a2940c5 100644 --- a/EditSet.tsx +++ b/EditSet.tsx @@ -78,7 +78,7 @@ export default function EditSet() { return ( - + ); } diff --git a/HomePage.tsx b/HomePage.tsx index b0acf86..7198fa7 100644 --- a/HomePage.tsx +++ b/HomePage.tsx @@ -13,7 +13,7 @@ export type HomePageParams = { Sets: {}; EditSet: { set: Set; - next?: string; + workouts?: string[]; }; }; diff --git a/SetForm.tsx b/SetForm.tsx index f7bf32f..9afbe19 100644 --- a/SetForm.tsx +++ b/SetForm.tsx @@ -6,11 +6,11 @@ import Set from './set'; export default function SetForm({ save, set, - next, + workouts, }: { set: Set; save: (set: Set) => void; - next?: string; + workouts?: string[]; }) { const [name, setName] = useState(set.name); const [reps, setReps] = useState(set.reps.toString()); @@ -81,10 +81,19 @@ export default function SetForm({ /> {set.created && ( - Created: {set.created?.replace('T', ' ')} + {set.created.replace('T', ' ')} )} - {next && Next: {next}} + + {workouts?.map((workout, index) => ( + + {workout} + {index === workouts.length - 1 ? '.' : ', '} + + ))} +