blazerapp/app/More.js

263 lines
7.4 KiB
JavaScript
Raw Permalink Normal View History

2020-08-09 17:01:25 -04:00
import React from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
2020-08-09 20:56:12 -04:00
FlatList,
2020-12-21 02:01:08 -05:00
TouchableOpacity,
Image,
Dimensions
2020-08-09 17:01:25 -04:00
} from 'react-native';
import {
Header,
LearnMoreLinks,
Colors,
DebugInstructions,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
2020-08-09 20:56:12 -04:00
import { NavigationContainer } from '@react-navigation/native'
2021-08-17 21:18:32 -04:00
import { createStackNavigator, HeaderBackButton } from '@react-navigation/stack'
2020-08-09 20:56:12 -04:00
import styles from './styles/morestyles'
2020-08-14 20:03:40 -04:00
import Announcements, {TeacherList} from './Announcements'
2020-08-09 20:56:12 -04:00
import Resources from './Resources'
import StudentWeek from './StudentWeek'
import SSLOps, {SSLInfo} from './SSLOps'
import LunchEvents, {LunchInfo} from './LunchEvents'
2020-08-14 11:57:45 -04:00
import ChallengeWeek from './ChallengeWeek'
2020-12-23 00:23:53 -05:00
import Poll from './Poll'
2021-08-17 21:18:32 -04:00
import Language from './Language'
2020-11-07 08:55:23 -05:00
import LinearGradient from 'react-native-linear-gradient'
2021-08-01 02:10:38 -04:00
import Ionicons from 'react-native-vector-icons/Ionicons';
2021-08-17 21:18:32 -04:00
import I18n from './i18n';
2020-08-09 20:56:12 -04:00
const Stack = createStackNavigator()
class MoreSwitch extends React.Component {
constructor(props) {
super(props)
this.props = props
}
2020-08-09 17:01:25 -04:00
render() {
return (
<View style={{flex:1,backgroundColor:'white', paddingHorizontal: '5%'}}>
2020-08-09 20:56:12 -04:00
<FlatList
data={[
2021-08-17 21:18:32 -04:00
{name:I18n.t("more.Announcements"),key:"announce", img:"megaphone-outline"},
{name:I18n.t("more.Resources"),key:"resources", img:"newspaper-outline"},
{name:I18n.t("more.SOTW"),key:"studentweek", img:"ribbon-outline"},
{name:I18n.t("more.lunch"),key:"lunchevent", img:"fast-food-outline"},
{name:I18n.t("more.ssl"),key:"sslopps", img:"school-outline"},
{name:I18n.t("more.COTW"),key:"challengeweek", img:"golf-outline"},
{name:I18n.t("more.Polls"), key:"polls", img: "stats-chart-outline"},
{name:I18n.t("more.Settings"), key:"settings", img: "settings-outline"},
2020-08-09 20:56:12 -04:00
]}
renderItem={({item})=>
2020-12-21 02:01:08 -05:00
2020-08-09 20:56:12 -04:00
<TouchableOpacity style={styles.moreitem} onPress={()=>this.props.navigation.navigate(item.key)}>
2021-08-01 02:10:38 -04:00
<Ionicons name={item.img} size={36} color={'#323232'}style={{marginRight: 15}}/>
<View style={{display: 'flex', flexDirection: 'row', justifyContent: 'space-between', width: '85%'}}>
<Text style={styles.moretext}>{item.name}</Text>
<Image source = {require('./assets/forward.png')} style={{tintColor: '#b2b2b2'}}/>
</View>
2020-08-09 20:56:12 -04:00
</TouchableOpacity>
}
/>
2020-08-09 17:01:25 -04:00
</View>
)
}
}
2021-08-17 21:18:32 -04:00
class SettingSwitch extends React.Component {
constructor(props) {
super(props)
this.props = props
}
render() {
return (
<View style={{flex:1,backgroundColor:'white', paddingHorizontal: '5%'}}>
<FlatList
data={[
{name:"Language",key:"language", img:'language-outline'}
]}
renderItem={({item})=>
<TouchableOpacity style={styles.moreitem} onPress={()=>this.props.navigation.navigate(item.key)}>
<Ionicons name={item.img} size={36} color={'#323232'}style={{marginRight: 15}}/>
<View style={{display: 'flex', flexDirection: 'row', justifyContent: 'space-between', width: '85%'}}>
<Text style={styles.moretext}>{I18n.t('settings.' + item.key)}</Text>
<Image source = {require('./assets/forward.png')} style={{tintColor: '#b2b2b2'}}/>
</View>
</TouchableOpacity>
}
/>
</View>
)
}
}
2020-11-07 08:55:23 -05:00
const background = (<LinearGradient
colors={['#f99', 'white']}
style = {{flex:1,borderBottomColor:'black',borderBottomWidth:0.5}}
/>)
2020-08-09 20:56:12 -04:00
class More extends React.Component {
render() {
return (
<NavigationContainer independent={true}>
<Stack.Navigator>
<Stack.Screen
name="Chooser"
component={MoreSwitch}
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("more.More"),
2020-08-09 21:27:58 -04:00
headerTitleStyle:styles.headerTitle,
2021-08-01 22:11:39 -04:00
headerBackground: ()=>background,
headerTitleAlign: 'center'
2020-08-09 20:56:12 -04:00
}}
/>
<Stack.Screen
name="announce"
component={Announcements}
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("more.Announcements"),
headerTitleStyle:[styles.headerTitle],
2021-08-01 22:11:39 -04:00
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
headerTitleAlign: 'center',
headerBackTitleVisible:false,
headerTintColor: 'black'
2020-08-09 20:56:12 -04:00
}}
/>
<Stack.Screen
name="resources"
component={Resources}
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("more.Resources"),
2021-08-01 22:11:39 -04:00
headerTitleStyle:styles.headerTitle,
2021-08-17 21:18:32 -04:00
//headerLeft:null,
2021-08-01 22:11:39 -04:00
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
headerTitleAlign: 'center',
headerBackTitleVisible:false,
headerTintColor: 'black'
2020-08-09 20:56:12 -04:00
}}
/>
<Stack.Screen
name="studentweek"
component={StudentWeek}
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("more.SOTW"),
2021-08-01 22:11:39 -04:00
headerTitleStyle:styles.headerTitle,
2021-08-17 21:18:32 -04:00
//headerLeft:null,
2021-08-01 22:11:39 -04:00
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
headerTitleAlign: 'center',
headerBackTitleVisible:false,
headerTintColor: 'black'
2020-08-09 21:27:58 -04:00
}}
/>
<Stack.Screen
name="lunchevent"
component={LunchEvents}
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("more.lunch"),
2021-08-01 22:11:39 -04:00
headerTitleStyle:styles.headerTitle,
2021-08-17 21:18:32 -04:00
//headerLeft:null,
2021-08-01 22:11:39 -04:00
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
headerTitleAlign: 'center',
headerBackTitleVisible:false,
headerTintColor: 'black'
2020-08-09 20:56:12 -04:00
}}
/>
<Stack.Screen
2020-12-21 02:01:08 -05:00
name="sslopps"
2020-08-09 20:56:12 -04:00
component={SSLOps}
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("more.ssl"),
2021-08-01 22:11:39 -04:00
headerTitleStyle:styles.headerTitle,
2021-08-17 21:18:32 -04:00
//headerLeft:null,
2021-08-01 22:11:39 -04:00
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
headerTitleAlign: 'center',
headerBackTitleVisible:false,
headerTintColor: 'black'
2020-08-09 20:56:12 -04:00
}}
/>
2020-08-14 11:57:45 -04:00
<Stack.Screen
name="challengeweek"
component={ChallengeWeek}
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("more.COTW"),
2021-08-01 22:11:39 -04:00
headerTitleStyle:styles.headerTitle,
2021-08-17 21:18:32 -04:00
//headerLeft:null,
2021-08-01 22:11:39 -04:00
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
headerTitleAlign: 'center',
headerBackTitleVisible:false,
headerTintColor: 'black'
2020-08-14 11:57:45 -04:00
}}
/>
<Stack.Screen
name="polls"
component={Poll}
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("more.Polls"),
2021-08-01 22:11:39 -04:00
headerTitleStyle:styles.headerTitle,
2021-08-17 21:18:32 -04:00
//headerLeft:null,
2021-08-01 22:11:39 -04:00
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
headerTitleAlign: 'center',
headerBackTitleVisible:false,
headerTintColor: 'black'
}}
/>
2020-12-21 02:01:08 -05:00
<Stack.Screen
name="settings"
2021-08-17 21:18:32 -04:00
component={SettingSwitch}
options={{
title:I18n.t("more.Settings"),
headerTitleStyle:[styles.headerTitle],
//headerLeft:null,
headerBackground: ()=>background,
headerBackTitleVisible:false,
headerTintColor: 'black',
headerTitleAlign: 'center'
}}
/>
<Stack.Screen
name="language"
component={Language}
2020-12-21 02:01:08 -05:00
options={{
2021-08-17 21:18:32 -04:00
title:I18n.t("settings.language"),
2020-12-21 02:01:08 -05:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
//headerLeft: null,
headerBackTitleVisible:false,
headerTintColor: 'black',
headerTitleAlign: 'center'
2020-12-21 02:01:08 -05:00
}}
/>
2020-08-14 20:03:40 -04:00
<Stack.Screen
name="TeacherList"
component={TeacherList}
options={({route})=>({
2021-08-17 21:18:32 -04:00
headerTitleStyle:[styles.headerTitle],
title:route.params.name,
2020-11-07 08:55:23 -05:00
headerRight:()=>(<></>),
headerBackground: ()=>background,
2021-08-17 21:18:32 -04:00
headerBackTitleVisible:false,
headerTintColor: 'black',
headerTitleAlign: 'center'
//headerLeft: null,
2020-08-14 20:03:40 -04:00
})}
/>
2020-08-09 20:56:12 -04:00
</Stack.Navigator>
</NavigationContainer>
)
}
}
2020-08-09 17:01:25 -04:00
export default More;