Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions app/containers/CalendarModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
import React, {Component} from 'react';
import {
Modal,
DatePickerIOS,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have a date picker? isn't the modal just gonna have read only information about the shift?

TouchableHighlight,
TouchableOpacity,
View,
StyleSheet,
} from 'react-native';
import {
Toast,
Button,
Icon,
Body,
Left,
Right,
Title,
Container,
Header,
Content,
Form,
Item,
Input,
Label,
Text,
} from 'native-base';

class CalendarModal extends Component {
constructor(props) {
super(props);
this.state = {
modalVisible: false,
startVisible: false,
StartDate: new Date(),
EndDate: new Date(),
Comment on lines +34 to +35
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be consistent in your naming scheme. Always use camelCase

};
this.setStartDate = this.setStartDate.bind(this);
this.setEndDate = this.setEndDate.bind(this);
}
setStartDate(newDate) {
this.setState({StartDate: newDate});
}
setEndDate(newDate) {
this.setState({EndDate: newDate});
}
toggleModal(visible) {
this.setState({modalVisible: visible});
}
toggleStart(visible) {
this.setState({startVisible: visible});
}
render() {
return (
<View style={styles.container}>
<Modal
animationType={'none'}
transparent={true}
visible={this.state.modalVisible}
onRequestClose={() => {
console.log('Modal has been closed.');
}}>
<View style={styles.modal}>
<Container>
<Header>
<Body style={{flexDirection: 'row'}}>
<Title>Edit Shift</Title>
</Body>
<Right />
</Header>
<Content style={styles.content}>
<Form>
<Body style={{marginTop: 10, flexDirection: 'row-reverse'}}>
<Title>Start</Title>
</Body>

{!this.state.startVisible && (
<Button
block
style={{marginTop: 10, margin: 20, backgroundColor: '#00adf5'}}
onPress={() => {
this.toggleStart(!this.state.startVisible);
}}>
<Text>Time: {this.props.StartDate}</Text>
</Button>
)}
{this.state.startVisible && (
<DatePickerIOS
date={this.state.StartDate}
onDateChange={this.setStartDate}
visible={this.state.startVisible}
/>
)}
{this.state.startVisible && (
<Button
block
style={{marginTop: 0, margin: 20, backgroundColor: '#00adf5'}}
onPress={() => {
this.toggleStart(false);
}}>
<Text>Save</Text>
</Button>
)}
<Title> End </Title>
<DatePickerIOS date={this.state.EndDate} onDateChange={this.setEndDate} />
<Item floatingLabel>
<Label>Title</Label>
<Input />
</Item>
<Item floatingLabel last>
<Label>Description</Label>
<Input />
</Item>
</Form>
<View style={styles.content}>
<Button
block
style={{marginTop: 20, margin: 100, backgroundColor: '#00adf5'}}
onPress={() => {
this.toggleModal(!this.state.modalVisible);
}}>
<Text>Edit Shift</Text>
</Button>
</View>
</Content>
</Container>
{/* <TouchableHighlight onPress = {() => {
this.toggleModal(!this.state.modalVisible)}}>

<Text style = {styles.text}>Close Modal</Text>
</TouchableHighlight> */}
</View>
</Modal>

<Button
block
style={{marginTop: 40, margin: 80, backgroundColor: '#00adf5'}}
onPress={() => {
this.toggleModal(true);
}}>
<Text>Edit User Settings</Text>
</Button>
</View>
);
}
}
export default CalendarModal;

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
modal: {
justifyContent: 'center',
flex: 1,
alignItems: 'center',
width: '85%',
borderRadius: 10,
borderWidth: 1,
borderColor: '#fff',
marginTop: 70,
marginLeft: 40,
},
text: {
color: '#3f2949',
marginTop: 10,
},
});

export {CalendarModal};
71 changes: 69 additions & 2 deletions app/containers/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,77 @@
// @flow

import React, {Component} from 'react';
import {View} from 'react-native';
import {StyleSheet, View, Image, Text} from 'react-native';
import {Card, Divider} from 'react-native-elements';
import {CalendarModal} from './CalendarModal';
import { WeatherWidget } from 'react-native-weather';

export default class Dashboard extends Component {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Vinit, we won't have a Dashboard component, so remove for now :(

constructor(props) {
super(props);

this.state = {
latitude: 0,
longitude: 0,
forecast: [],
error: '',
};
}
getLocation() {
// Get the current position of the user
navigator.geolocation.getCurrentPosition(
position => {
this.setState(
prevState => ({
latitude: position.coords.latitude,
longitude: position.coords.longitude,
}),
() => {
this.getWeather();
},
);
},
error => this.setState({forecast: error.message}),
{enableHighAccuracy: true, timeout: 20000, maximumAge: 1000},
);
}

getWeather() {
// Construct the API url to call
let url =
'https://api.openweathermap.org/data/2.5/forecast?lat=' +
this.state.latitude +
'&lon=' +
this.state.longitude +
'&units=metric&appid=734bff6c94faf86e71390520d5252983';

// Call the API, and set the state of the weather forecast
fetch(url)
.then(response => response.json())
.then(data => {
this.setState((prevState, props) => ({
forecast: data,
}));
});
}

render() {
return <View />;
return <WeatherWidget
api={"77f7286000cc8628cc4557b024c9756b"}
lat={"0"}
lng={"0"}
/>;
}
}

const styles = StyleSheet.create({
container: {
alignItems: 'center',
},
modal: {
alignItems: 'center',
},
text: {
color: '#3f2949',
},
});
3 changes: 2 additions & 1 deletion app/navigation/AppNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ function AppNavigator() {
<Stack.Screen
name="Home"
component={BottomTabNavigator}
options={({route}) => ({
options={({navigation}) => ({
title: 'GTHC',
headerRight: () => (
<Icon.Button
backgroundColor={mainHeader.headerStyle.backgroundColor}
name="ios-settings"
size={24}
color="white"
onPress={() => navigation.navigate('Settings')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!!

/>
),
...mainHeader,
Expand Down
2 changes: 1 addition & 1 deletion app/settings/TeamSettingsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TeamSettingsModal extends Component {
return (
<View style={styles.container}>
<Modal
animationType={'slide'}
animationType={'none'}
transparent={false}
visible={this.state.modalVisible}
onRequestClose={() => {
Expand Down
2 changes: 1 addition & 1 deletion app/settings/UserSettingsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class UserSettingsModal extends Component {
return (
<View style={styles.container}>
<Modal
animationType={'slide'}
animationType={'none'}
transparent={false}
visible={this.state.modalVisible}
onRequestClose={() => {
Expand Down
Loading