moment dependencia
This commit is contained in:
parent
094b5ee5bb
commit
338bee8192
188
App/app/App.js
188
App/app/App.js
|
@ -1,14 +1,13 @@
|
||||||
|
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Platform, StyleSheet, Text, View, StatusBar,Dimensions,Image,ActivityIndicator} from 'react-native';
|
import {Platform, StyleSheet, Text, View, StatusBar, Dimensions, Image, ActivityIndicator} from 'react-native';
|
||||||
|
|
||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
|
||||||
import QRCodeScanner from 'react-native-qrcode-scanner';
|
import QRCodeScanner from 'react-native-qrcode-scanner';
|
||||||
import {UtilStyles} from './assets/styles'
|
import {UtilStyles} from './assets/styles'
|
||||||
import * as Actions from './actions'; //Import your actions
|
import * as Actions from './actions'; //Import your actions
|
||||||
import {RkButton, RkTheme , RkText} from 'react-native-ui-kitten';
|
import {RkButton, RkTheme, RkText} from 'react-native-ui-kitten';
|
||||||
|
|
||||||
import Router from './Router'
|
import Router from './Router'
|
||||||
|
|
||||||
|
@ -16,140 +15,130 @@ const SCREEN_HEIGHT = Dimensions.get("window").height;
|
||||||
const SCREEN_WIDTH = Dimensions.get("window").width;
|
const SCREEN_WIDTH = Dimensions.get("window").width;
|
||||||
|
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
|
||||||
token:{valid:false},
|
token: {valid: false},
|
||||||
tokenData: '',
|
tokenData: '',
|
||||||
onHold: true,
|
onHold: true,
|
||||||
logged:false
|
logged: false
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
//verifica se o utilizador tem token guardado
|
//verifica se o utilizador tem token guardado
|
||||||
this.props.checkUser();
|
this.props.checkUser();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSuccess = (e) => {
|
onSuccess = (e) => {
|
||||||
|
|
||||||
|
|
||||||
this.props.login(e.data,'80f3b6e5');
|
this.props.login(e.data, '80f3b6e5');
|
||||||
console.log("tentativa de login");
|
console.log("tentativa de login");
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
if(this.props.onHold && !this.props.logged){
|
|
||||||
|
|
||||||
|
if (this.props.onHold && !this.props.logged) {
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<View style={UtilStyles.containerLoading}>
|
||||||
<View>
|
<Text>CARREGANDO {this.props.onHold}</Text>
|
||||||
<Text>CARREGANDO {this.props.onHold}</Text>
|
<ActivityIndicator size="large" color="#0000ff"/>
|
||||||
<ActivityIndicator size="large" color="#0000ff" />
|
|
||||||
</View>
|
</View>
|
||||||
|
)
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
//console.log('token... '+ this.props.logged)
|
//console.log('token... '+ this.props.logged)
|
||||||
|
|
||||||
//se existir token
|
//se existir token
|
||||||
|
|
||||||
|
|
||||||
if(this.props.logged){
|
if (this.props.logged) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<Router></Router>
|
<Router></Router>
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
|
|
||||||
//se não existir vai para o ecrã de scan QR
|
//se não existir vai para o ecrã de scan QR
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<QRCodeScanner
|
<QRCodeScanner
|
||||||
|
|
||||||
showMarker
|
showMarker
|
||||||
reactivate={true}
|
reactivate={true}
|
||||||
onRead={this.onSuccess.bind(this)}
|
onRead={this.onSuccess.bind(this)}
|
||||||
cameraStyle={{ height: SCREEN_HEIGHT }}
|
cameraStyle={{height: SCREEN_HEIGHT}}
|
||||||
|
|
||||||
customMarker={
|
customMarker={
|
||||||
|
|
||||||
<View style={styles.rectangleContainer}>
|
|
||||||
<View style={styles.logo}>
|
|
||||||
<Image style={UtilStyles.loginImage}
|
|
||||||
source={require('./assets/img/logo.png')}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
|
|
||||||
<View style={{ flexDirection: "row" }}>
|
<View style={styles.rectangleContainer}>
|
||||||
<View style={styles.leftAndRightOverlay}>
|
<View style={styles.logo}>
|
||||||
|
<Image style={UtilStyles.loginImage}
|
||||||
|
source={require('./assets/img/logo.png')}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
|
||||||
|
<View style={{flexDirection: "row"}}>
|
||||||
|
<View style={styles.leftAndRightOverlay}>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.rectangle}>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
|
||||||
|
|
||||||
|
<View style={styles.leftAndRightOverlay}>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={styles.bottomOverlay}>
|
||||||
|
|
||||||
|
<View style={{flex: 1, alignItems: 'center', alignContent: 'center'}}>
|
||||||
|
|
||||||
|
<RkText rkType='primary' style={styles.recover}>Recuperar pin de acesso</RkText>
|
||||||
|
<RkButton rkType='dark' style={styles.manual}>lols</RkButton>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<View style={styles.rectangle}>
|
)
|
||||||
|
|
||||||
</View>
|
|
||||||
|
|
||||||
|
|
||||||
<View style={styles.leftAndRightOverlay}>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View style={styles.bottomOverlay}>
|
|
||||||
|
|
||||||
<View style={{flex:1, alignItems: 'center', alignContent: 'center'}}>
|
|
||||||
|
|
||||||
<RkText rkType='primary' style={styles.recover}>Recuperar pin de acesso</RkText>
|
|
||||||
<RkButton rkType='dark' style={styles.manual}>lols</RkButton>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
}
|
}
|
||||||
/>
|
}
|
||||||
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RkTheme.setType('RkButton', 'dark', {
|
RkTheme.setType('RkButton', 'dark', {
|
||||||
container: {
|
container: {
|
||||||
paddingTop:10,
|
paddingTop: 10,
|
||||||
backgroundColor: 'gray',
|
backgroundColor: 'gray',
|
||||||
|
|
||||||
borderRadius: 90,
|
borderRadius: 90,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a 393 device width
|
const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a 393 device width
|
||||||
|
@ -157,35 +146,31 @@ const rectDimensions = SCREEN_WIDTH * 0.85; // this is equivalent to 255 from a
|
||||||
const overlayColor = 'rgba(0,0,0,0.30)';
|
const overlayColor = 'rgba(0,0,0,0.30)';
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
|
|
||||||
recover:{
|
recover: {
|
||||||
paddingTop:10,
|
paddingTop: 10,
|
||||||
color: "red",
|
color: "red",
|
||||||
paddingBottom:10
|
paddingBottom: 10
|
||||||
},
|
},
|
||||||
manual:{
|
manual: {},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
logo: {
|
||||||
|
|
||||||
logo:{
|
|
||||||
|
|
||||||
height:SCREEN_HEIGHT*0.35,
|
height: SCREEN_HEIGHT * 0.35,
|
||||||
width:SCREEN_WIDTH,
|
width: SCREEN_WIDTH,
|
||||||
backgroundColor: overlayColor,
|
backgroundColor: overlayColor,
|
||||||
},
|
},
|
||||||
rectangleContainer: {
|
rectangleContainer: {
|
||||||
|
|
||||||
flex: 1,
|
flex: 1,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
rectangle: {
|
rectangle: {
|
||||||
|
|
||||||
height: rectDimensions,
|
height: rectDimensions,
|
||||||
width: rectDimensions,
|
width: rectDimensions,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
@ -215,23 +200,20 @@ const styles = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mapStateToProps = (state, props) => {
|
||||||
|
|
||||||
function mapStateToProps(state, props) {
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
token: state.apiReducer.token,
|
||||||
token: state.apiReducer.token,
|
|
||||||
loggedIn: state.apiReducer.loggedIn,
|
loggedIn: state.apiReducer.loggedIn,
|
||||||
onHold: state.apiReducer.onHold,
|
onHold: state.apiReducer.onHold,
|
||||||
logged:state.apiReducer.logged
|
logged: state.apiReducer.logged
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
mapDispatchToProps = (dispatch) => {
|
||||||
|
|
||||||
return bindActionCreators(Actions, dispatch);
|
return bindActionCreators(Actions, dispatch);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
|
@ -13,6 +13,8 @@ import { AsyncStorage } from 'react-native';
|
||||||
//Import the sample data
|
//Import the sample data
|
||||||
import Data from '../intructions.json';
|
import Data from '../intructions.json';
|
||||||
import Login from '../screens/Login.js';
|
import Login from '../screens/Login.js';
|
||||||
|
|
||||||
|
import moment from 'moment'
|
||||||
|
|
||||||
export function getData(){
|
export function getData(){
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
|
@ -30,15 +32,15 @@ export function getData(){
|
||||||
|
|
||||||
export function getEvents(user){
|
export function getEvents(user){
|
||||||
return (dispatch)=>{
|
return (dispatch)=>{
|
||||||
var o=[];
|
let events = [];
|
||||||
console.log("chegou aqui")
|
console.log("chegou aqui")
|
||||||
|
|
||||||
|
|
||||||
for(var key in user.Sessions){
|
for(let key in user.Sessions){
|
||||||
|
|
||||||
o.push({
|
events.push({
|
||||||
time:user.Sessions[key].SessionStart.substr(11, 14),
|
time: moment(user.Sessions[key].SessionStart).format('h:mm'),
|
||||||
timeEnd: user.Sessions[key].SessionEnd.substr(11, 14),
|
timeEnd: moment(user.Sessions[key].SessionEnd).format('h:mm'),
|
||||||
lineColor:'#009688',
|
lineColor:'#009688',
|
||||||
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png',
|
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png',
|
||||||
description:user.Sessions[key].Description,
|
description:user.Sessions[key].Description,
|
||||||
|
@ -51,8 +53,7 @@ export function getEvents(user){
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_EVENTS,
|
type: GET_EVENTS,
|
||||||
events: o
|
events: events
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -89,7 +90,6 @@ const saveToken = async token => {
|
||||||
obj={}
|
obj={}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
obj.access_token = await AsyncStorage.getItem('userToken') || 'none';
|
obj.access_token = await AsyncStorage.getItem('userToken') || 'none';
|
||||||
obj.expirationDateToken = await AsyncStorage.getItem('expirationDateToken') || 'none';
|
obj.expirationDateToken = await AsyncStorage.getItem('expirationDateToken') || 'none';
|
||||||
obj.refreshToken = await AsyncStorage.getItem('refreshToken') || 'none';
|
obj.refreshToken = await AsyncStorage.getItem('refreshToken') || 'none';
|
||||||
|
|
|
@ -23,7 +23,7 @@ const apiReducer = (state = apiState, action) => {
|
||||||
|
|
||||||
case HOLD:
|
case HOLD:
|
||||||
|
|
||||||
state=Object.assign({},state, {onHold:true});
|
state=Object.assign({},state, { onHold:true });
|
||||||
return state;
|
return state;
|
||||||
|
|
||||||
case API_LOGIN:
|
case API_LOGIN:
|
||||||
|
|
|
@ -1,333 +1,330 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { View, StyleSheet, Dimensions , Image, ScrollView,Text, Button} from 'react-native';
|
import {View, StyleSheet, Dimensions, Image, ScrollView, Text, Button} from 'react-native';
|
||||||
import { TabView, TabBar, SceneMap } from 'react-native-tab-view';
|
import {TabView, TabBar, SceneMap} from 'react-native-tab-view';
|
||||||
import {
|
import {
|
||||||
RkButton,RkCard, RkText,
|
RkButton, RkCard, RkText,
|
||||||
RkTheme
|
RkTheme
|
||||||
} from 'react-native-ui-kitten';
|
} from 'react-native-ui-kitten';
|
||||||
import Timeline from 'react-native-timeline-feed'
|
import Timeline from 'react-native-timeline-feed'
|
||||||
|
|
||||||
import * as Progress from 'react-native-progress';
|
import * as Progress from 'react-native-progress';
|
||||||
|
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
|
||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
|
|
||||||
import * as Actions from '../actions'; //Import your actionss
|
import * as Actions from '../actions'; //Import your actionss
|
||||||
|
|
||||||
|
|
||||||
|
const formatObj = (obj) => {
|
||||||
|
|
||||||
const formatObj= (obj)=>{
|
let a = {};
|
||||||
|
|
||||||
let a={};
|
|
||||||
|
|
||||||
a.push({
|
|
||||||
|
|
||||||
|
a.push({})
|
||||||
|
|
||||||
})
|
return a
|
||||||
|
|
||||||
return a
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const ThirdRoute = () => (
|
const ThirdRoute = () => (
|
||||||
<View style={[styles.scene, { backgroundColor: '#efc44a' }]} />
|
<View style={[styles.scene, {backgroundColor: '#efc44a'}]}/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const FourthRoute = () => (
|
const FourthRoute = () => (
|
||||||
<View style={[styles.scene, { backgroundColor: '#49ef97' }]} />
|
<View style={[styles.scene, {backgroundColor: '#49ef97'}]}/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
class Calendar extends React.Component {
|
||||||
|
|
||||||
|
state = {
|
||||||
|
index: 0,
|
||||||
|
routes: [
|
||||||
|
{key: 'first', title: 'Sex 12'},
|
||||||
|
{key: 'second', title: 'Sab 13'},
|
||||||
|
{key: 'third', title: 'Dom 14'},
|
||||||
|
{key: 'fourth', title: 'Seg 15'},
|
||||||
|
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
this.props.getEvents(this.props.user);
|
||||||
|
console.log('didMount');
|
||||||
|
console.log(this.props.events);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Calendar extends React.Component {
|
renderDetail = ({item, index}) => {
|
||||||
|
// <Image source={{ uri:item.imageUrl, width:'100%' , height:100 }} style={{borderRadius:0}}/>
|
||||||
state = {
|
return (
|
||||||
index: 0,
|
|
||||||
routes: [
|
|
||||||
{ key: 'first', title: 'Sex 12' },
|
|
||||||
{ key: 'second', title: 'Sab 13' },
|
|
||||||
{ key: 'third', title: 'Dom 14' },
|
|
||||||
{ key: 'fourth', title: 'Seg 15' },
|
|
||||||
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidMount(){
|
|
||||||
|
|
||||||
this.props.getEvents(this.props.user);
|
|
||||||
console.log('didMount');
|
|
||||||
console.log(this.props.events);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
<View style={styles.event}>
|
||||||
|
<Text style={[styles.title]}>{item.name}</Text>
|
||||||
|
<View>
|
||||||
|
|
||||||
renderDetail = ({ item, index })=> {
|
|
||||||
// <Image source={{ uri:item.imageUrl, width:'100%' , height:100 }} style={{borderRadius:0}}/>
|
|
||||||
return (
|
|
||||||
|
|
||||||
|
<Text style={styles.description}>{item.description}</Text>
|
||||||
<View style={styles.event}>
|
<View style={styles.details}>
|
||||||
<Text style={[styles.title]}>{item.name}</Text>
|
<Progress.Bar color={'#42a5f5'} progress={0.3} unfilledColor={'white'} width={210}/>
|
||||||
<View>
|
<Text>{item.Enrolled} / {item.MaxAttendees}</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</View>
|
||||||
<Text style={styles.description}>{item.description}</Text>
|
|
||||||
<View style={styles.details}>
|
|
||||||
<Progress.Bar color={'#42a5f5'} progress={0.3} unfilledColor = {'white'}width={210} />
|
|
||||||
<Text>{item.Enrolled} / {item.MaxAttendees}</Text>
|
|
||||||
</View>
|
</View>
|
||||||
|
);
|
||||||
</View>
|
}
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
renderEvents = ({ item, index })=> {
|
renderEvents = ({item, index}) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.event}>
|
<View style={styles.event}>
|
||||||
<Text style={[styles.title]}>{item.title}</Text>
|
<Text style={[styles.title]}>{item.title}</Text>
|
||||||
<View>
|
<View>
|
||||||
|
|
||||||
<Image source={{ uri:item.imageUrl, width:'100%' , height:100 }} style={{borderRadius:0}}/>
|
<Image source={{uri: item.imageUrl, width: '100%', height: 100}} style={{borderRadius: 0}}/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Text style={styles.description}>{item.description}</Text>
|
<Text style={styles.description}>{item.description}</Text>
|
||||||
<View style={styles.details}>
|
<View style={styles.details}>
|
||||||
<Progress.Bar color={'#42a5f5'} progress={0.3} unfilledColor = {'white'}width={210} />
|
<Progress.Bar color={'#42a5f5'} progress={0.3} unfilledColor={'white'} width={210}/>
|
||||||
<Text>1/50</Text>
|
<Text>1/50</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
);
|
||||||
</View>
|
}
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
_update=()=>{
|
_update = () => {
|
||||||
this.setState({ user: this.props.user });
|
this.setState({user: this.props.user});
|
||||||
console.log(this.props.events);
|
console.log(this.props.events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
|
||||||
constructor(){
|
super()
|
||||||
|
|
||||||
super()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const archeryImgSource = require('../assets/img/archery.png');
|
|
||||||
const badmintonImgSource = require('../assets/img/badminton.png');
|
|
||||||
const lunchImgSource = require('../assets/img/lunch.png');
|
|
||||||
const soccerImgSource = require('../assets/img/soccer.png');
|
|
||||||
const dumbbellImgSource = require('../assets/img/dumbbell.png');
|
|
||||||
|
|
||||||
const ArcheryImage = (props) => <Image source={archeryImgSource} {...props} />;
|
|
||||||
const BadmintonImage = (props) => <Image source={badmintonImgSource} {...props} />;
|
|
||||||
const LunchImage = (props) => <Image source={lunchImgSource} {...props} />;
|
|
||||||
const SoccerImage = (props) => <Image source={soccerImgSource} {...props} />;
|
|
||||||
const DumbbellImage = (props) => <Image source={dumbbellImgSource} {...props} />;
|
|
||||||
const VectorIconImage = (props) => <Image source={vectorIconImgSource} {...props} />;
|
|
||||||
|
|
||||||
this.data = [
|
|
||||||
|
|
||||||
|
|
||||||
{
|
const archeryImgSource = require('../assets/img/archery.png');
|
||||||
time: '09:30',
|
const badmintonImgSource = require('../assets/img/badminton.png');
|
||||||
title: 'Sessão de Check-In',
|
const lunchImgSource = require('../assets/img/lunch.png');
|
||||||
description: 'Os participantes devem fazer o check-in e recolher o kit fornecido pela organização',
|
const soccerImgSource = require('../assets/img/soccer.png');
|
||||||
lineColor:'#009688',
|
const dumbbellImgSource = require('../assets/img/dumbbell.png');
|
||||||
icon: ArcheryImage,
|
|
||||||
imageUrl: 'https://blogsimages.adobe.com/conversations/files/2014/03/Check_In-1.jpg'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
time: '17:45',
|
|
||||||
title: 'Sessão de Abertura',
|
|
||||||
lineColor:'#009688',
|
|
||||||
description: 'Bem vindo a Coimbra, a cidade dos estudantes! Obrigado por participares na 13ª edição do ENEI.',
|
|
||||||
icon: BadmintonImage,
|
|
||||||
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
time: '19:30',
|
|
||||||
title: 'Jantar',
|
|
||||||
lineColor:'#009688',
|
|
||||||
description: 'Time to eat',
|
|
||||||
icon: BadmintonImage,
|
|
||||||
imageUrl: 'https://www.retailmenot.com/blog/wp-content/uploads/2016/08/kids-eat-free-hero1-1471459190.jpg'
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
time: '23:30',
|
|
||||||
title: 'Festarola',
|
|
||||||
lineColor:'#009688',
|
|
||||||
description: 'Sabes beber? Se não sabes, aprende com os da casa!',
|
|
||||||
icon: BadmintonImage,
|
|
||||||
imageUrl: 'http://www.revistaversatille.com.br/wp-content/uploads/Party.jpg'
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
const ArcheryImage = (props) => <Image source={archeryImgSource} {...props} />;
|
||||||
|
const BadmintonImage = (props) => <Image source={badmintonImgSource} {...props} />;
|
||||||
const FirstRoute = () => (
|
const LunchImage = (props) => <Image source={lunchImgSource} {...props} />;
|
||||||
|
const SoccerImage = (props) => <Image source={soccerImgSource} {...props} />;
|
||||||
|
const DumbbellImage = (props) => <Image source={dumbbellImgSource} {...props} />;
|
||||||
|
const VectorIconImage = (props) => <Image source={vectorIconImgSource} {...props} />;
|
||||||
|
|
||||||
<ScrollView contentContainerStyle={styles.contentContainer} >
|
this.data = [
|
||||||
|
|
||||||
|
|
||||||
<Button onPress={this._update} title="LOGOUT"/>
|
|
||||||
<Timeline
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data={this.props.events}
|
|
||||||
|
|
||||||
timeContainerStyle={{minWidth:52, marginTop: 5}}
|
|
||||||
timeStyle={{textAlign: 'center', backgroundColor:'#ff9797', color:'white', padding:5, borderRadius:13}}
|
|
||||||
descriptionStyle={{color:'gray'}}
|
|
||||||
|
|
||||||
renderDetail={this.renderDetail}
|
|
||||||
|
|
||||||
|
|
||||||
flatListProps={{
|
|
||||||
style:{
|
|
||||||
|
|
||||||
margin:15
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}}
|
{
|
||||||
keyExtractor={(item, index) => index.toString()}
|
time: '09:30',
|
||||||
|
title: 'Sessão de Check-In',
|
||||||
|
description: 'Os participantes devem fazer o check-in e recolher o kit fornecido pela organização',
|
||||||
|
lineColor: '#009688',
|
||||||
|
icon: ArcheryImage,
|
||||||
|
imageUrl: 'https://blogsimages.adobe.com/conversations/files/2014/03/Check_In-1.jpg'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '17:45',
|
||||||
|
title: 'Sessão de Abertura',
|
||||||
|
lineColor: '#009688',
|
||||||
|
description: 'Bem vindo a Coimbra, a cidade dos estudantes! Obrigado por participares na 13ª edição do ENEI.',
|
||||||
|
icon: BadmintonImage,
|
||||||
|
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
time: '19:30',
|
||||||
|
title: 'Jantar',
|
||||||
|
lineColor: '#009688',
|
||||||
|
description: 'Time to eat',
|
||||||
|
icon: BadmintonImage,
|
||||||
|
imageUrl: 'https://www.retailmenot.com/blog/wp-content/uploads/2016/08/kids-eat-free-hero1-1471459190.jpg'
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
time: '23:30',
|
||||||
|
title: 'Festarola',
|
||||||
|
lineColor: '#009688',
|
||||||
|
description: 'Sabes beber? Se não sabes, aprende com os da casa!',
|
||||||
|
icon: BadmintonImage,
|
||||||
|
imageUrl: 'http://www.revistaversatille.com.br/wp-content/uploads/Party.jpg'
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
const FirstRoute = () => (
|
||||||
|
|
||||||
|
|
||||||
|
<ScrollView contentContainerStyle={styles.contentContainer}>
|
||||||
|
|
||||||
|
|
||||||
|
<Button onPress={this._update} title="LOGOUT"/>
|
||||||
|
<Timeline
|
||||||
|
|
||||||
|
data={this.props.events}
|
||||||
|
|
||||||
|
timeContainerStyle={{minWidth: 52, marginTop: 5}}
|
||||||
|
timeStyle={{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: '#ff9797',
|
||||||
|
color: 'white',
|
||||||
|
padding: 5,
|
||||||
|
borderRadius: 13
|
||||||
|
}}
|
||||||
|
descriptionStyle={{color: 'gray'}}
|
||||||
|
|
||||||
|
renderDetail={this.renderDetail}
|
||||||
|
|
||||||
|
|
||||||
|
flatListProps={{
|
||||||
|
style: {
|
||||||
|
|
||||||
|
margin: 15
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}}
|
||||||
|
keyExtractor={(item, index) => index.toString()}
|
||||||
|
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
const SecondRoute = () => (
|
||||||
|
|
||||||
|
|
||||||
|
<ScrollView contentContainerStyle={styles.contentContainer}>
|
||||||
|
|
||||||
|
<Timeline
|
||||||
|
|
||||||
|
|
||||||
|
data={this.props.events}
|
||||||
|
|
||||||
|
timeContainerStyle={{minWidth: 52, marginTop: 5}}
|
||||||
|
timeStyle={{
|
||||||
|
textAlign: 'center',
|
||||||
|
backgroundColor: '#ff9797',
|
||||||
|
color: 'white',
|
||||||
|
padding: 5,
|
||||||
|
borderRadius: 13
|
||||||
|
}}
|
||||||
|
descriptionStyle={{color: 'gray'}}
|
||||||
|
|
||||||
|
renderDetail={this.renderDetail}
|
||||||
|
|
||||||
|
|
||||||
|
flatListProps={{
|
||||||
|
style: {
|
||||||
|
|
||||||
|
margin: 15
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}}
|
||||||
|
keyExtractor={(item, index) => index.toString()}
|
||||||
|
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
|
||||||
|
<TabView
|
||||||
|
navigationState={this.state}
|
||||||
|
renderScene={SceneMap({
|
||||||
|
first: FirstRoute,
|
||||||
|
second: SecondRoute,
|
||||||
|
third: ThirdRoute,
|
||||||
|
fourth: FourthRoute
|
||||||
|
})}
|
||||||
|
onIndexChange={index => this.setState({index})}
|
||||||
|
initialLayout={{width: Dimensions.get('window').width, height: Dimensions.get('window').height}}
|
||||||
/>
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
)
|
|
||||||
const SecondRoute = () => (
|
|
||||||
|
|
||||||
|
|
||||||
<ScrollView contentContainerStyle={styles.contentContainer} >
|
|
||||||
|
|
||||||
|
|
||||||
<Timeline
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data={this.props.events}
|
|
||||||
|
|
||||||
timeContainerStyle={{minWidth:52, marginTop: 5}}
|
|
||||||
timeStyle={{textAlign: 'center', backgroundColor:'#ff9797', color:'white', padding:5, borderRadius:13}}
|
|
||||||
descriptionStyle={{color:'gray'}}
|
|
||||||
|
|
||||||
renderDetail={this.renderDetail}
|
|
||||||
|
|
||||||
|
|
||||||
flatListProps={{
|
|
||||||
style:{
|
|
||||||
|
|
||||||
margin:15
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}}
|
|
||||||
keyExtractor={(item, index) => index.toString()}
|
|
||||||
|
|
||||||
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
)
|
|
||||||
return (
|
|
||||||
|
|
||||||
|
|
||||||
<TabView
|
|
||||||
navigationState={this.state}
|
|
||||||
renderScene={SceneMap({
|
|
||||||
first: FirstRoute,
|
|
||||||
second: SecondRoute,
|
|
||||||
third: ThirdRoute,
|
|
||||||
fourth: FourthRoute
|
|
||||||
})}
|
|
||||||
onIndexChange={index => this.setState({ index })}
|
|
||||||
initialLayout={{ width: Dimensions.get('window').width,height: Dimensions.get('window').height}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
details:{
|
details: {
|
||||||
backgroundColor:"#e0e0e0",
|
backgroundColor: "#e0e0e0",
|
||||||
borderBottomRightRadius:10,
|
borderBottomRightRadius: 10,
|
||||||
borderBottomLeftRadius:10,
|
borderBottomLeftRadius: 10,
|
||||||
padding:10
|
padding: 10
|
||||||
},
|
},
|
||||||
description:{
|
description: {
|
||||||
padding:10
|
padding: 10
|
||||||
},
|
},
|
||||||
title:{
|
title: {
|
||||||
color:'#212121',
|
color: '#212121',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
fontSize:15,
|
fontSize: 15,
|
||||||
padding:10
|
padding: 10
|
||||||
},
|
},
|
||||||
event:{
|
event: {
|
||||||
borderRadius:10,
|
borderRadius: 10,
|
||||||
backgroundColor:'#eeeeee',
|
backgroundColor: '#eeeeee',
|
||||||
|
|
||||||
},
|
},
|
||||||
scene: {
|
scene: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
contentContainer: {
|
contentContainer: {
|
||||||
paddingVertical: 20
|
paddingVertical: 20
|
||||||
}
|
}
|
||||||
});RkTheme.setType('RkCard', 'story', {
|
});
|
||||||
img: {
|
RkTheme.setType('RkCard', 'story', {
|
||||||
height: 100,
|
img: {
|
||||||
opacity: 0.7
|
height: 100,
|
||||||
},
|
opacity: 0.7
|
||||||
header: {
|
},
|
||||||
alignSelf: 'center'
|
header: {
|
||||||
},
|
alignSelf: 'center'
|
||||||
content:{
|
},
|
||||||
alignSelf:'center'
|
content: {
|
||||||
}
|
alignSelf: 'center'
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function mapStateToProps(state, props) {
|
function mapStateToProps(state, props) {
|
||||||
|
|
||||||
return {
|
|
||||||
|
|
||||||
token: state.apiReducer.token,
|
return {
|
||||||
user: state.apiReducer.user,
|
|
||||||
logged: state.apiReducer.logged,
|
token: state.apiReducer.token,
|
||||||
events: state.apiReducer.events
|
user: state.apiReducer.user,
|
||||||
|
logged: state.apiReducer.logged,
|
||||||
}
|
events: state.apiReducer.events
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
function mapDispatchToProps(dispatch) {
|
||||||
|
|
||||||
return bindActionCreators(Actions, dispatch);
|
return bindActionCreators(Actions, dispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Calendar);
|
export default connect(mapStateToProps, mapDispatchToProps)(Calendar);
|
|
@ -1,6 +1,6 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
|
|
||||||
import { Button, View, Text , TouchableOpacity, FlatList, ActivityIndicator} from 'react-native';
|
import {Button, View, Text, TouchableOpacity, FlatList, ActivityIndicator} from 'react-native';
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -9,7 +9,7 @@ import {
|
||||||
} from 'react-native-ui-kitten';
|
} from 'react-native-ui-kitten';
|
||||||
|
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
|
||||||
import {bindActionCreators} from 'redux';
|
import {bindActionCreators} from 'redux';
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ class Home extends Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
|
||||||
token:{valid:false},
|
token: {valid: false},
|
||||||
logged:true,
|
logged: true,
|
||||||
onHold:true,
|
onHold: true,
|
||||||
user:{Name:''}
|
user: {Name: ''}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,89 +46,89 @@ class Home extends Component {
|
||||||
//this.props.logoutUser();
|
//this.props.logoutUser();
|
||||||
|
|
||||||
//console.log(this.props.token);
|
//console.log(this.props.token);
|
||||||
|
|
||||||
this.props.getUserInfo(this.props.token);
|
this.props.getUserInfo(this.props.token);
|
||||||
|
|
||||||
|
|
||||||
//console.log('logged:'+this.props.logged);
|
//console.log('logged:'+this.props.logged);
|
||||||
|
|
||||||
//console.log(th2is.props)
|
//console.log(th2is.props)
|
||||||
|
|
||||||
console.log(this.props.user)
|
console.log(this.props.user)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bClick() {
|
bClick() {
|
||||||
|
|
||||||
//this.props.logoutUser();
|
//this.props.logoutUser();
|
||||||
|
|
||||||
let a={};
|
let a = {};
|
||||||
// this.setState({ user: this.props.user });
|
// this.setState({ user: this.props.user });
|
||||||
// console.log(this.props.user)
|
// console.log(this.props.user)
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
//var navigate = this.props.navigation.navigate
|
//var navigate = this.props.navigation.navigate
|
||||||
}
|
}
|
||||||
|
|
||||||
_logout = () => {
|
_logout = () => {
|
||||||
|
|
||||||
|
|
||||||
// this.props.navigation.navigate('scan');
|
// this.props.navigation.navigate('scan');
|
||||||
|
|
||||||
// this.props.logout();
|
// this.props.logout();
|
||||||
this.props.logoutUser();
|
this.props.logoutUser();
|
||||||
}
|
}
|
||||||
update=()=>{
|
update = () => {
|
||||||
|
|
||||||
|
|
||||||
this.setState({ user: this.props.user });
|
this.setState({user: this.props.user});
|
||||||
var o=[];
|
var o = [];
|
||||||
|
|
||||||
|
for (var key in this.props.user.Sessions) {
|
||||||
|
|
||||||
|
|
||||||
for(var key in this.props.user.Sessions){
|
|
||||||
|
|
||||||
|
|
||||||
o.push({
|
o.push({
|
||||||
time:this.props.user.Sessions[key].SessionStart.substr(11, 16),
|
time: this.props.user.Sessions[key].SessionStart.substr(11, 16),
|
||||||
timeEnd: this.props.user.Sessions[key].SessionEnd.substr(11, 16),
|
timeEnd: this.props.user.Sessions[key].SessionEnd.substr(11, 16),
|
||||||
lineColor:'#009688',
|
lineColor: '#009688',
|
||||||
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png',
|
imageUrl: 'https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/Vjkyj2hBg/welcome-white-sign-with-falling-colorful-confetti-animation-on-white-background_sglmmh3qm__F0013.png',
|
||||||
description:this.props.user.Sessions[key].Description,
|
description: this.props.user.Sessions[key].Description,
|
||||||
name:this.props.user.Sessions[key].Name,
|
name: this.props.user.Sessions[key].Name,
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log(this.props.user.Sessions);
|
console.log(this.props.user.Sessions);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const { navigate } = this.props.navigation;
|
|
||||||
|
|
||||||
|
|
||||||
if(this.props.onHold){
|
const {navigate} = this.props.navigation;
|
||||||
|
|
||||||
|
|
||||||
|
if (this.props.onHold) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<Text>lollsss {this.props.onHold}</Text>
|
<Text>lollsss {this.props.onHold}</Text>
|
||||||
<ActivityIndicator size="large" color="#0000ff" />
|
<ActivityIndicator size="large" color="#0000ff"/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.props.logged){
|
if (this.props.logged) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
|
|
||||||
<Button onPress={this._logout} title="LOGOUT"/>
|
<Button onPress={this._logout} title="LOGOUT"/>
|
||||||
<Button onPress={this.update} title="update"/>
|
<Button onPress={this.update} title="update"/>
|
||||||
<Button onPress={this.bClick} title="Parse"/>
|
<Button onPress={this.bClick} title="Parse"/>
|
||||||
<Text> Nomess: {this.props.user.Name}</Text>
|
<Text> Nomess: {this.props.user.Name}</Text>
|
||||||
|
|
||||||
<Text> city: {this.props.user.City}</Text>
|
<Text> city: {this.props.user.City}</Text>
|
||||||
<Text> phone: {this.props.user.Mobile}</Text>
|
<Text> phone: {this.props.user.Mobile}</Text>
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ function mapStateToProps(state, props) {
|
||||||
|
|
||||||
token: state.apiReducer.token,
|
token: state.apiReducer.token,
|
||||||
user: state.apiReducer.user,
|
user: state.apiReducer.user,
|
||||||
logged: state.apiReducer.logged
|
logged: state.apiReducer.logged
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6076,6 +6076,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"moment": {
|
||||||
|
"version": "2.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
|
||||||
|
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
|
||||||
|
},
|
||||||
"morgan": {
|
"morgan": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz",
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.18.0",
|
"axios": "^0.18.0",
|
||||||
"prop-types": "^15.6.2",
|
|
||||||
"material-icons-react": "^1.0.4",
|
"material-icons-react": "^1.0.4",
|
||||||
|
"moment": "^2.24.0",
|
||||||
|
"prop-types": "^15.6.2",
|
||||||
"react": "16.6.3",
|
"react": "16.6.3",
|
||||||
"react-native": "0.57.8",
|
"react-native": "0.57.8",
|
||||||
"react-native-app-intro-slider": "^1.0.1",
|
"react-native-app-intro-slider": "^1.0.1",
|
||||||
|
|
Loading…
Reference in New Issue