finished home pg + other minor stuff

This commit is contained in:
Emily Liu 2020-12-24 01:35:25 -05:00
parent 0bf2629664
commit d7d71ef594
6 changed files with 405 additions and 141 deletions

View File

@ -25,23 +25,29 @@ const getCurrentDate=()=>{
var month = new Date().getMonth() + 1; var month = new Date().getMonth() + 1;
var year = new Date().getFullYear(); var year = new Date().getFullYear();
return year + '-' + month + '-' + date; return year + ',' + month + ',' + date;
}
const getWeekDate=()=>{
var date = new Date().getDate()-8;
var month = new Date().getMonth()+1;
var year = new Date().getFullYear();
return year + ',' + month + ',' + date;
} }
const Event = ({item}) => { const Event = ({item}) => {
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const date = item.item.date.split('-')
const today = new Date(getCurrentDate()) const today = new Date(getCurrentDate())
const week = new Date().setDate(new Date().getDate() - 8)
const itemDate = new Date(item.item.date) const itemDate = new Date(item.item.date)
const week = new Date(getWeekDate())
const extra = ( const extra = (
<> <>
<Text style={{fontSize:20}}>{item.item.text}</Text> <Text style={{fontSize:20}}>{item.item.text}</Text>
<Text style={{fontSize:20}}>Location: {item.item.location}</Text> <Text style={{fontSize:20}}>Location: {item.item.location}</Text>
</> </>
) )
if (itemDate >= today) {
if (itemDate.getTime() >= today.getTime()) {
return ( return (
<TouchableOpacity style={styles.item1} onPress={()=>setVisible(!visible)} activeOpacity={0.8}> <TouchableOpacity style={styles.item1} onPress={()=>setVisible(!visible)} activeOpacity={0.8}>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center', justifyContent: 'space-between'}}> <View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center', justifyContent: 'space-between'}}>
@ -50,14 +56,14 @@ const Event = ({item}) => {
<Text style={styles.title3}>{item.item.title}</Text> <Text style={styles.title3}>{item.item.title}</Text>
</View> </View>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center'}}> <View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center'}}>
<Text style = {{fontSize: 16, alignSelf: 'center'}}>{`${date[1]}/${date[2]}/${date[0]}`}</Text> <Text style = {{fontSize: 16, alignSelf: 'center'}}>{item.item.date}</Text>
</View> </View>
</View> </View>
{visible?extra:<></>} {visible?extra:<></>}
</TouchableOpacity> </TouchableOpacity>
) )
} }
else if (itemDate >= week){ else if (itemDate.getTime() >= week.getTime()){
return ( return (
<TouchableOpacity style={{backgroundColor: '#e3e3e3', padding: 15, borderBottomWidth: 1, borderColor: 'black', width: '100%',}} onPress={()=>setVisible(!visible)} activeOpacity={0.8}> <TouchableOpacity style={{backgroundColor: '#e3e3e3', padding: 15, borderBottomWidth: 1, borderColor: 'black', width: '100%',}} onPress={()=>setVisible(!visible)} activeOpacity={0.8}>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center', justifyContent: 'space-between'}}> <View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center', justifyContent: 'space-between'}}>
@ -66,7 +72,7 @@ const Event = ({item}) => {
<Text style={styles.title3}>{item.item.title}</Text> <Text style={styles.title3}>{item.item.title}</Text>
</View> </View>
<View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center'}}> <View style = {{display: 'flex', flexDirection: 'row', alignContent: 'center'}}>
<Text style = {{fontSize: 16, alignSelf: 'center'}}>{`${date[1]}/${date[2]}/${date[0]}`}</Text> <Text style = {{fontSize: 16, alignSelf: 'center'}}>{item.item.date}</Text>
</View> </View>
</View> </View>
{visible?extra:<></>} {visible?extra:<></>}

View File

@ -36,15 +36,15 @@ export const ClubInfo = ({route}) => {
return ( return (
<View style = {{padding: 10, backgroundColor: 'white', height: '100%'}}> <View style = {{padding: 10, backgroundColor: 'white', height: '100%'}}>
<View style ={styles.infoContainer}> <View style ={styles.infoContainer}>
<Text style = {styles.title1}>Meeting Time and Day: </Text> <Text style = {[styles.title1, {fontSize: 24}]}>Meeting Time and Day: </Text>
<Text style = {{fontSize:20}}>{item.meeting}</Text> <Text style = {{fontSize:20}}>{item.meeting}</Text>
</View> </View>
<View style ={styles.infoContainer}> <View style ={styles.infoContainer}>
<Text style = {styles.title1}>Zoom Link: </Text> <Text style = {[styles.title1, {fontSize: 24}]}>Zoom Link: </Text>
<Text style = {[styles.linktext,{fontSize:20}]} onPress={() => Linking.openURL(item.link)}>{item.link}</Text> <Text style = {[styles.linktext,{fontSize:20}]} onPress={() => Linking.openURL(item.link)}>{item.link}</Text>
</View> </View>
<View style ={styles.infoContainer}> <View style ={styles.infoContainer}>
<Text style = {styles.title1}>Sponsor: </Text> <Text style = {[styles.title1, {fontSize: 24}]}>Sponsor: </Text>
<Text style = {{fontSize:20}}>{item.sponsor}</Text> <Text style = {{fontSize:20}}>{item.sponsor}</Text>
</View> </View>
</View> </View>
@ -65,6 +65,11 @@ function ClubElement (props) {
) )
} }
const background = (<LinearGradient
colors={['#f99', 'white']}
style = {{flex:1,borderBottomColor:'black',borderBottomWidth:0.5}}
/>)
function Club () { function Club () {
return ( return (
<NavigationContainer independent={true}> <NavigationContainer independent={true}>
@ -81,8 +86,8 @@ function Club () {
component = {ClubInfo} component = {ClubInfo}
options={({route})=>({ options={({route})=>({
title:route.params.name, title:route.params.name,
headerTitleStyle:[morestyles.headerTitle,{alignSelf:'center'}], headerTitleStyle:[morestyles.headerTitle,{alignSelf:'center'}],
headerRight:()=>(<></>) headerBackground: ()=>background
})} })}
/> />
</Stack.Navigator> </Stack.Navigator>

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,21 @@ import { url } from './resources/fetchInfo.json'
const StaffElement = ({item}) => { const StaffElement = ({item}) => {
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const extra = [...item.item.emails.map(email=>(<Text key={email}>{'\n'}Email: <Text style={styles.linktext} onPress={()=>Linking.openURL("mailto:"+email)}>{email}</Text></Text>))] const extra = (
[
...item.item.emails.map(email=>(
<View style={{display: 'flex', flexDirection: 'row', alignItems: 'center', marginTop: '2%', paddingHorizontal: '1%'}}>
<Image source={require('./assets/email.png')} style={{height: 22, width: 22}}/>
<Text key={email}><Text style={styles.linktext} onPress={()=>Linking.openURL("mailto:"+email)}>{' '}{email}</Text></Text>
</View>
)),
<View style={{display: 'flex', flexDirection: 'row', alignItems: 'center', marginTop: '2%', paddingHorizontal: '1%'}}>
<Image source = {require('./assets/dep.png')} style={{height: 22, width: 22}}/>
<Text>{' '}{item.item.department}</Text>
</View>
]
)
//const extra = [...item.item.emails.map(email=>(<Text key={email}>{'\n'}Email: <Text style={styles.linktext} onPress={()=>Linking.openURL("mailto:"+email)}>{email}</Text></Text>))]
return( return(
<View> <View>
<TouchableOpacity style={styles.item1} onPress={()=>setVisible(!visible)} activeOpacity={0.8}> <TouchableOpacity style={styles.item1} onPress={()=>setVisible(!visible)} activeOpacity={0.8}>

BIN
app/assets/dep.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
app/assets/email.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB