Rename some variables in EditSet
Not sure if I like the look of variables starting with underscores. Perhaps the only use of this would be to prevent editor warnings for unused variables.
This commit is contained in:
parent
a530b563b9
commit
9d42760dff
28
EditSet.tsx
28
EditSet.tsx
|
@ -38,10 +38,10 @@ export default function EditSet() {
|
||||||
}, [navigation, set, count]),
|
}, [navigation, set, count]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const startTimer = useCallback(async (_set: Set) => {
|
const startTimer = useCallback(async (value: Set) => {
|
||||||
if (!settings.alarm) return;
|
if (!settings.alarm) return;
|
||||||
const milliseconds =
|
const milliseconds =
|
||||||
Number(_set.minutes) * 60 * 1000 + Number(_set.seconds) * 1000;
|
Number(value.minutes) * 60 * 1000 + Number(value.seconds) * 1000;
|
||||||
NativeModules.AlarmModule.timer(
|
NativeModules.AlarmModule.timer(
|
||||||
milliseconds,
|
milliseconds,
|
||||||
!!settings.vibrate,
|
!!settings.vibrate,
|
||||||
|
@ -54,23 +54,23 @@ export default function EditSet() {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const update = useCallback(
|
const update = useCallback(
|
||||||
async (_set: Set) => {
|
async (value: Set) => {
|
||||||
console.log(`${EditSet.name}.update`, _set);
|
console.log(`${EditSet.name}.update`, value);
|
||||||
await updateSet(_set);
|
await updateSet(value);
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
},
|
},
|
||||||
[navigation],
|
[navigation],
|
||||||
);
|
);
|
||||||
|
|
||||||
const add = useCallback(
|
const add = useCallback(
|
||||||
async (_set: Set) => {
|
async (value: Set) => {
|
||||||
console.log(`${EditSet.name}.add`, {set: _set});
|
console.log(`${EditSet.name}.add`, {set: value});
|
||||||
startTimer(_set);
|
startTimer(value);
|
||||||
await addSet(_set);
|
await addSet(value);
|
||||||
if (!settings.notify) return navigation.goBack();
|
if (!settings.notify) return navigation.goBack();
|
||||||
if (
|
if (
|
||||||
_set.weight > set.weight ||
|
value.weight > set.weight ||
|
||||||
(_set.reps > set.reps && _set.weight === set.weight)
|
(value.reps > set.reps && value.weight === set.weight)
|
||||||
)
|
)
|
||||||
toast("Great work King, that's a new record!", 3000);
|
toast("Great work King, that's a new record!", 3000);
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
|
@ -79,9 +79,9 @@ export default function EditSet() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const save = useCallback(
|
const save = useCallback(
|
||||||
async (_set: Set) => {
|
async (value: Set) => {
|
||||||
if (typeof set.id === 'number') return update(_set);
|
if (typeof set.id === 'number') return update(value);
|
||||||
return add(_set);
|
return add(value);
|
||||||
},
|
},
|
||||||
[update, add, set.id],
|
[update, add, set.id],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user