TeamDetail

alterações no screen eventDetail
This commit is contained in:
João Borges 2019-03-20 00:59:49 +00:00
parent bfe760d51b
commit a91654ba1c
2 changed files with 187 additions and 89 deletions

View File

@ -72,6 +72,131 @@ class eventDetail extends React.Component {
};
_renderRally = (info) => {
console.log(info)
return (
<View>
<View style={styles.header}>
<View
style={{
flexDirection: "row",
alignItems: "center",
alignSelf: "center"
}}
>
<View style={styles.leftRow}>
<Text style={{
margin: 10,
marginTop: 0,
marginBottom: 10,
fontSize: 20,
color: "#CC1A17" }}>
{info.location.nome}
</Text>
</View>
<View style={styles.timeText}>
<Text style={{color: "#CC1A17", fontSize: 15}}>
{info.hora}
</Text>
<Text>{info.horas}</Text>
</View>
</View>
<View>
<View style={{margin: 10}}>
<Text
style={{fontSize: 15, color: "#CC1A17", fontWeight: "bold"}}
>
Descrição:
</Text>
<Divider style={{backgroundColor: "#000"}}/>
<View style={{marginTop: 10}}>
<Text>{info.location.desc}</Text>
</View>
</View>
</View>
</View>
</View>
);
};
_renderEventDetail = (info) => {
return (
<View>
<View style={styles.header}>
<View
style={{
flexDirection: "row",
alignItems: "center",
alignSelf: "center"
}}
>
<View style={styles.timeText}>
<Text style={{color: "#CC1A17", fontSize: 15}}>
{info.hora}
</Text>
<Text>{info.horas}</Text>
</View>
</View>
<View>
<Text
style={{
margin: 10,
marginTop: 0,
marginBottom: 10,
fontSize: 20,
color: "#CC1A17"
}}
>
{info.nome}
</Text>
<View style={{margin: 10}}>
<Text
style={{fontSize: 15, color: "#CC1A17", fontWeight: "bold"}}
>
Descrição:
</Text>
<Divider style={{backgroundColor: "#000"}}/>
<View style={{marginTop: 10}}>
<Text>{info.desc}</Text>
</View>
<Text
style={{fontSize: 15, color: "#CC1A17", fontWeight: "bold", marginTop: 10}}
>
Como posso participar?
</Text>
<Divider style={{backgroundColor: "#000"}}/>
<View style={{marginTop: 10}}>
<Text>{info.notas}</Text>
</View>
<Text
style={{fontSize: 15, color: "#CC1A17", fontWeight: "bold", marginTop: 10}}
>
Qual é o custo de participação?
</Text>
<Divider style={{backgroundColor: "#000"}}/>
<View style={{marginTop: 10}}>
<Text>{info.custo}</Text>
</View>
</View>
</View>
</View>
</View>
);
};
_renderContainer = (info, eventType) => {
console.log("Estou aqui " + eventType)
if (eventType === "rally") {
return this._renderRally(info);
}
else if (eventType === undefined) {
return this._renderEventDetail(info);
}
};
constructor(props) {
super(props);
@ -82,7 +207,7 @@ class eventDetail extends React.Component {
render() {
const {navigation} = this.props;
const info = navigation.getParam("info", "error");
const eventType = navigation.getParam("type");
return (
<View style={styles.mainViewStyle}>
@ -100,69 +225,7 @@ class eventDetail extends React.Component {
</View>
</View>
</View>
<View>
<View style={styles.header}>
<View
style={{
flexDirection: "row",
alignItems: "center",
alignSelf: "center"
}}
>
<View style={styles.timeText}>
<Text style={{color: "#CC1A17", fontSize: 15}}>
{info.hora}
</Text>
<Text>{info.horas}</Text>
</View>
</View>
<View>
<Text
style={{
margin: 10,
marginBottom: 0,
marginTop: 0,
marginBottom: 10,
fontSize: 20,
color: "#CC1A17"
}}
>
{info.nome}
</Text>
<View style={{margin: 10}}>
<Text
style={{fontSize: 15, color: "#CC1A17", fontWeight: "bold"}}
>
Descrição:
</Text>
<Divider style={{backgroundColor: "#000"}}/>
<View style={{marginTop: 10}}>
<Text>{info.desc}</Text>
</View>
<Text
style={{fontSize: 15, color: "#CC1A17", fontWeight: "bold", marginTop: 10}}
>
Como posso participar?
</Text>
<Divider style={{backgroundColor: "#000"}}/>
<View style={{marginTop: 10}}>
<Text>{info.notas}</Text>
</View>
<Text
style={{fontSize: 15, color: "#CC1A17", fontWeight: "bold", marginTop: 10}}
>
Qual é o custo de participação?
</Text>
<Divider style={{backgroundColor: "#000"}}/>
<View style={{marginTop: 10}}>
<Text>{info.custo}</Text>
</View>
</View>
</View>
</View>
</View>
{this._renderContainer(info, eventType)}
</View>
<View style={styles.block}>
<Text

View File

@ -15,9 +15,10 @@ import {
ScrollView,
FlatList,
TouchableOpacity,
Image
Image, TextInput
} from "react-native";
import {TabView, TabBar, SceneMap} from "react-native-tab-view";
import {Icon} from 'react-native-elements';
import * as Actions from "../store/actions";
import {connect} from "react-redux";
@ -31,9 +32,16 @@ class teamDetail extends React.Component {
componentDidMount() {
this.props.getEventLocsVisited(this.props.team.id, this.props.internalToken);
console.log(this.props.locais);
}
_alterTeamName = () => {
};
render() {
const { navigate } = this.props.navigation;
return (
<ScrollView>
<View>
@ -41,54 +49,85 @@ class teamDetail extends React.Component {
<View style={{height: SCREEN_HEIGHT * 0.1, paddingBottom: 10}}>
<View style={styles.row}>
<View style={styles.leftRow}>
<Text style={[styles.headerText, {color: '#777'}]}>
NOME
<TextInput style={[styles.headerText, {height: '100%', color: '#777'}]}
value={this.props.team.nome}
/>
<Text onPress={this._alterTeamName} style={[styles.headerText, {
fontSize: 10, textDecorationLine: 'underline', alignSelf: "center",
alignContent: "center", paddingLeft: 10
}]}>
Alterar
</Text>
</View>
<View style={styles.rightRow}>
<Icon
name='md-trophy'
type='ionicon'
color='#CC1A17'
style={{
alignSelf: "center",
alignContent: "center"
}}
/>
<Text style={styles.headerText}>
Pontos
&nbsp; {this.props.team.pontos}
</Text>
</View>
</View>
</View>
<View style={{ paddingBottom: 10}}>
<View style={{paddingBottom: 10}}>
<View style={styles.row}>
{this.props.team.membros &&
<FlatList
data={this.props.team.membros}
numColumns={6} // Número de colunas
renderItem={({member}) =>
renderItem={({item}) => (
<View style={styles.memberImage}>
<Image
style={{width: 50, height: 50}}
source={require('../assets/logo_black.jpg')}
/>
style={{width: 50, height: 50}}
source={require('../assets/logo_black.jpg')}/>
<Text style={{
color: "#000"
}}>{item.fullName}</Text>
</View>
}
)}
/>}
</View>
</View>
<View style={{width: '100%', backgroundColor: 'red'}}>{
this.props.locais &&
<View style={{flex: 1, width: '100%',}}>
{this.props.locais &&
<FlatList
data={this.props.locais}
renderItem={({item}) => <Text>{item.location.nome}</Text>}
renderItem={({item}) => (
<TouchableOpacity onPress={() => navigate("eventDetail", {info: item, type: 'rally'})}>
<View style={styles.container}>
{/*Se bar estiver concluido, mostrar backgroundColor verde no container..*/}
<View style={{height: SCREEN_HEIGHT * 0.15, paddingBottom: 10}}>
<View style={styles.row}>
<View style={styles.leftRow}>
<Text>Foto Bar</Text>
</View>
<View style={styles.centerRow}>
<Text>{item.location.nome}</Text>
</View>
</View>
</View>
</View>
</TouchableOpacity>
)}
/>}
</View>
</View>
</View>
</ScrollView>
)
}
}
@ -118,7 +157,7 @@ const styles = StyleSheet.create({
},
headerText: {
fontSize: 25,
fontSize: 18,
color: "#CC1A17",
fontWeight: "bold",
},
@ -151,14 +190,10 @@ const styles = StyleSheet.create({
memberImage: {
flex: 1,
flexDirection: "row",
justifyContent: "flex-start",
alignSelf: "center",
marginRight: 4,
height: 50,
width: 50,
flexDirection: 'column',
alignItems: 'center',
backgroundColor: "transparent",
},
});