Skip to content

Commit

Permalink
fixed variable naming per PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismcanulty committed Jul 10, 2023
1 parent 5e67672 commit f5bb203
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
12 changes: 7 additions & 5 deletions src/component/FavouriteTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export default function FavouriteTableRow({
return null;
}

const selectedFavouriteToken = token;

return (
<>
<DataTable.Row>
Expand Down Expand Up @@ -108,7 +106,7 @@ export default function FavouriteTableRow({
row,
index,
workoutId,
selectedFavouriteToken,
selectedFavouriteToken: token,
})
}>
<WorkoutIcon name={row.Completion} />
Expand All @@ -123,7 +121,7 @@ export default function FavouriteTableRow({
workoutId,
reps,
weight,
selectedFavouriteToken,
selectedFavouriteToken: token,
})
}>
{row.Edit ? (
Expand All @@ -136,7 +134,11 @@ export default function FavouriteTableRow({
<DataTable.Cell style={styles.cell}>
<TouchableOpacity
onPress={() =>
favouriteDeleteSet({index, workoutId, selectedFavouriteToken})
favouriteDeleteSet({
index,
workoutId,
selectedFavouriteToken: token,
})
}>
<WorkoutIcon name="trash" />
</TouchableOpacity>
Expand Down
18 changes: 3 additions & 15 deletions src/component/FavouriteWorkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,12 @@ export default function FavouriteWorkout({

const headers = ['Set', 'Reps', 'Weight', 'Done', 'Edit', 'Delete'];

const selectedFavouriteToken = token;

// need to pass down required props - token (favouriteWorkoutData is available from user context)

const saveFavouriteWorkoutData = async () => {
try {
const workoutJson = JSON.stringify(favouriteWorkoutData);

await AsyncStorage.setItem(`@workout_key-${token}`, workoutJson);
} catch (e) {
// saving error
}
};

if (favouriteExerciseData.length === 0 || favouriteWorkoutData.length === 0) {
return null;
}

// console.log('token', token);

return (
<ExerciseView borderBottom={isLastItem ? 1 : 0}>
<ExerciseTitleView>
Expand Down Expand Up @@ -176,7 +162,9 @@ export default function FavouriteWorkout({
/>
</DataTable>
<InfoButton
onPress={() => addFavouriteSet({workoutId, selectedFavouriteToken})}>
onPress={() =>
addFavouriteSet({workoutId, selectedFavouriteToken: token})
}>
<AddText>Add set</AddText>
<AddIcon name="plus" size={14} color={'rgb(169,169,169)'} />
</InfoButton>
Expand Down

0 comments on commit f5bb203

Please sign in to comment.