From e663cc9a9538850ea55064e45a00f36129a01595 Mon Sep 17 00:00:00 2001 From: M10T Date: Thu, 13 Aug 2020 18:55:10 -0400 Subject: [PATCH] Added tweak to announcements and json for url of CMS --- app/Announcements.js | 7 ++++++- app/App.js | 8 -------- app/Clubs.js | 3 ++- app/LunchEvents.js | 3 ++- app/resources/fetchInfo.json | 1 + app/styles/liststyles.js | 7 +++++++ 6 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 app/resources/fetchInfo.json diff --git a/app/Announcements.js b/app/Announcements.js index 6d63080..85b41f9 100644 --- a/app/Announcements.js +++ b/app/Announcements.js @@ -18,10 +18,15 @@ import { } from 'react-native/Libraries/NewAppScreen'; import styles from './styles/liststyles' +import { url } from './resources/fetchInfo.json' const Announcement = ({item}) => { + const date = new Date + const dateStr = `${date.getMonth()+1}/${date.getUTCDate()}/${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} ) @@ -37,7 +42,7 @@ class Announcements extends React.Component { } componentDidMount() { - fetch('https://6dc2642ae9b3.ngrok.io/api/en/announcements',{ + fetch(`${url}/api/en/announcements`,{ headers: { 'Cache-Control': 'no-cache' } diff --git a/app/App.js b/app/App.js index 1f0549b..bd5316e 100644 --- a/app/App.js +++ b/app/App.js @@ -1,11 +1,3 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * @format - * @flow strict-local - */ - import React from 'react'; import { SafeAreaView, diff --git a/app/Clubs.js b/app/Clubs.js index 4268b1e..d69cc67 100644 --- a/app/Clubs.js +++ b/app/Clubs.js @@ -20,6 +20,7 @@ import { } from 'react-native/Libraries/NewAppScreen'; import { SearchBar } from 'react-native-elements'; import styles from './styles/liststyles' +import { url } from './resources/fetchInfo.json' const ClubElement = ({item}) => { const [visible, setVisible] = useState(0) @@ -49,7 +50,7 @@ class Clubs extends React.Component { componentDidMount() { - fetch('https://6dc2642ae9b3.ngrok.io/api/en/clubs',{ + fetch(`${url}/api/en/clubs`,{ headers: { 'Cache-Control': 'no-cache' } }) diff --git a/app/LunchEvents.js b/app/LunchEvents.js index 2134fc8..4bc67e2 100644 --- a/app/LunchEvents.js +++ b/app/LunchEvents.js @@ -19,6 +19,7 @@ import { } from 'react-native/Libraries/NewAppScreen'; import styles from './styles/liststyles' +import { url } from './resources/fetchInfo.json' const LunchEvent = ({item}) => { const [visible, setVisible] = useState(0) @@ -43,7 +44,7 @@ class LunchEvents extends React.Component { } componentDidMount() { - fetch('https://6dc2642ae9b3.ngrok.io/api/en/lunchEvents',{ + fetch(`${url}/api/en/lunchEvents`,{ headers: { 'Cache-Control': 'no-cache' } diff --git a/app/resources/fetchInfo.json b/app/resources/fetchInfo.json new file mode 100644 index 0000000..733b8a7 --- /dev/null +++ b/app/resources/fetchInfo.json @@ -0,0 +1 @@ +{"url":"http://10.0.2.2:5000"} \ No newline at end of file diff --git a/app/styles/liststyles.js b/app/styles/liststyles.js index a785e82..ba1885c 100644 --- a/app/styles/liststyles.js +++ b/app/styles/liststyles.js @@ -14,6 +14,13 @@ const styles = StyleSheet.create({ title: { fontSize: 32, }, + date: { + fontSize:12, + marginBottom:'-3%', + alignSelf:'flex-end', + marginTop:'-3%', + marginRight:'-3%' + } }); export default styles; \ No newline at end of file