Add copy feature for plans
Long tap an existing plan, then press copy. This will bring up a new plan to add with all the same workouts/days as the one you have copied.
This commit is contained in:
parent
ffbefe7a4f
commit
f91d529f39
36
PlanItem.tsx
36
PlanItem.tsx
|
@ -78,21 +78,27 @@ export default function PlanItem({
|
||||||
[item.workouts],
|
[item.workouts],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const copy = useCallback(() => {
|
||||||
|
const plan: Plan = {...item}
|
||||||
|
delete plan.id
|
||||||
|
setShow(false)
|
||||||
|
navigation.navigate('EditPlan', {plan})
|
||||||
|
}, [navigation, item])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<List.Item
|
||||||
<List.Item
|
onPress={start}
|
||||||
onPress={start}
|
title={title}
|
||||||
title={title}
|
description={description}
|
||||||
description={description}
|
onLongPress={longPress}
|
||||||
onLongPress={longPress}
|
right={() => (
|
||||||
right={() => (
|
<Menu anchor={anchor} visible={show} onDismiss={() => setShow(false)}>
|
||||||
<Menu anchor={anchor} visible={show} onDismiss={() => setShow(false)}>
|
<Menu.Item icon="edit" onPress={edit} title="Edit" />
|
||||||
<Menu.Item icon="edit" onPress={edit} title="Edit" />
|
<Menu.Item icon="content-copy" onPress={copy} title="Copy" />
|
||||||
<Divider />
|
<Divider />
|
||||||
<Menu.Item icon="delete" onPress={remove} title="Delete" />
|
<Menu.Item icon="delete" onPress={remove} title="Delete" />
|
||||||
</Menu>
|
</Menu>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user