From 62146eccd18d2b205997e0199130b5c29f96aa29 Mon Sep 17 00:00:00 2001 From: M10T Date: Fri, 6 Nov 2020 16:34:17 -0500 Subject: [PATCH] Some small changes throughout the app to improve it --- app/Announcements.js | 12 ++++++------ app/Clubs.js | 5 ++++- app/LunchEvents.js | 27 +-------------------------- app/More.js | 23 ++++++++++++++++++++--- app/SSLOps.js | 25 +------------------------ app/Staff.js | 7 ++++--- app/styles/liststyles.js | 10 ++++++---- package-lock.json | 5 +++++ package.json | 1 + 9 files changed, 48 insertions(+), 67 deletions(-) diff --git a/app/Announcements.js b/app/Announcements.js index 75fd103..e0ac1fc 100644 --- a/app/Announcements.js +++ b/app/Announcements.js @@ -31,9 +31,9 @@ const Announcement = ({item}) => { const dateStr = `${date.getMonth()+1}/${date.getDate()}/${date.getFullYear()}` const dateInfo = dateStr===item.item.date&&item.item.time!==undefined?item.item.time:item.item.date; return ( - + {dateInfo!==undefined?{dateInfo}:<>} - {item.item.message} + {item.item.message} ) } @@ -51,13 +51,13 @@ export const TeacherList = ({route}) => { } function TeacherButton(props) { - const [color, setColor] = useState(props.color?props.color:'white') + const [color, setColor] = useState(props.color?props.color:'lightgrey') return ( - + props.navigation.navigate('TeacherList',{data:props.data,name:props.name})} activeOpacity={0.8}> {props.name} - {props.icon?{setColor(color=='yellow'?'white':'yellow');props.addFavorite(props.name)}}/>:<>} + {props.icon?{setColor(color=='#dba309'?'lightgrey':'#dba309');props.addFavorite(props.name)}}/>:<>} ) } @@ -120,7 +120,7 @@ class Announcements extends React.Component { x.teacher==null||x.teacher.trim()==='')} name="No Teacher" navigation={this.props.navigation} /> this.state.favoriteNames.map(({name})=>name).indexOf(x.name) < 0))} - renderItem={({item})=>= 0?'yellow':'white'} item={item} data={this.state.data.filter(x=>x.teacher===item.name)} name={item.name} navigation={this.props.navigation} icon={true} addFavorite={this.addFavorite}/>} + renderItem={({item})=>= 0?'#dba309':'lightgrey'} item={item} data={this.state.data.filter(x=>x.teacher===item.name)} name={item.name} navigation={this.props.navigation} icon={true} addFavorite={this.addFavorite}/>} keyExtractor={(item,index)=>item.name+index} /> diff --git a/app/Clubs.js b/app/Clubs.js index 10e2adf..be9ff88 100644 --- a/app/Clubs.js +++ b/app/Clubs.js @@ -25,6 +25,7 @@ import { NavigationContainer } from '@react-navigation/native' import { createStackNavigator } from '@react-navigation/stack' import { SearchBar } from 'react-native-elements'; import styles from './styles/liststyles' +import morestyles from './styles/morestyles' import { url } from './resources/fetchInfo.json' import LinearGradient from 'react-native-linear-gradient'; @@ -79,7 +80,9 @@ function Club () { name = "ClubInfo" component = {ClubInfo} options={({route})=>({ - title:route.params.name + title:route.params.name, + headerTitleStyle:[morestyles.headerTitle,{alignSelf:'center'}], + headerRight:()=>(<>) })} /> diff --git a/app/LunchEvents.js b/app/LunchEvents.js index 8309934..1be04d5 100644 --- a/app/LunchEvents.js +++ b/app/LunchEvents.js @@ -28,7 +28,6 @@ export const LunchInfo = ({route}) => { const item = route.params; return ( - {item.name} Description: {item.text} @@ -55,30 +54,6 @@ function LunchEvent (props) { ) } -function Lunch () { - return ( - - - - ({ - headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}], - title:route.params.name - })} - /> - - - ) - } - class LunchEvents extends React.Component { constructor(props) { @@ -117,5 +92,5 @@ class LunchEvents extends React.Component { } } -export default Lunch; +export default LunchEvents; diff --git a/app/More.js b/app/More.js index 8b41d90..99fcf3d 100644 --- a/app/More.js +++ b/app/More.js @@ -25,8 +25,8 @@ import styles from './styles/morestyles' import Announcements, {TeacherList} from './Announcements' import Resources from './Resources' import StudentWeek from './StudentWeek' -import SSLOps from './SSLOps' -import LunchEvents from './LunchEvents' +import SSLOps, {SSLInfo} from './SSLOps' +import LunchEvents, {LunchInfo} from './LunchEvents' import ChallengeWeek from './ChallengeWeek' import { LinearGradient } from 'react-native-linear-gradient' @@ -133,7 +133,24 @@ class More extends React.Component { name="TeacherList" component={TeacherList} options={({route})=>({ - headerTitleStyle:[styles.headerTitle,{alignSelf:'center',marginLeft:"-20%"}], + headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}], + title:route.params.name, + headerRight:()=>(<>) + })} + /> + ({ + headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}], + title:route.params.name + })} + /> + ({ + headerTitleStyle:[styles.headerTitle,{alignSelf:'center'}], title:route.params.name })} /> diff --git a/app/SSLOps.js b/app/SSLOps.js index 737561a..d0818bb 100644 --- a/app/SSLOps.js +++ b/app/SSLOps.js @@ -30,7 +30,6 @@ export const SSLInfo = ({route}) => { console return ( - {item.name} Description: {item.text} @@ -60,28 +59,6 @@ function SSLElement (props) { ) } -function SSLOpp () { - return ( - - - - ({ - title:route.params.title - })} - /> - - - ) - } class SSLOps extends React.Component { @@ -121,4 +98,4 @@ class SSLOps extends React.Component { } } -export default SSLOpp; \ No newline at end of file +export default SSLOps; \ No newline at end of file diff --git a/app/Staff.js b/app/Staff.js index 4c4fcc2..ef10cb9 100644 --- a/app/Staff.js +++ b/app/Staff.js @@ -9,7 +9,8 @@ import { ActivityIndicator, FlatList, TouchableOpacity, - Image + Image, + Linking } from 'react-native'; import { @@ -24,8 +25,8 @@ import styles from './styles/liststyles' import { url } from './resources/fetchInfo.json' const StaffElement = ({item}) => { - const [visible, setVisible] = useState(0) - const extra = [...item.item.emails.map(email=>({'\n'}Email: {email}))] + const [visible, setVisible] = useState(false) + const extra = [...item.item.emails.map(email=>({'\n'}Email: Linking.openURL("mailto:"+email)}>{email}))] return( setVisible(!visible)} activeOpacity={0.8}> diff --git a/app/styles/liststyles.js b/app/styles/liststyles.js index 127eff8..f4a6dd6 100644 --- a/app/styles/liststyles.js +++ b/app/styles/liststyles.js @@ -6,12 +6,10 @@ const styles = StyleSheet.create({ marginTop: StatusBar.currentHeight || 0, }, item: { - backgroundColor: '#bababa', + backgroundColor: 'white', padding: 20, - marginHorizontal: 16, borderBottomWidth: 1.5, - borderColor: 'black', - borderRadius: 12, + borderColor: 'black' }, item1: { backgroundColor: 'white', @@ -63,6 +61,10 @@ const styles = StyleSheet.create({ fontWeight: 'bold', padding: 5, marginBottom: 10, + }, + linktext: { + color:'blue', + textDecorationLine: 'underline' } }); diff --git a/package-lock.json b/package-lock.json index 270abf5..5f4ed79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10136,6 +10136,11 @@ "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-2.10.1.tgz", "integrity": "sha512-Z2kKSk4AwWRQNCBmTjViuBQK0/Lx0jc25TZptn/2gKYUCOuVRvCekoA26u0Tsb3BIQ8tWDsZW14OwDlFUXW1aw==" }, + "react-native-splash-screen": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/react-native-splash-screen/-/react-native-splash-screen-3.2.0.tgz", + "integrity": "sha512-Ls9qiNZzW/OLFoI25wfjjAcrf2DZ975hn2vr6U9gyuxi2nooVbzQeFoQS5vQcbCt9QX5NY8ASEEAtlLdIa6KVg==" + }, "react-native-status-bar-height": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/react-native-status-bar-height/-/react-native-status-bar-height-2.5.0.tgz", diff --git a/package.json b/package.json index 5e21633..bce7cb8 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "react-native-reanimated": "^1.10.2", "react-native-safe-area-context": "^3.1.4", "react-native-screens": "^2.10.1", + "react-native-splash-screen": "^3.2.0", "react-native-vector-icons": "^7.0.0" }, "devDependencies": {