Deployment fix

This commit is contained in:
Michael Ilie
2021-01-05 23:08:34 -05:00
parent f327c92573
commit 92686182d5
16 changed files with 270 additions and 140 deletions
+8 -8
View File
@@ -27,17 +27,17 @@ import Staff from './Staff'
import OpeningPage from './OpeningPage';
import OpenPage from './OpenPage';
import Ionicons from 'react-native-vector-icons/Ionicons';
import I18n from './i18n';
//import I18n from './i18n';
import AsyncStorage from '@react-native-community/async-storage'
const Tab = createBottomTabNavigator();
AsyncStorage.getItem('language')
/*AsyncStorage.getItem('language')
.then((token) => {
console.log("lang: " + token);
I18n.locale = token;
});
*/
AsyncStorage.getItem('announcementNotifs')
.then((token) => {
console.log("announcementNotifs: " + token);
@@ -86,11 +86,11 @@ class App extends React.Component {
fontSize:16
}}}
>
<Tab.Screen name={I18n.t('app.home')} component={Home}/>
<Tab.Screen name={I18n.t('app.calendar')} component={Calendar}/>
<Tab.Screen name={I18n.t('app.clubs')} component={Clubs}/>
<Tab.Screen name={I18n.t('app.staff')} component={Staff}/>
<Tab.Screen name={I18n.t('app.more')} component={More}/>
<Tab.Screen name="Home" component={Home}/>
<Tab.Screen name="Calendar" component={Calendar}/>
<Tab.Screen name="Clubs" component={Clubs}/>
<Tab.Screen name="Staff" component={Staff}/>
<Tab.Screen name="More" component={More}/>
</Tab.Navigator>
: <OpenPage />}
</NavigationContainer>
+147 -4
View File
@@ -1,4 +1,4 @@
import React, {useState} from 'react';
/*import React, {useState} from 'react';
import {
SafeAreaView,
StyleSheet,
@@ -16,7 +16,7 @@ import {
} from 'react-native/Libraries/NewAppScreen';
import LinearGradient from 'react-native-linear-gradient';
import I18n from './i18n';
//import I18n from './i18n';
import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
@@ -124,7 +124,8 @@ class Calendar extends React.Component {
})
.then((json) => {
const data = JSON.parse(json).data
data.sort((a,b)=>new Date(b.date).getTime()-new Date(a.date).getTime())
data.sort((a,b)=>new Date(b.date).getTime()-new Date(a.date).getTime())
console.log(data);
this.setState({data: data});
})
.catch((error) => console.error(error))
@@ -138,7 +139,149 @@ class Calendar extends React.Component {
colors={['#f99', 'white']}
style = {{height: '100%', borderBottomColor:'black', borderBottomWidth:0.5, display: 'flex', justifyContent: 'flex-end', paddingBottom: '2.5%'}}
>
<Text style = {{fontSize: 24, fontWeight: 'bold', alignSelf: 'center'}}>{I18n.t('calendar.calendarEvents')}</Text>
<Text style = {{fontSize: 24, fontWeight: 'bold', alignSelf: 'center'}}>Calendar Events</Text>
</LinearGradient>
</View>
<FlatList
data={this.state.data}
renderItem={item=><Event item={item}/>}
keyExtractor={item=>JSON.stringify(item)}
/>
</View>
)
}
}
export default Calendar;*/
import React, {useState} from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
FlatList,
TouchableOpacity,
Image,
} from 'react-native';
import {
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import LinearGradient from 'react-native-linear-gradient';
import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
const getCurrentDate=()=>{
var date = new Date().getDate();
var month = new Date().getMonth() + 1;
var year = new Date().getFullYear();
return year + '-' + month + '-' + date;
}
const Event = ({item}) => {
const [visible, setVisible] = useState(false)
const date = item.item.date.split('-')
const today = new Date(getCurrentDate())
const week = new Date().setDate(new Date().getDate() - 8)
const itemDate = new Date(item.item.date)
const extra = (
<>
<Text style={{fontSize:20}}>{item.item.text}</Text>
<Text style={{fontSize:20}}>Location: {item.item.location}</Text>
</>
)
if (itemDate >= today) {
return (
<TouchableOpacity style={styles.item1} onPress={()=>setVisible(!visible)} activeOpacity={0.8}>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center', justifyContent: 'space-between'}}>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center', width: '60%'}}>
<Image source ={require('./assets/calendar.png')} style = {{height: 40, width: 40, marginRight: 15}}/>
<Text style={styles.title3}>{item.item.title}</Text>
</View>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center'}}>
<Text style = {{fontSize: 16, alignSelf: 'center'}}>{`${date[1]}/${date[2]}/${date[0]}`}</Text>
</View>
</View>
{visible?extra:<></>}
</TouchableOpacity>
)
}
else if (itemDate >= week){
return (
<TouchableOpacity style={{backgroundColor: '#e3e3e3', padding: 15, borderBottomWidth: 1, borderColor: 'black', width: '100%',}} onPress={()=>setVisible(!visible)} activeOpacity={0.8}>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center', justifyContent: 'space-between'}}>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center', width: '60%'}}>
<Image source ={require('./assets/calendar.png')} style = {{height: 40, width: 40, marginRight: 15}}/>
<Text style={styles.title3}>{item.item.title}</Text>
</View>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center'}}>
<Text style = {{fontSize: 16, alignSelf: 'center'}}>{`${date[1]}/${date[2]}/${date[0]}`}</Text>
</View>
</View>
{visible?extra:<></>}
</TouchableOpacity>
)
}
else {
return (
null
)
}
}
class Calendar extends React.Component {
constructor(props) {
super(props)
this.state = {
data: []
}
}
componentDidMount() {
this.getData()
this.props.navigation.addListener(
'focus',
() => {
this.getData()
}
);
}
getData() {
fetch(`${url}/api/en/events`,{
headers: {
'Cache-Control': 'no-cache'
} })
.then((response) => {
return response.text();
})
.then((json) => {
const data = JSON.parse(json).data
data.sort((a,b)=>new Date(b.date).getTime()-new Date(a.date).getTime())
console.log(data);
this.setState({data: data});
})
.catch((error) => console.error(error))
}
render() {
return (
<View>
<View style = {{height: 56, display: 'flex'}}>
<LinearGradient
colors={['#f99', 'white']}
style = {{height: '100%', borderBottomColor:'black', borderBottomWidth:0.5, display: 'flex', justifyContent: 'flex-end', paddingBottom: '2.5%'}}
>
<Text style = {{fontSize: 24, fontWeight: 'bold', alignSelf: 'center'}}>Calendar Events</Text>
</LinearGradient>
</View>
+1 -1
View File
@@ -160,7 +160,7 @@ class Clubs extends React.Component {
<SafeAreaView style={styles.container}>
<SearchBar
lightTheme
placeholder={I18n.t('clubs.searchClubs')}
placeholder={'Search Clubs'}
onChangeText={this.updateSearch}
onCancel={this.clearSearch}
onClear={this.clearSearch}
+10 -10
View File
@@ -30,7 +30,7 @@ import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import Announcements from './Announcements'
import AsyncStorage from '@react-native-community/async-storage'
import I18n from './i18n';
//import I18n from './i18n';
const getCurrentDate=()=>{
@@ -339,9 +339,9 @@ function HomeScreen (props) {
<ScrollView style={{height: '100%', backgroundColor: 'white'}}>
<View style={{height: 275, backgroundColor: 'white', padding: '2%'}}>
<View style={{display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: '2%'}}>
<Text style={liststyles.homeTitle}>{I18n.t('home.whatsNew')}</Text>
<Text style={liststyles.homeTitle}>Whats New</Text>
<TouchableOpacity onPress={()=>props.navigation.navigate('new', {data:props.data})}>
<Text style={{color: 'blue', textDecorationLine: 'underline'}}>{I18n.t('home.viewAll')}</Text>
<Text style={{color: 'blue', textDecorationLine: 'underline'}}>View All</Text>
</TouchableOpacity>
</View>
<ScrollView horizontal='true' style={{display: 'flex', flexDirection: 'row', paddingHorizontal: '2%'}}></ScrollView>
@@ -357,7 +357,7 @@ function HomeScreen (props) {
</View>
<View style={{height: 275, backgroundColor: 'white', padding: '2%'}}>
<Text style={liststyles.homeTitle}>{I18n.t('home.SOTW')}</Text>
<Text style={liststyles.homeTitle}>Student of the Week</Text>
<View style={{display: 'flex', flexDirection: 'row', paddingTop: '5%', paddingHorizontal: '2%', justifyContent: 'space-between'}}>
<View style={{display: 'flex', borderWidth: 1, borderColor: 'black', borderRadius: 8, width: '32%', height: '100%'}}>
<View style={{height:'70%'}}>
@@ -365,22 +365,22 @@ function HomeScreen (props) {
</View>
<View style ={{paddingHorizontal: '2%', height: '15%', borderTopWidth: 1}}>
<Text style={{fontWeight: 'bold', fontSize: 18}}>{props.studentData.name}</Text>
<Text>{I18n.t('home.Grade')} {props.studentData.year}</Text>
<Text>Grade {props.studentData.year}</Text>
</View>
</View>
<View style={{borderWidth: 1, borderColor: 'black', borderRadius: 8, width: '64%', height: '100%', padding: '2%'}}>
<Text style={{fontSize: 16}}><Text style={{fontWeight: 'bold'}}>{I18n.t('home.Hobbies')}: </Text>{props.studentData.hobbies}</Text>
<Text style={{fontSize: 16}}><Text style={{fontWeight: 'bold'}}>{I18n.t('home.Achievements')}: </Text>{props.studentData.achievements}</Text>
<Text style={{fontSize: 16}}><Text style={{fontWeight: 'bold'}}>{I18n.t('home.Messages')}: </Text>{props.studentData.messages}</Text>
<Text style={{fontSize: 16}}><Text style={{fontWeight: 'bold'}}>Hobbies: </Text>{props.studentData.hobbies}</Text>
<Text style={{fontSize: 16}}><Text style={{fontWeight: 'bold'}}>Achievements: </Text>{props.studentData.achievements}</Text>
<Text style={{fontSize: 16}}><Text style={{fontWeight: 'bold'}}>Messages: </Text>{props.studentData.messages}</Text>
</View>
</View>
</View>
<View style={{padding: '2%'}}>
<View style ={{display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: '2%'}}>
<Text style={liststyles.homeTitle}>{I18n.t('home.Announcements')}</Text>
<Text style={liststyles.homeTitle}>Announcements</Text>
<TouchableOpacity onPress={()=>props.navigation.navigate(Announcements)}>
<Text style={{color: 'blue', textDecorationLine: 'underline'}}>{I18n.t('home.viewAll')}</Text>
<Text style={{color: 'blue', textDecorationLine: 'underline'}}>View All</Text>
</TouchableOpacity>
</View>
<FlatList
+2 -2
View File
@@ -1,4 +1,4 @@
import React, { Component } from 'react';
/*import React, { Component } from 'react';
import { DevSettings } from 'react-native';
import { Platform, StyleSheet, TouchableOpacity, Text, ScrollView, View } from 'react-native';
import I18n from './i18n';
@@ -71,4 +71,4 @@ export default class extends Component {
</View>
);
}
}
}*/
+11 -11
View File
@@ -33,7 +33,7 @@ import Settings from './Settings'
import Poll from './Poll'
import Images from './Images'
import LinearGradient from 'react-native-linear-gradient'
import I18n from './i18n';
//import I18n from './i18n';
const Stack = createStackNavigator()
@@ -61,7 +61,7 @@ class MoreSwitch extends React.Component {
<TouchableOpacity style={styles.moreitem} onPress={()=>this.props.navigation.navigate(item.key)}>
<Image source = {item.img} style = {{height: 40, width: 40, marginRight: 10, tintColor: '#e3e3e3'}}/>
<Text style={styles.moretext}>{I18n.t('more.'+item.name)}</Text>
<Text style={styles.moretext}>{item.name}</Text>
</TouchableOpacity>
}
/>
@@ -84,7 +84,7 @@ class More extends React.Component {
name="Chooser"
component={MoreSwitch}
options={{
title:I18n.t('more.More'),
title:"More",
headerTitleStyle:styles.headerTitle,
headerBackground: ()=>background
}}
@@ -93,7 +93,7 @@ class More extends React.Component {
name="announce"
component={Announcements}
options={{
title:I18n.t('more.Announcements'),
title:"Announcements",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
@@ -103,7 +103,7 @@ class More extends React.Component {
name="resources"
component={Resources}
options={{
title:I18n.t('more.Resources'),
title:"Resources",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
@@ -113,7 +113,7 @@ class More extends React.Component {
name="studentweek"
component={StudentWeek}
options={{
title:I18n.t('more.SOTW'),
title:"Student of the Week",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
@@ -123,7 +123,7 @@ class More extends React.Component {
name="lunchevent"
component={LunchEvents}
options={{
title:I18n.t('more.lunch'),
title:"Lunch",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
@@ -133,7 +133,7 @@ class More extends React.Component {
name="sslopps"
component={SSLOps}
options={{
title:I18n.t('more.ssl'),
title:"SSL Ops",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
@@ -143,7 +143,7 @@ class More extends React.Component {
name="challengeweek"
component={ChallengeWeek}
options={{
title:I18n.t('more.COTW'),
title:"Challenge of the Week",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
@@ -153,7 +153,7 @@ class More extends React.Component {
name="polls"
component={Poll}
options={{
title:I18n.t('more.Polls'),
title:"Polls",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
@@ -163,7 +163,7 @@ class More extends React.Component {
name="settings"
component={Settings}
options={{
title:I18n.t('more.Settings'),
title:"Settings",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
+2 -2
View File
@@ -1,4 +1,4 @@
import React, { Component, useState } from 'react';
/*import React, { Component, useState } from 'react';
import {
Platform,
StyleSheet,
@@ -119,4 +119,4 @@ class Notifications extends Component {
}
}
export default Notifications
export default Notifications*/
+40 -4
View File
@@ -1,4 +1,4 @@
import React from 'react';
/*import React from 'react';
import {
SafeAreaView,
StyleSheet,
@@ -21,7 +21,7 @@ import {WebView} from 'react-native-webview';
import LinearGradient from 'react-native-linear-gradient';
import { Linking } from 'react-native';
import { url } from './resources/fetchInfo.json'
import I18n from './i18n';
//import I18n from './i18n';
class Poll extends React.Component {
@@ -47,7 +47,7 @@ componentDidMount() {
})
.catch((error) => console.error(error))
}*/
/*
render() {
return (
<View style = {{backgroundColor: 'white'}}>
@@ -55,11 +55,47 @@ componentDidMount() {
<TouchableOpacity onPress={()=>Linking.openURL("https://google.com")}>
<Image source={require('./assets/polls.png')} style={{marginTop: 50, height: 300, width: 300, tintColor: 'red'}}/>
</TouchableOpacity>
<Text style ={{fontSize: 20, marginTop: 30}}>{I18n.t('polls.textInPoll')}</Text>
<Text style ={{fontSize: 20, marginTop: 30}}>Take A Poll!</Text>
</View>
</View>
)
}
}
export default Poll;*/
import React from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
} from 'react-native';
import {
Header,
LearnMoreLinks,
Colors,
DebugInstructions,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import {WebView} from 'react-native-webview';
class Poll extends React.Component {
render() {
return (
<WebView
source = {{uri: 'https://docs.google.com/forms/d/e/1FAIpQLSfR0XP2yo3TV3egz7aMok56wnP9kG4FQt2v3rHrrayf8uC7Vw/viewform?usp=sf_link'}}
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={true}
style={{marginTop: 20}}
cacheEnabled={true}
/>
)
}
}
export default Poll;
+1 -1
View File
@@ -22,7 +22,7 @@ import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import styles from './styles/liststyles';
import { url } from './resources/fetchInfo.json';
import I18n from './i18n';
//import I18n from './i18n';
const Stack = createStackNavigator();
+30 -12
View File
@@ -26,13 +26,31 @@ import LinearGradient from 'react-native-linear-gradient'
import Images from './Images'
import { NavigationContainer } from '@react-navigation/native'
import { createStackNavigator } from '@react-navigation/stack'
import I18n from './i18n';
import Language from './Language'
import Notifications from './Notifications'
//import I18n from './i18n';
//import Language from './Language'
//import Notifications from './Notifications'
const Stack = createStackNavigator()
class SettingSwitch extends React.Component {
class placeHoldingForNow extends React.Component{
constructor(props) {
super(props)
this.props = props
}
render() {
return (
<View style={{flex:1,backgroundColor:'red'}}>
<Text>
Coming Soon...
</Text>
</View>
)
}
}
/*class SettingSwitch extends React.Component {
constructor(props) {
super(props)
this.props = props
@@ -43,8 +61,8 @@ class SettingSwitch extends React.Component {
<View style={{flex:1,backgroundColor:'red'}}>
<FlatList
data={[
{name:"Language",key:"language", img:Images.lang},
{name:"Notifications",key:"notifications", img:Images.notifs},
//{name:"Language",key:"language", img:Images.lang}
//{name:"Notifications",key:"notifications", img:Images.notifs},
]}
renderItem={({item})=>
<TouchableOpacity style={styles.moreitem} onPress={()=>this.props.navigation.navigate(item.key)}>
@@ -57,7 +75,7 @@ class SettingSwitch extends React.Component {
)
}
}
*/
const background = (<LinearGradient
colors={['#f99', 'white']}
style = {{flex:1,borderBottomColor:'black',borderBottomWidth:0.5}}
@@ -70,14 +88,14 @@ class Settings extends React.Component {
<Stack.Navigator>
<Stack.Screen
name="Chooser"
component={SettingSwitch}
component={placeHoldingForNow}
options={{
title:'Settings',
headerTitleStyle:styles.headerTitle,
headerBackground: ()=>background
}}
/>
<Stack.Screen
{/*<Stack.Screen
name="language"
component={Language}
options={{
@@ -86,8 +104,8 @@ class Settings extends React.Component {
headerLeft:null,
headerBackground: ()=>background
}}
/>
<Stack.Screen
/>*/}
{/*<Stack.Screen
name="notifications"
component={Notifications}
options={{
@@ -96,7 +114,7 @@ class Settings extends React.Component {
headerLeft:null,
headerBackground: ()=>background
}}
/>
/>*/}
</Stack.Navigator>
</NavigationContainer>
)
+2 -2
View File
@@ -23,7 +23,7 @@ import {
import { SearchBar } from 'react-native-elements';
import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
import I18n from './i18n';
//import I18n from './i18n';
const StaffElement = ({item}) => {
const [visible, setVisible] = useState(false)
@@ -108,7 +108,7 @@ class Staff extends React.Component {
<SafeAreaView style={styles.container}>
<SearchBar
lightTheme
placeholder={I18n.t('staff.searchStaff')}
placeholder="Staff Search"
onChangeText={this.updateSearch}
onCancel={this.clearSearch}
onClear={this.clearSearch}
+5 -5
View File
@@ -16,7 +16,7 @@ import {
DebugInstructions,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import I18n from './i18n';
//import I18n from './i18n';
import { url } from './resources/fetchInfo.json'
class StudentWeek extends React.Component {
@@ -49,7 +49,7 @@ class StudentWeek extends React.Component {
<View style = {{display: 'flex', flexDirection: 'row', justifyContent: 'space-between'}}>
<View>
<Text style={{fontSize:28,marginBottom:'10%',textAlign:'center'}}>{this.state.data.name}</Text>
<Text style={{fontSize:20}}>{'\t'}{I18n.t('student.Grade')} {this.state.data.year}</Text>
<Text style={{fontSize:20}}>{'\t'}Grade: {this.state.data.year}</Text>
</View>
<View style = {{height: 150, width: 150}}>
<Image style = {{height: '100%', width:'100%', borderRadius: 6}}source={{iconURI}} />
@@ -59,15 +59,15 @@ class StudentWeek extends React.Component {
<View style = {{paddingTop:'10%', height: '55%', display: 'flex', flexDirection: 'column', justifyContent: 'space-between'}}>
<View>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>{"\n"}{I18n.t('student.Hobbies')}</Text>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>{"\n"}Hobbies:</Text>
<Text style={{fontSize: 20}}>{'\t'}{this.state.data.hobbies}</Text>
</View>
<View>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>{"\n"}{I18n.t('student.Achievements')} </Text>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>{"\n"}Achievements: </Text>
<Text style={{fontSize: 20}}>{'\t'}{this.state.data.achievements}</Text>
</View>
<View>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>{"\n"}{I18n.t('student.Messages')}</Text>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>{"\n"}Messages:</Text>
<Text style={{fontSize: 20}}>{'\t'}{this.state.data.messages}</Text>
</View>
</View>
+10 -10
View File
@@ -1,12 +1,12 @@
'use strict';
import I18n from 'react-native-i18n';
import en from './Languages/en'
import es from './Languages/es'
//'use strict';
//import I18n from 'react-native-i18n';
//import en from './Languages/en'
//import es from './Languages/es'
I18n.fallbacks = true;
I18n.translations = {
en,
es,
};
//I18n.fallbacks = true;
//I18n.translations = {
//en,
//es,
//};
export default I18n;
//export default I18n;
+1 -1
View File
@@ -1 +1 @@
{"url":"http://127.0.0.1:5000"}
{"url":"https://24d524eaf8f5.ngrok.io"}