-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(StarterRecommendation): criando tela de recomendações
- Loading branch information
1 parent
b5fd680
commit ad637f2
Showing
6 changed files
with
133 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,52 @@ | ||
[ | ||
{ | ||
"id":"123", | ||
"name":"Treino Iniciante A", | ||
"exercises":[ | ||
{"id":1, "name":"Supino Inclinado", "muscle":"chest", "sets":"3", "reps":"10", "load":"20"}, | ||
{"id":2, "name":"Ex 2", "muscle":"biceps", "sets":"2", "reps":"12", "load":"10"} | ||
"id": "123", | ||
"name": "Treino Iniciante A", | ||
"exercises": [ | ||
{ | ||
"id": 1, | ||
"name": "Supino Inclinado", | ||
"muscle": "chest", | ||
"sets": "3", | ||
"reps": "10", | ||
"load": "20" | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "Ex 2", | ||
"muscle": "biceps", | ||
"sets": "2", | ||
"reps": "12", | ||
"load": "10" | ||
} | ||
] | ||
}, | ||
{ | ||
"id":"456", | ||
"name":"Treino Iniciante B", | ||
"exercises":[ | ||
{"id":1, "name":"Supino Inclinado", "muscle":"chest", "sets":"3", "reps":"10", "load":"20"} | ||
"id": "456", | ||
"name": "Treino Iniciante B", | ||
"exercises": [ | ||
{ | ||
"id": 1, | ||
"name": "Supino Inclinado", | ||
"muscle": "chest", | ||
"sets": "3", | ||
"reps": "10", | ||
"load": "20" | ||
} | ||
] | ||
}, | ||
{ | ||
"id":"645", | ||
"name":"Treino Iniciante C", | ||
"exercises":[ | ||
{"id":1, "name":"Supino Inclinado", "muscle":"chest", "sets":"3", "reps":"10", "load":"20"} | ||
"id": "645", | ||
"name": "Treino Iniciante C", | ||
"exercises": [ | ||
{ | ||
"id": 1, | ||
"name": "Supino Inclinado", | ||
"muscle": "chest", | ||
"sets": "3", | ||
"reps": "10", | ||
"load": "20" | ||
} | ||
] | ||
} | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import {useNavigation} from '@react-navigation/native'; | ||
import React, {useEffect, useLayoutEffect} from 'react'; | ||
import {Text} from 'react-native'; | ||
import {useSelector} from 'react-redux'; | ||
import {NextButton} from '../../components/NextButton'; | ||
import {Container, HeaderSubtext, HeaderText, WorkoutList} from './styles'; | ||
import presetWorkouts from '../../presetWorkouts.json'; | ||
|
||
export function StarterRecommendations() { | ||
const navigation = useNavigation(); | ||
//@ts-ignore | ||
const {myWorkouts} = useSelector(state => state.user); | ||
|
||
useEffect(() => { | ||
navigation.setParams({ | ||
myWorkouts, | ||
}); | ||
}, [myWorkouts]); | ||
|
||
useLayoutEffect(() => { | ||
navigation.setOptions({ | ||
title: '', | ||
headerRight: () => ( | ||
<NextButton | ||
title={myWorkouts.length > 0 ? 'Concluir' : 'Ignorar'} | ||
onPress={handleSubmit} | ||
/> | ||
), | ||
headerRightContainerStyle: { | ||
marginRight: 10, | ||
}, | ||
}); | ||
}, []); | ||
|
||
function handleSubmit() {} | ||
|
||
return ( | ||
<Container> | ||
<HeaderText> | ||
Opções de treino pré-criados com base no seu nível. | ||
</HeaderText> | ||
<HeaderSubtext>Você selecionou {myWorkouts.length} treinos</HeaderSubtext> | ||
<WorkoutList | ||
data={presetWorkouts} | ||
renderItem={({item}: any) => <Text>{item.name}</Text>} | ||
/> | ||
</Container> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import styled from 'styled-components/native'; | ||
|
||
export const Container = styled.SafeAreaView` | ||
flex: 1; | ||
align-items: center; | ||
background-color: #fff; | ||
padding: 0 30px; | ||
`; | ||
|
||
export const HeaderText = styled.Text` | ||
font-size: 16px; | ||
color: #333; | ||
margin: 50px auto 30px; | ||
`; | ||
|
||
export const HeaderSubtext = styled(HeaderText)` | ||
margin: 0px auto 30px; | ||
`; | ||
|
||
export const BoldText = styled.Text` | ||
font-weight: bold; | ||
`; | ||
|
||
export const DaysArea = styled.View` | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
justify-content: space-between; | ||
`; | ||
|
||
export const WorkoutList = styled.FlatList` | ||
width: 100%; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters