blazerapp/app/More.js

208 lines
5.7 KiB
JavaScript
Raw 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,
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'
import { createStackNavigator } from '@react-navigation/stack'
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-21 02:01:08 -05:00
import Settings from './Settings'
2020-12-23 00:23:53 -05:00
import Poll from './Poll'
2020-12-21 02:01:08 -05:00
import Images from './Images'
2020-11-07 08:55:23 -05:00
import LinearGradient from 'react-native-linear-gradient'
2021-01-05 23:08:34 -05: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 (
2020-08-09 21:27:58 -04:00
<View style={{flex:1,backgroundColor:'red'}}>
2020-08-09 20:56:12 -04:00
<FlatList
data={[
2021-01-01 00:23:17 -05:00
{name:'Announcements',key:"announce", img:Images.announcements},
2020-12-21 02:01:08 -05:00
{name:"Resources",key:"resources", img:Images.resources},
2021-01-01 00:23:17 -05:00
{name:"SOTW",key:"studentweek", img:Images.student},
{name:"lunch",key:"lunchevent", img:Images.lunch},
{name:"ssl",key:"sslopps", img:Images.sslopps},
{name:"COTW",key:"challengeweek", img:Images.challenge},
{name:"Polls", key:"polls", img: Images.polls},
2020-12-21 02:01:08 -05:00
{name:"Settings", key:"settings", img: Images.settings},
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)}>
2020-12-23 00:23:53 -05:00
<Image source = {item.img} style = {{height: 40, width: 40, marginRight: 10, tintColor: '#e3e3e3'}}/>
2021-01-05 23:08:34 -05:00
<Text style={styles.moretext}>{item.name}</Text>
2020-08-09 20:56:12 -04:00
</TouchableOpacity>
}
/>
2020-08-09 17:01:25 -04:00
</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-01-05 23:08:34 -05:00
title:"More",
2020-08-09 21:27:58 -04:00
headerTitleStyle:styles.headerTitle,
2020-11-07 08:55:23 -05:00
headerBackground: ()=>background
2020-08-09 20:56:12 -04:00
}}
/>
<Stack.Screen
name="announce"
component={Announcements}
options={{
2021-01-05 23:08:34 -05:00
title:"Announcements",
2020-08-09 21:27:58 -04:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
2020-08-10 16:06:01 -04:00
headerLeft:null,
2020-11-07 08:55:23 -05:00
headerBackground: ()=>background
2020-08-09 20:56:12 -04:00
}}
/>
<Stack.Screen
name="resources"
component={Resources}
options={{
2021-01-05 23:08:34 -05:00
title:"Resources",
2020-08-09 21:27:58 -04:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
2020-11-07 08:55:23 -05:00
headerLeft:null,
headerBackground: ()=>background
2020-08-09 20:56:12 -04:00
}}
/>
<Stack.Screen
name="studentweek"
component={StudentWeek}
options={{
2021-01-05 23:08:34 -05:00
title:"Student of the Week",
2020-08-09 21:27:58 -04:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
2020-11-07 08:55:23 -05:00
headerLeft:null,
headerBackground: ()=>background
2020-08-09 21:27:58 -04:00
}}
/>
<Stack.Screen
name="lunchevent"
component={LunchEvents}
options={{
2021-01-05 23:08:34 -05:00
title:"Lunch",
2020-08-09 21:27:58 -04:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
2020-11-07 08:55:23 -05:00
headerLeft:null,
headerBackground: ()=>background
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-01-05 23:08:34 -05:00
title:"SSL Ops",
2020-08-09 21:27:58 -04:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
2020-11-07 08:55:23 -05:00
headerLeft:null,
headerBackground: ()=>background
2020-08-09 20:56:12 -04:00
}}
/>
2020-08-14 11:57:45 -04:00
<Stack.Screen
name="challengeweek"
component={ChallengeWeek}
options={{
2021-01-05 23:08:34 -05:00
title:"Challenge of the Week",
2020-08-14 11:57:45 -04:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
2020-11-07 08:55:23 -05:00
headerLeft:null,
headerBackground: ()=>background
2020-08-14 11:57:45 -04:00
}}
/>
<Stack.Screen
name="polls"
component={Poll}
options={{
2021-01-05 23:08:34 -05:00
title:"Polls",
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
}}
/>
2020-12-21 02:01:08 -05:00
<Stack.Screen
name="settings"
component={Settings}
options={{
2021-01-05 23:08:34 -05:00
title:"Settings",
2020-12-21 02:01:08 -05:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}],
headerLeft:null,
headerBackground: ()=>background
}}
/>
2020-08-14 20:03:40 -04:00
<Stack.Screen
name="TeacherList"
component={TeacherList}
options={({route})=>({
2020-11-07 08:55:23 -05:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center',fontSize:Math.min(24,24*23/route.params.name.length)}],
title:route.params.name,
2020-11-07 08:55:23 -05:00
headerRight:()=>(<></>),
headerBackground: ()=>background
})}
/>
<Stack.Screen
name="LunchInfo"
component={LunchInfo}
options={({route})=>({
2020-11-07 08:55:23 -05:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center',fontSize:Math.min(24,24*23/route.params.name.length)}],
title:route.params.name,
2020-11-07 08:55:23 -05:00
headerRight:()=>(<></>),
headerBackground: ()=>background
})}
/>
<Stack.Screen
name="SSLInfo"
component={SSLInfo}
options={({route})=>({
2020-11-07 08:55:23 -05:00
headerTitleStyle:[styles.headerTitle,{alignSelf:'center',fontSize:Math.min(24,24*23/route.params.name.length)}],
title:route.params.name,
2020-11-07 08:55:23 -05:00
headerBackground: ()=>background,
headerRight:()=>(<></>)
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;