Changed some minor things, slightly improved search for teachers

This commit is contained in:
M10T 2020-10-09 21:10:34 -04:00
parent f52f7c1f24
commit ede61a73a0
5 changed files with 27 additions and 74 deletions

View File

@ -8,6 +8,7 @@ import {
StatusBar, StatusBar,
Linking, Linking,
Image, Image,
TouchableOpacity
} from 'react-native'; } from 'react-native';
import { import {
@ -18,71 +19,28 @@ import {
ReloadInstructions, ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen'; } from 'react-native/Libraries/NewAppScreen';
import styles from './styles/morestyles'; import styles from './styles/morestyles';
function ResourceLink(props) {
return (
<TouchableOpacity style={styles.resourceContainer} onPress={() => Linking.openURL(props.url)}>
<Image source={props.img} style={styles.image}/>
<View style={styles.textContainer}>
<Text style={styles.resourceText}>{props.name}</Text>
</View>
</TouchableOpacity>
)
}
class Resources extends React.Component { class Resources extends React.Component {
render() { render() {
return ( return (
<ScrollView> <ScrollView>
<View style = {styles.resourceContainer}> <ResourceLink url='https://classroom.mcpsmd.org/' img={require('./assets/canvaslogo.png')} name='MyMCPS Classroom'/>
<Text onPress={() => Linking.openURL('https://classroom.mcpsmd.org/')}> <ResourceLink url='https://md-mcps-psv.edupoint.com/Home_PXP2.aspx' img={require('./assets/studentvue.jpg')} name='StudentVUE'/>
<Image source ={require('./assets/canvaslogo.png')} style = {styles.image}/> <ResourceLink url='https://mbhs.edu/newsevents/Announcements/Montgomery%20Blair%20High%20School%20Final%20Bell%20Schedule%20.pdf' img={require('./assets/schedule.jpg')} name='1st Semester Schedule'/>
<View style = {styles.textContainer}> <ResourceLink url='https://student.naviance.com/mbhs' img={require('./assets/naviance.png')} name='Naviance'/>
<Text style = {styles.resourceText}> <ResourceLink url='https://blairblazersathletics.com/' img={require('./assets/athletics.jpg')} name='Blair Athletics'/>
MyMCPS Classroom <ResourceLink url='https://classroom.google.com/u/0/h' img={require('./assets/googleclassroom.jpg')} name='Google Classroom'/>
</Text>
</View>
</Text>
</View>
<View style = {styles.resourceContainer}>
<Text onPress={() => Linking.openURL('https://md-mcps-psv.edupoint.com/Home_PXP2.aspx')}>
<Image source ={require('./assets/studentvue.jpg')} style = {styles.image}/>
<View style = {styles.textContainer}>
<Text style = {styles.resourceText}>
StudentVUE
</Text>
</View>
</Text>
</View>
<View style = {styles.resourceContainer}>
<Text onPress={() => Linking.openURL('https://mbhs.edu/newsevents/Announcements/Montgomery%20Blair%20High%20School%20Final%20Bell%20Schedule%20.pdf')}>
<Image source ={require('./assets/schedule.jpg')} style = {styles.image}/>
<View style = {styles.textContainer}>
<Text style = {styles.resourceText}>
1st Semester Schedule
</Text>
</View>
</Text>
</View>
<View style = {styles.resourceContainer}>
<Text onPress={() => Linking.openURL('https://student.naviance.com/mbhs')}>
<Image source ={require('./assets/naviance.png')} style = {styles.image}/>
<View style = {styles.textContainer}>
<Text style = {styles.resourceText}>
Naviance
</Text>
</View>
</Text>
</View>
<View style = {styles.resourceContainer}>
<Text onPress={() => Linking.openURL('https://blairblazersathletics.com/')}>
<Image source ={require('./assets/athletics.jpg')} style = {styles.image}/>
<View style = {styles.textContainer}>
<Text style = {styles.resourceText}>
Blair Athletics
</Text>
</View>
</Text>
</View>
<View style = {styles.resourceContainer}>
<Text onPress={() => Linking.openURL('https://classroom.google.com/u/0/h')}>
<Image source ={require('./assets/googleclassroom.jpg')} style = {styles.image}/>
<View style = {styles.textContainer}>
<Text style = {styles.resourceText}>
Google Classroom
</Text>
</View>
</Text>
</View>
</ScrollView> </ScrollView>
) )
} }

View File

@ -50,7 +50,6 @@ class SSLOps extends React.Component {
} }
) )
.then((response) => { .then((response) => {
console.log(response);
return response.text(); return response.text();
}) })
.then((json) => { .then((json) => {
@ -60,7 +59,6 @@ class SSLOps extends React.Component {
} }
render() { render() {
console.log(this.state.data)
return ( return (
<View style={styles.container}> <View style={styles.container}>
<FlatList <FlatList

View File

@ -23,14 +23,13 @@ import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json' import { url } from './resources/fetchInfo.json'
const StaffElement = ({item}) => { const StaffElement = ({item}) => {
console.log(item)
const [visible, setVisible] = useState(0) const [visible, setVisible] = useState(0)
const extra = visible?(<Text>{'\n'}Email: {item.item.emails}</Text>):(<></>); const extra = [...item.item.emails.map(email=>(<Text key={email}>Email: {email}</Text>))]
return( return(
<View> <View>
<TouchableOpacity style={styles.item} onPress={()=>setVisible(!visible)} activeOpacity={0.8}> <TouchableOpacity style={styles.item} onPress={()=>setVisible(!visible)} activeOpacity={0.8}>
<Text style={styles.title}>{item.item.name}</Text> <Text style={styles.title}>{item.item.name}</Text>
{extra} {visible?extra:<></>}
</TouchableOpacity> </TouchableOpacity>
</View> </View>
) )
@ -59,8 +58,8 @@ class Staff extends React.Component {
return response.text(); return response.text();
}) })
.then((json) => { .then((json) => {
this.setState({data: JSON.parse(json).data[0].staff}); this.setState({data: JSON.parse(json).data});
this.setState({dataSearch:JSON.parse(json).data[0].staff}); this.setState({dataSearch:JSON.parse(json).data});
}) })
.catch((error) => console.error(error)) .catch((error) => console.error(error))
.finally(() => { .finally(() => {
@ -71,7 +70,7 @@ class Staff extends React.Component {
updateSearch = (search) => { updateSearch = (search) => {
this.setState({ search:search }); this.setState({ search:search });
const searchPool = search.startsWith(this.state.search)?this.state.dataSearch:this.state.data; const searchPool = search.startsWith(this.state.search)?this.state.dataSearch:this.state.data;
const ds = searchPool.filter((thing)=>{return thing.name.toLowerCase().startsWith(search.toLowerCase())}) const ds = searchPool.filter((thing)=>{return thing.name.toLowerCase().split(' ').some(x=>x.startsWith(search.toLowerCase()))})
this.setState({dataSearch: ds}) this.setState({dataSearch: ds})
}; };
clearSearch = (search)=>{ clearSearch = (search)=>{
@ -80,8 +79,6 @@ class Staff extends React.Component {
} }
render() { render() {
const { data , dataSearch, isLoading,search} = this.state; const { data , dataSearch, isLoading,search} = this.state;
console.log(data)
return ( return (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<SearchBar <SearchBar

View File

@ -40,14 +40,14 @@ class StudentWeek extends React.Component {
} }
render() { render() {
console.log(this.state.data)
if (this.state.isLoading) { if (this.state.isLoading) {
return <View/> return <View/>
} else { } else {
const iconURI = this.state.data.icon !== undefined?`data:image/png;charset=utf-8;base64,${this.state.data.icon}`:'';
return ( return (
<View style={{paddingTop:'5%',paddingLeft:'10%',paddingRight:'10%'}}> <View style={{paddingTop:'5%',paddingLeft:'10%',paddingRight:'10%'}}>
<Text style={{fontSize:32,marginBottom:'10%',textAlign:'center'}}>{this.state.data.name}</Text> <Text style={{fontSize:32,marginBottom:'10%',textAlign:'center'}}>{this.state.data.name}</Text>
<Image style = {{height: '50%', width:'100%'}}source={this.state.data.icon} /> <Image style = {{height: '50%', width:'100%'}}source={{uri:iconURI}} />
<View style = {{paddingTop:'5%'}}> <View style = {{paddingTop:'5%'}}>
<Text style={{fontSize: 20}}>Grade {this.state.data.year}</Text> <Text style={{fontSize: 20}}>Grade {this.state.data.year}</Text>
<Text style={{fontSize: 20}}>{"\n"}Hobbies: {this.state.data.hobbies}</Text> <Text style={{fontSize: 20}}>{"\n"}Hobbies: {this.state.data.hobbies}</Text>

View File

@ -1 +1 @@
{"url":"http://127.0.0.1:5000"} {"url":"http://10.0.2.2:5000"}