Skip to content

Commit

Permalink
Merge pull request #86 from CaronaBoard/portugues-please
Browse files Browse the repository at this point in the history
Finalizada versao alpha
  • Loading branch information
eduardomoroni committed Oct 3, 2017
2 parents 8b69b15 + 395ea9d commit 1602f8f
Show file tree
Hide file tree
Showing 28 changed files with 180 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ describe('<SignInFooter />', () => {
it('should navigate to password recovery screen', () => {
const forgotPasswordButton = wrapper.find(RkButton).findWhere(keyIsEqualTo('forgot-password-button'))
forgotPasswordButton.simulate('press')
expect(props.navigator.push).toHaveBeenCalledWith({ screen: screens.forgotPassword.id })
expect(props.navigator.push).toHaveBeenCalledWith({
screen: screens.forgotPassword.id, title: screens.forgotPassword.title
})
})

it('should navigate to signup screen', () => {
const forgotPasswordButton = wrapper.find(RkButton).findWhere(keyIsEqualTo('signup-button'))
forgotPasswordButton.simulate('press')
expect(props.navigator.push).toHaveBeenCalledWith({ screen: screens.forgotPassword.id })
expect(props.navigator.push).toHaveBeenCalledWith({
screen: screens.signUp.id, title: screens.signUp.title
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,24 @@ exports[`<LoginForm /> Should have a snapshot 1`] = `
<RkText
rkType="light h1"
>
Awesome Slogan
Seu carro não precisa
</RkText>
<RkText
rkType="light h1"
>
levar apenas você
</RkText>
</View>
<TextInput
autoCapitalize="none"
onChangeText={[Function]}
placeholder="Username"
placeholder="Email"
rkType="rounded"
/>
<TextInput
autoCapitalize="none"
onChangeText={[Function]}
placeholder="Password"
placeholder="Senha"
rkType="rounded"
secureTextEntry={true}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`<SignInFooter /> Should have a snapshot 1`] = `
<RkText
rkType="header6"
>
Forgot your password?
Esqueceu sua senha?
</RkText>
</RkButton>
</View>
Expand All @@ -32,7 +32,7 @@ exports[`<SignInFooter /> Should have a snapshot 1`] = `
<RkText
rkType="primary3"
>
Don’t have an account?
Ainda nāo tem conta?
</RkText>
<RkButton
onPress={[Function]}
Expand All @@ -41,7 +41,7 @@ exports[`<SignInFooter /> Should have a snapshot 1`] = `
<RkText
rkType="header6"
>
Sign up now
Cadastre-se
</RkText>
</RkButton>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`<SignInScreen /> Should have a snapshot 1`] = `
<LoginForm
buttonText="SIGN IN"
buttonText="ENTRAR"
footer={[Function]}
onButtonPress={[Function]}
toast={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`<SignUpScreen /> Should have a snapshot 1`] = `
<LoginForm
buttonText="SIGN UP"
buttonText="CADASTRE-SE"
footer={[Function]}
onButtonPress={[Function]}
toast={
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { shallow } from 'enzyme'
import { NewRideOffer, INITIAL_STATE } from '../../../../../src/modules/rideOffer/components/NewRideOffer'
import { Button } from '../../../../../src/modules/shared/components'
import { GradientButton } from '../../../../../src/modules/shared/components/GradientButton'

const props = {
onPress: jest.fn()
Expand All @@ -16,7 +16,7 @@ describe('<NewRideOffer />', () => {

it('Should call firebase service for create a ride offer', () => {
// TODO: I Think that' not a good idea calling services directly, we should use action
wrapper.find(Button).simulate('press')
wrapper.find(GradientButton).simulate('press')
const { origin, destination, days, hours } = INITIAL_STATE
expect(props.onPress).toHaveBeenCalledWith({ origin, destination, days, hours })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,43 @@ exports[`<NewRideOffer /> Should have a snapshot 1`] = `
<TextInput
autoCapitalize="none"
onChangeText={[Function]}
placeholder="ORIGIN"
placeholder="ORIGEM"
rkType="rounded"
/>
<TextInput
autoCapitalize="none"
onChangeText={[Function]}
placeholder="DESTINATION"
placeholder="DESTINO"
rkType="rounded"
/>
<TextInput
autoCapitalize="none"
onChangeText={[Function]}
placeholder="DAYS"
placeholder="DIAS"
rkType="rounded"
/>
<TextInput
autoCapitalize="none"
onChangeText={[Function]}
placeholder="HOUR"
placeholder="HORAS"
rkType="rounded"
/>
<View
style={
Object {
"alignItems": "center",
"flexDirection": "row",
"justifyContent": "center",
}
}
>
<GradientButton
onPress={[Function]}
rkType="large"
text="Oferecer carona"
/>
</View>
</View>
<Button
onPress={[Function]}
text="Offer Ride"
/>
</View>
</LoadingSpinnerView>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ exports[`<Button /> Should have a snapshot 1`] = `
}
onPress={[Function]}
rkType="circle outline medium"
style={
Object {
"alignSelf": "center",
}
}
>
texto
</RkButton>
Expand Down
7 changes: 4 additions & 3 deletions src/modules/authentication/components/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,22 @@ export class LoginForm extends React.Component {
<View style={styles.header}>
<Image style={styles.image} source={require('../../../assets/images/caronaboard-logo-azul.png')} />
<RkText rkType='logo h0'>Caronaboard</RkText>
<RkText rkType='light h1'>Awesome Slogan</RkText>
<RkText rkType='light h1'>Seu carro não precisa</RkText>
<RkText rkType='light h1'>levar apenas você</RkText>
</View>

<TextInput
onChangeText={(email) => { this.setState({email}) }}
key='email-input'
rkType='rounded'
placeholder='Username'
placeholder='Email'
autoCapitalize='none'
/>
<TextInput
onChangeText={(password) => { this.setState({password}) }}
key='password-input'
rkType='rounded'
placeholder='Password'
placeholder='Senha'
secureTextEntry
/>

Expand Down
12 changes: 6 additions & 6 deletions src/modules/authentication/components/SignInFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class SignInFooter extends Component {
navigator: PropTypes.object.isRequired
}

navigateTo = screen => () => this.props.navigator.push({screen})
navigateTo = screen => () => this.props.navigator.push({screen: screen.id, title: screen.title})

render () {
return (
Expand All @@ -20,19 +20,19 @@ export class SignInFooter extends Component {
<RkButton
key='forgot-password-button'
rkType='clear'
onPress={this.navigateTo(screens.forgotPassword.id)}
onPress={this.navigateTo(screens.forgotPassword)}
>
<RkText rkType='header6'>Forgot your password?</RkText>
<RkText rkType='header6'>Esqueceu sua senha?</RkText>
</RkButton>
</View>
<View style={Styles.textRow}>
<RkText rkType='primary3'>Don’t have an account?</RkText>
<RkText rkType='primary3'>Ainda nāo tem conta?</RkText>
<RkButton
key='signup-button'
rkType='clear'
onPress={this.navigateTo(screens.signUp.id)}
onPress={this.navigateTo(screens.signUp)}
>
<RkText rkType='header6'> Sign up now</RkText>
<RkText rkType='header6'> Cadastre-se</RkText>
</RkButton>
</View>
</View>
Expand Down
5 changes: 2 additions & 3 deletions src/modules/authentication/containers/ForgotPasswordScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,21 @@ export class ForgotPasswordScreen extends Component {
<View style={styles.header}>
<Image style={styles.image} source={require('../../../assets/images/caronaboard-logo-azul.png')} />
<RkText rkType='logo h0'>Caronaboard</RkText>
<RkText rkType='light h1'>Awesome Slogan</RkText>
</View>

<RkTextInput
onChangeText={(email) => { this.setState({email}) }}
key='email-input'
rkType='rounded'
placeholder='Username'
placeholder='Email'
autoCapitalize='none'
value={this.state.email}
/>
<View style={styles.centralized}>
<GradientButton
rkType='large'
style={styles.loginButton}
text='Send'
text='Redefinir senha'
onPress={() => resetPassword(this.state.email)}
/>
</View>
Expand Down
66 changes: 35 additions & 31 deletions src/modules/authentication/containers/ProfileScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ProfilePropType } from '../types'

import { TextInput, GradientButton } from '../../shared/components'
import { saveProfileFirebase } from '../../../redux/actions'
import { LoadingSpinnerView } from '../../shared/components/LoadingSpinnerView'

export const CONTACT_OPTIONS = ['Whatsapp', 'Telegram']
export const INITIAL_STATE: ProfileType = {
Expand Down Expand Up @@ -43,7 +44,8 @@ export class ProfileScreen extends Component {
this.setState({loading: true})

try {
this.props.saveProfile(this.state.profile)
await this.props.saveProfile(this.state.profile)
alert('Perfil Atualizado com sucesso!')
} catch (error) {
console.error(error)
}
Expand Down Expand Up @@ -72,40 +74,42 @@ export class ProfileScreen extends Component {
const { contact, name } = profile

return (
<View style={Styles.flexible}>
<View style={Styles.container}>
<RkText style={Styles.title}>
PROFILE
</RkText>
<View style={Styles.inputTextsContainer}>
<TextInput
placeholder='Your name'
value={name}
onChangeText={name => { this.setState({profile: {...profile, name}}) }}
/>
<LoadingSpinnerView isLoading={this.state.loading} style={Styles.flexible}>
<View style={Styles.flexible}>
<View style={Styles.container}>
<RkText style={Styles.title}>
PROFILE
</RkText>
<View style={Styles.inputTextsContainer}>
<TextInput
placeholder='Seu nome'
value={name}
onChangeText={name => { this.setState({profile: {...profile, name}}) }}
/>
</View>
<RkChoiceGroup
radio
rkType='clear'
onChange={index => this.onContactOptionSelected(CONTACT_OPTIONS[index])}>
{CONTACT_OPTIONS.map(this.renderOption)}
</RkChoiceGroup>
<View style={Styles.inputTextsContainer}>
<TextInput
placeholder='Número'
value={contact.value}
onChangeText={value => { this.setState({profile: {...profile, contact: {...contact, value}}}) }}
/>
</View>
</View>
<RkChoiceGroup
radio
rkType='clear'
onChange={index => this.onContactOptionSelected(CONTACT_OPTIONS[index])}>
{CONTACT_OPTIONS.map(this.renderOption)}
</RkChoiceGroup>
<View style={Styles.inputTextsContainer}>
<TextInput
placeholder='Number'
value={contact.value}
onChangeText={value => { this.setState({profile: {...profile, contact: {...contact, value}}}) }}
<View style={Styles.centralized}>
<GradientButton
rkType='large'
text={'SAVE'}
onPress={this.onButtonSubmit}
/>
</View>
</View>
<View style={Styles.centralized}>
<GradientButton
rkType='large'
text={'SAVE'}
onPress={this.onButtonSubmit}
/>
</View>
</View>
</LoadingSpinnerView>
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/authentication/containers/SignInScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class SignInScreen extends Component {
render () {
return (
<LoginForm
buttonText='SIGN IN'
buttonText='ENTRAR'
onButtonPress={this.onPress}
toast={this.props.alert}
footer={this.renderFooter}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/authentication/containers/SignUpScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class SignUpScreen extends Component {
<LoginForm
onButtonPress={this.props.signUp}
toast={this.props.alert}
buttonText='SIGN UP'
buttonText='CADASTRE-SE'
/>
)
}
Expand Down
Loading

0 comments on commit 1602f8f

Please sign in to comment.