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 0000000..02f337f Binary files /dev/null and b/app/assets/calendar.png differ