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,
Linking,
Image,
TouchableOpacity
} from 'react-native';
import {
@ -18,71 +19,28 @@ import {
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
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 {
render() {
return (
<ScrollView>
<View style = {styles.resourceContainer}>
<Text onPress={() => Linking.openURL('https://classroom.mcpsmd.org/')}>
<Image source ={require('./assets/canvaslogo.png')} style = {styles.image}/>
<View style = {styles.textContainer}>
<Text style = {styles.resourceText}>
MyMCPS 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>
<ResourceLink url='https://classroom.mcpsmd.org/' img={require('./assets/canvaslogo.png')} name='MyMCPS Classroom'/>
<ResourceLink url='https://md-mcps-psv.edupoint.com/Home_PXP2.aspx' img={require('./assets/studentvue.jpg')} name='StudentVUE'/>
<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'/>
<ResourceLink url='https://student.naviance.com/mbhs' img={require('./assets/naviance.png')} name='Naviance'/>
<ResourceLink url='https://blairblazersathletics.com/' img={require('./assets/athletics.jpg')} name='Blair Athletics'/>
<ResourceLink url='https://classroom.google.com/u/0/h' img={require('./assets/googleclassroom.jpg')} name='Google Classroom'/>
</ScrollView>
)
}

View File

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

View File

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

View File

@ -40,14 +40,14 @@ class StudentWeek extends React.Component {
}
render() {
console.log(this.state.data)
if (this.state.isLoading) {
return <View/>
} else {
const iconURI = this.state.data.icon !== undefined?`data:image/png;charset=utf-8;base64,${this.state.data.icon}`:'';
return (
<View style={{paddingTop:'5%',paddingLeft:'10%',paddingRight:'10%'}}>
<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%'}}>
<Text style={{fontSize: 20}}>Grade {this.state.data.year}</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"}