Revert "Show count when adding a new set"
This reverts commit 4aa91253a1
.
This commit is contained in:
parent
4aa91253a1
commit
d5c97b45b0
10
EditSet.tsx
10
EditSet.tsx
|
@ -21,20 +21,14 @@ export default function EditSet() {
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
getSettings().then(settings => {
|
|
||||||
let title = 'Edit set';
|
|
||||||
if (!params.set.id && params.set.name)
|
|
||||||
title = `Add set (${params.count} / ${settings.sets})`;
|
|
||||||
if (!params.set.id && !params.set.name) title = 'Add set';
|
|
||||||
navigation.getParent()?.setOptions({
|
navigation.getParent()?.setOptions({
|
||||||
headerLeft: () => (
|
headerLeft: () => (
|
||||||
<IconButton icon="arrow-back" onPress={() => navigation.goBack()} />
|
<IconButton icon="arrow-back" onPress={() => navigation.goBack()} />
|
||||||
),
|
),
|
||||||
headerRight: null,
|
headerRight: null,
|
||||||
title,
|
title: params.set.id ? 'Edit set' : 'Create set',
|
||||||
});
|
});
|
||||||
});
|
}, [navigation, params.set.id]),
|
||||||
}, [navigation, params]),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const startTimer = useCallback(async () => {
|
const startTimer = useCallback(async () => {
|
||||||
|
|
|
@ -13,7 +13,6 @@ export type HomePageParams = {
|
||||||
Sets: {};
|
Sets: {};
|
||||||
EditSet: {
|
EditSet: {
|
||||||
set: Set;
|
set: Set;
|
||||||
count: number;
|
|
||||||
workouts?: string[];
|
workouts?: string[];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,7 +21,6 @@ const limit = 15;
|
||||||
export default function SetList() {
|
export default function SetList() {
|
||||||
const [sets, setSets] = useState<Set[]>();
|
const [sets, setSets] = useState<Set[]>();
|
||||||
const [set, setSet] = useState<Set>();
|
const [set, setSet] = useState<Set>();
|
||||||
const [count, setCount] = useState(1);
|
|
||||||
const [workouts, setWorkouts] = useState<string[]>([]);
|
const [workouts, setWorkouts] = useState<string[]>([]);
|
||||||
const [offset, setOffset] = useState(0);
|
const [offset, setOffset] = useState(0);
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
|
@ -53,12 +52,11 @@ export default function SetList() {
|
||||||
let workout = todaysWorkouts[0];
|
let workout = todaysWorkouts[0];
|
||||||
console.log(`${SetList.name}.predict:`, {todaysSets, todaysWorkouts});
|
console.log(`${SetList.name}.predict:`, {todaysSets, todaysWorkouts});
|
||||||
if (todaysWorkouts.includes(todaysSets[0]?.name) && todaysSets.length > 0) {
|
if (todaysWorkouts.includes(todaysSets[0]?.name) && todaysSets.length > 0) {
|
||||||
const _count = todaysSets.filter(
|
const count = todaysSets.filter(
|
||||||
s => s.name === todaysSets[0].name,
|
s => s.name === todaysSets[0].name,
|
||||||
).length;
|
).length;
|
||||||
setCount(_count);
|
|
||||||
workout = todaysSets[0].name;
|
workout = todaysSets[0].name;
|
||||||
if (_count >= Number(settings.sets))
|
if (count >= Number(settings.sets))
|
||||||
workout =
|
workout =
|
||||||
todaysWorkouts[todaysWorkouts.indexOf(todaysSets[0].name!) + 1];
|
todaysWorkouts[todaysWorkouts.indexOf(todaysSets[0].name!) + 1];
|
||||||
}
|
}
|
||||||
|
@ -119,10 +117,9 @@ export default function SetList() {
|
||||||
const onAdd = useCallback(async () => {
|
const onAdd = useCallback(async () => {
|
||||||
navigation.navigate('EditSet', {
|
navigation.navigate('EditSet', {
|
||||||
set: set || {...defaultSet},
|
set: set || {...defaultSet},
|
||||||
count,
|
|
||||||
workouts,
|
workouts,
|
||||||
});
|
});
|
||||||
}, [navigation, set, workouts, count]);
|
}, [navigation, set, workouts]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user