From ede61a73a052835bbdb94c5abc7b87bafb582225 Mon Sep 17 00:00:00 2001 From: M10T Date: Fri, 9 Oct 2020 21:10:34 -0400 Subject: [PATCH] Changed some minor things, slightly improved search for teachers --- app/Resources.js | 80 +++++++++--------------------------- app/SSLOps.js | 2 - app/Staff.js | 13 +++--- app/StudentWeek.js | 4 +- app/resources/fetchInfo.json | 2 +- 5 files changed, 27 insertions(+), 74 deletions(-) diff --git a/app/Resources.js b/app/Resources.js index eb4986e..e41fb38 100644 --- a/app/Resources.js +++ b/app/Resources.js @@ -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 ( + Linking.openURL(props.url)}> + + + {props.name} + + + ) +} + class Resources extends React.Component { render() { return ( - - Linking.openURL('https://classroom.mcpsmd.org/')}> - - - - MyMCPS Classroom - - - - - - Linking.openURL('https://md-mcps-psv.edupoint.com/Home_PXP2.aspx')}> - - - - StudentVUE - - - - - - Linking.openURL('https://mbhs.edu/newsevents/Announcements/Montgomery%20Blair%20High%20School%20Final%20Bell%20Schedule%20.pdf')}> - - - - 1st Semester Schedule - - - - - - Linking.openURL('https://student.naviance.com/mbhs')}> - - - - Naviance - - - - - - Linking.openURL('https://blairblazersathletics.com/')}> - - - - Blair Athletics - - - - - - Linking.openURL('https://classroom.google.com/u/0/h')}> - - - - Google Classroom - - - - - + + + + + + ) } diff --git a/app/SSLOps.js b/app/SSLOps.js index 33da5b8..129125a 100644 --- a/app/SSLOps.js +++ b/app/SSLOps.js @@ -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 ( { - console.log(item) const [visible, setVisible] = useState(0) - const extra = visible?({'\n'}Email: {item.item.emails}):(<>); + const extra = [...item.item.emails.map(email=>(Email: {email}))] return( setVisible(!visible)} activeOpacity={0.8}> {item.item.name} - {extra} + {visible?extra:<>} ) @@ -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 ( } else { + const iconURI = this.state.data.icon !== undefined?`data:image/png;charset=utf-8;base64,${this.state.data.icon}`:''; return ( {this.state.data.name} - + Grade {this.state.data.year} {"\n"}Hobbies: {this.state.data.hobbies} diff --git a/app/resources/fetchInfo.json b/app/resources/fetchInfo.json index bc3cebe..733b8a7 100644 --- a/app/resources/fetchInfo.json +++ b/app/resources/fetchInfo.json @@ -1 +1 @@ -{"url":"http://127.0.0.1:5000"} \ No newline at end of file +{"url":"http://10.0.2.2:5000"} \ No newline at end of file