Set default set to 10x20kg
I want the default set to be the most common set a person might do as a warm-up. 10x20kg might be a warmup for deadlifts where you are just lifting the bar. Same goes for squats, romanian deadlifts or rows.
This commit is contained in:
parent
1ce9a49224
commit
37803ad0d4
23
SetList.tsx
23
SetList.tsx
|
@ -16,6 +16,13 @@ import SetItem from './SetItem';
|
||||||
import {DAYS} from './time';
|
import {DAYS} from './time';
|
||||||
|
|
||||||
const limit = 15;
|
const limit = 15;
|
||||||
|
const defaultSet = {
|
||||||
|
name: '',
|
||||||
|
id: 0,
|
||||||
|
reps: 10,
|
||||||
|
weight: 20,
|
||||||
|
unit: 'kg',
|
||||||
|
};
|
||||||
|
|
||||||
export default function SetList() {
|
export default function SetList() {
|
||||||
const [sets, setSets] = useState<Set[]>();
|
const [sets, setSets] = useState<Set[]>();
|
||||||
|
@ -87,13 +94,7 @@ export default function SetList() {
|
||||||
GROUP BY name;
|
GROUP BY name;
|
||||||
`;
|
`;
|
||||||
const [weightResult] = await db.executeSql(bestWeight, [query]);
|
const [weightResult] = await db.executeSql(bestWeight, [query]);
|
||||||
if (!weightResult.rows.length)
|
if (!weightResult.rows.length) return {...defaultSet};
|
||||||
return {
|
|
||||||
weight: 0,
|
|
||||||
name: '',
|
|
||||||
reps: 0,
|
|
||||||
id: 0,
|
|
||||||
};
|
|
||||||
const [repsResult] = await db.executeSql(bestReps, [
|
const [repsResult] = await db.executeSql(bestReps, [
|
||||||
query,
|
query,
|
||||||
weightResult.rows.item(0).weight,
|
weightResult.rows.item(0).weight,
|
||||||
|
@ -165,13 +166,7 @@ export default function SetList() {
|
||||||
}, [search, end, offset, sets, db, selectSets]);
|
}, [search, end, offset, sets, db, selectSets]);
|
||||||
|
|
||||||
const onAdd = useCallback(async () => {
|
const onAdd = useCallback(async () => {
|
||||||
const set: Set = {
|
const set: Set = {...defaultSet};
|
||||||
name: '',
|
|
||||||
id: 0,
|
|
||||||
reps: 5,
|
|
||||||
weight: 1,
|
|
||||||
unit: 'kg',
|
|
||||||
};
|
|
||||||
navigation.navigate('EditSet', {set: nextSet || set});
|
navigation.navigate('EditSet', {set: nextSet || set});
|
||||||
}, [navigation, nextSet]);
|
}, [navigation, nextSet]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user