From dae85bb30cff6113bb851d820417fdad8bd42018 Mon Sep 17 00:00:00 2001 From: Emily Liu Date: Mon, 7 Dec 2020 01:07:07 -0500 Subject: [PATCH] improved calendar pg --- app/Calendar.js | 74 +++++++++++++++++++++++++++++----------- app/Resources.js | 4 +-- app/assets/calendar.png | Bin 0 -> 6201 bytes 3 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 app/assets/calendar.png diff --git a/app/Calendar.js b/app/Calendar.js index 376e149..a07348e 100644 --- a/app/Calendar.js +++ b/app/Calendar.js @@ -7,47 +7,74 @@ import { Text, StatusBar, FlatList, - TouchableOpacity + TouchableOpacity, + Image, } from 'react-native'; -import { - Header, - LearnMoreLinks, - Colors, - DebugInstructions, +import { ReloadInstructions, } from 'react-native/Libraries/NewAppScreen'; +import LinearGradient from 'react-native-linear-gradient'; + import styles from './styles/liststyles' import { url } from './resources/fetchInfo.json' +const getCurrentDate=()=>{ + var date = new Date().getDate(); + var month = new Date().getMonth() + 1; + var year = new Date().getFullYear(); + + return year + '-' + month + '-' + date; +} + const Event = ({item}) => { const [visible, setVisible] = useState(false) - const date = item.item.date.split('-') + const date = item.item.date.split('-') + const today = new Date(getCurrentDate()) + const itemDate = new Date(item.item.date) + const extra = ( <> {item.item.text} Location: {item.item.location} - Date: {`${date[1]}/${date[2]}/${date[0]}`} + Date: {`${date[1]}/${date[2]}/${date[0]}`} - ) - return ( - setVisible(!visible)} activeOpacity={0.8}> - {item.item.title} + ) + if (itemDate >= today) { + return ( + setVisible(!visible)} activeOpacity={0.8}> + + + {item.item.title} + + {visible?extra:<>} + + ) + } + else { + return ( + setVisible(!visible)} activeOpacity={0.8}> + + + {item.item.title} + {visible?extra:<>} - ) + ) + } + } class Calendar extends React.Component { - + constructor(props) { super(props) this.state = { data: [] } } - + componentDidMount() { this.getData() this.props.navigation.addListener( @@ -57,7 +84,7 @@ class Calendar extends React.Component { } ); } - + getData() { fetch(`${url}/api/en/events`,{ headers: { @@ -73,10 +100,19 @@ class Calendar extends React.Component { }) .catch((error) => console.error(error)) } - + render() { return ( - + + + + Calendar + + + } @@ -84,7 +120,7 @@ class Calendar extends React.Component { /> ) - } + } } export default Calendar; \ No newline at end of file diff --git a/app/Resources.js b/app/Resources.js index e41fb38..60fd6c9 100644 --- a/app/Resources.js +++ b/app/Resources.js @@ -24,7 +24,7 @@ function ResourceLink(props) { return ( Linking.openURL(props.url)}> - + {props.name} @@ -34,7 +34,7 @@ function ResourceLink(props) { class Resources extends React.Component { render() { return ( - + diff --git a/app/assets/calendar.png b/app/assets/calendar.png new file mode 100644 index 0000000000000000000000000000000000000000..02f337fb1a1f1ff396f37e1bbe2f6c8c2736a214 GIT binary patch literal 6201 zcmV-97{=#`P)4Tx0C=30mj_&vM;pNJ9hoGoKm=rjy+n~2Kt>2Ff`CjxR6-I+7%?UU5jV9| z!Ma5hM@6e57Ohr5>OjOgi{iG9#(_$u7OS{W`7Q%$?Kghk{eJh}KhHh)-19uSd*3?% z3{-rXtPnK>ph#LQPl^s_P0Gk*ksbm)KmsUm1>SstLdHoX<~Uy zk~)5v!y5(DW7SN9+$+tAPf+I?@*9azn|AEt=Nk|-WzxLVLsNii=)H+Hc|5t*#BxluknDPf3nhy84s4!YBw}Wh9`c|Zg_bdsSF>6#uXd?tf3 z@H-?CPz;X?*Yt`&36y^rmTI3KAXn2{q8U*D9ziYwv7iwCR%%8`hi6Lz51~ZzkJ$y# z*Fsp;egBkkpd?NwQ4ZN<84PI>BZ(2j7-AIB6}P}c@E|-6KEq)3!r6Ghkhg#76CM$| z2=@tB2`a+PX_9jJXTD4TDri4S7je#~5#vtKrY|0j2Se-7GS0*;fCuga=i%U?aAsd9 z@e00SlBVF1v`%&QS$L?ubWey zNrh*FXOHK5T^}eGl@_Zv7ufPC;AS8s2Fc5RZ2605(5if*|gdmYf9Fl}&AlXPB zB1M$Q9OMh63R#70K(-?F$oI%0VLS!BcSoJ_DbJFU2?DyYMEw1HX*l!~5`$1UkWz z;7$l6@CcI#d4!pS3PLqu2j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