From f216cfb8721bcf19479a876c41c867aef394fa2f Mon Sep 17 00:00:00 2001 From: Emily Liu Date: Wed, 23 Dec 2020 00:23:53 -0500 Subject: [PATCH] Home page + others --- app/Calendar.js | 2 +- app/Home.js | 238 +++++++++++++++++++++++++++++------ app/More.js | 3 +- app/Poll.js | 57 +++++++-- app/assets/polls.png | Bin 0 -> 4549 bytes app/assets/unknown.png | Bin 0 -> 5923 bytes app/resources/fetchInfo.json | 2 +- app/styles/liststyles.js | 4 + 8 files changed, 255 insertions(+), 51 deletions(-) create mode 100644 app/assets/polls.png create mode 100644 app/assets/unknown.png diff --git a/app/Calendar.js b/app/Calendar.js index f24801e..8ee5bc7 100644 --- a/app/Calendar.js +++ b/app/Calendar.js @@ -118,7 +118,7 @@ class Calendar extends React.Component { render() { return ( - + { + var date = new Date().getDate(); + var month = new Date().getMonth() + 1; + var year = new Date().getFullYear(); + + return year + '-' + month + '-' + date; +} + +const Event = ({item}) => { + const calendarIconURI = item.item.image !== undefined?`data:image/png;charset=utf-8;base64,${item.item.image}`:'' + const [visible, setVisible] = useState(false) + const date = item.item.date.split('-') + const today = new Date(getCurrentDate()) + const week = new Date().setDate(new Date().getDate() - 8) + const itemDate = new Date(item.item.date) + + const extra = ( + <> + {item.item.text} + Location: {item.item.location} + + ) + if (itemDate >= today) { + return ( + setVisible(!visible)} activeOpacity={0.8}> + + + + {item.item.title} + {`${date[1]}/${date[2]}/${date[0]}`} + + + + ) + } + else if (itemDate >= week){ + return ( + setVisible(!visible)} activeOpacity={0.8}> + + + + {item.item.title} + {`${date[1]}/${date[2]}/${date[0]}`} + + + + ) + } + else { + return ( + null + ) + } +} + function Home1() { -const [modalVisible, setModalVisible] = useState(true); +const [modalVisible, setModalVisible] = useState(false); return ( - {setModalVisible(!modalVisible);}}> + {setModalVisible(false);}}> @@ -47,32 +114,109 @@ const [modalVisible, setModalVisible] = useState(true); ) } + class Home extends React.Component { constructor(props) { super(props) this.state = { - data: [], + studentData: [], + announcementsData:[], + challengeData:[], + data:[], isLoading:true } } - - /*componentDidMount() { - fetch(`${url}/api/en/popup`,{ + addFavorite = (name) => { + const favoriteNames = this.state.favoriteNames.slice().map(({name})=>name) + const index = favoriteNames.indexOf(name) + if (index < 0) { + favoriteNames.push(name) + } + else { + favoriteNames.splice(index,1) + } + favoriteNames.sort() + this.setState({favoriteNames:favoriteNames.map(name=>({name:name}))}) + AsyncStorage.setItem(STORAGE_KEY,JSON.stringify(favoriteNames)).catch(console.log).done() + } + componentDidMount() { + fetch(`${url}/api/en/student`,{ headers: { 'Cache-Control': 'no-cache' }} ).then((response) => { return response.text();list }).then((json) => { - this.setState({data: JSON.parse(json),isLoading:false}); + this.setState({studentData: JSON.parse(json),isLoading:false}); + }).catch((error) => console.error(error)) + + fetch(`${url}/api/en/challenge`,{ + headers: { + 'Cache-Control': 'no-cache' + }} + ).then((response) => { + return response.text(); + }).then((json) => { + this.setState({challengeData: JSON.parse(json),isLoading:false}); }).catch((error) => console.error(error)) - }*/ + + this.getData() + this.props.navigation.addListener( + 'focus', + () => { + this.getData() + } + ); + + this.getData1() + AsyncStorage.getItem(STORAGE_KEY) + .then(value=>value==null?[]:JSON.parse(value).map(x=>({name:x}))) + .then(names=>this.setState({favoriteNames:names})) + .catch(console.log) + .done() + } + + getData1() { + fetch(`${url}/api/en/announcements`,{ + headers: { + 'Cache-Control': 'no-cache' + } + } + ) + .then((response) => { + return response.text() + }) + .then((txt) => { + const data = JSON.parse(txt).data; + const teacherNames = [...new Set(data.filter(x=>x.teacher!=null&&x.teacher.trim()!=='').map(x=>x.teacher))]; + teacherNames.sort() + this.setState({data: data, teacherNames: teacherNames.map(x=>({name:x})),isLoading:false}); + }) + .catch((error) => console.error(error)) + } + + getData() { + fetch(`${url}/api/en/events`,{ + headers: { + 'Cache-Control': 'no-cache' + } }) + .then((response) => { + return response.text(); + }) + .then((json) => { + const data = JSON.parse(json).data + data.sort((a,b)=>new Date(b.date).getTime()-new Date(a.date).getTime()) + this.setState({data: data}); + }) + .catch((error) => console.error(error)) + } render() { - return ( + const iconURI = this.state.studentData.icon !== undefined?`data:image/png;charset=utf-8;base64,${this.state.studentData.icon}`:`data:image/png;charset-utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAMZWlDQ1BJQ0MgUHJvZmlsZQAASImVlwdck0cbwO8dmSSsQARkhL1EkRlARggrgoBMQVRCEkgYMSYEETe1VMG6RRRHRasiFq1WQOpAxDqL4raOxoFKpRaruFD5LgNq7Td+3/1+994/zz333PM8uXvfOwAMVHyZrBA1BKBIWixPig5nTcrIZJEeAhowABhwBCP5AoWMk5gYB2AZav9eXl0DiLq97KG29c/+/1qMhSKFAAAkC3KOUCEogtwGAF4ukMmLASBGQLn9zGKZmsWQTeTQQchz1Jyn5RVqztHydo1OShIXcgsAZBqfL88DQL8DylklgjxoR/8hZE+pUCIFwMAEcohAzBdCToE8qqhoupoXQHaB+jLIuyCzcz6xmfc3+znD9vn8vGHWxqUp5AiJQlbIn/V/puZ/l6JC5dAcTrDSxPKYJHX8MIc3CqbHqpkGuVeaE5+gzjXkNxKhNu8AoFSxMiZVq49aChRcmD/AhOwp5EfEQraEHCUtjI/TyXNyJVE8yHC1oKWSYl6KbuxikSIyWWdzo3x6UsIQ58q5HN3YRr5cM69av0NZkMrR2b8hFvGG7L8sE6ekQ6YCgFFLJGnxkPUhmygKkmO1OphdmZgbP6QjVyap/XeAzBZJo8O19rGsXHlUkk5fVqQYiherEEt48TquKRanxGjzg+0W8DX+m0FuEkk5qUN2RIpJcUOxCEURkdrYsU6RNFUXL3ZXVhyepBvbJytM1OnjZFFhtFpuB9lCUZKsG4uPK4aLU2sfj5MVJ6Zo/cSz8/njE7X+4CUgDnBBBGABJaw5YDrIB5LO3uZe+EvbEwX4QA7ygAh46CRDI9I1PVL4TAZl4HdIIqAYHheu6RWBEij/MCzVPj1Arqa3RDOiADyCXARiQSH8rdSMkg7PlgYeQonkH7MLoK+FsKr7/injQEmcTqIcsssyGNI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ExMTvC3o4kpJSRF0zhY2NjakC6u0tBS1tbXK1JSAVU7oh76hoUHpxNnK3t5eNgjxeegVRwnY3EFoaChrZUf9g+ET/ciapjVq7fPzc227XoGUgIuKioTNjY2NIJ0r0/T0NHp6erQUqUikMycJMF0A9G3xND8/j4+OibwfR65pHM3LyxNC0AVLFy1PEuDBwUGMj49rNqmpqaAW/w5E0xbdP+9UVlaGmpqad5F9SoCp98/OzjSj5uZm5ObmarIrLxYWFtDV1aWlGBYWJl1mEuDk5GRtAy2WlpbY6xdB6aICjZvZ2dlCdpubm4JsFbBg/Q0Fq4BpbFxZWfmG0OSUMzMz2fjJP5EqfHp6yoyMvoTjgzhjTSMmFS88PFwILwGmp09PTxgdHQW1g7XXLYI3FxDofzndQxUVFfDy8pIyUgKWrH6Q4tcB/gfQp6d6IzAQpwAAAABJRU5ErkJggg==`; + return ( - + - - - - Blair - - - - - - Blair - - - - - - Blair - - - + + + + What's New? + this.navigation.navigate(Calendar)}> + View All + + + + + } + keyExtractor={item=>JSON.stringify(item)} + horizontal + /> + + + + + + Student of the Week + + + + + + + {this.state.studentData.name} + Grade {this.state.studentData.year} + + + + Hobbies: {this.state.studentData.hobbies} + Achievements: {this.state.studentData.achievements} + Messages: {this.state.studentData.messages} + + + + + + Announcements + + + + ) } diff --git a/app/More.js b/app/More.js index 7a28bdd..65515fe 100644 --- a/app/More.js +++ b/app/More.js @@ -30,6 +30,7 @@ import SSLOps, {SSLInfo} from './SSLOps' import LunchEvents, {LunchInfo} from './LunchEvents' import ChallengeWeek from './ChallengeWeek' import Settings from './Settings' +import Poll from './Poll' import Images from './Images' import LinearGradient from 'react-native-linear-gradient' @@ -57,7 +58,7 @@ class MoreSwitch extends React.Component { renderItem={({item})=> this.props.navigation.navigate(item.key)}> - + {item.name} } diff --git a/app/Poll.js b/app/Poll.js index 153a1af..1b62029 100644 --- a/app/Poll.js +++ b/app/Poll.js @@ -6,6 +6,8 @@ import { View, Text, StatusBar, + Image, + TouchableOpacity, } from 'react-native'; import { @@ -16,19 +18,54 @@ import { ReloadInstructions, } from 'react-native/Libraries/NewAppScreen'; import {WebView} from 'react-native-webview'; +import LinearGradient from 'react-native-linear-gradient'; +import { Linking } from 'react-native'; +import { url } from './resources/fetchInfo.json' + class Poll extends React.Component { + + /*constructor(props) { + super(props) + this.state = { + data: [] + } +} + +componentDidMount() { + fetch(`${url}/api/en/lunchEvents`,{ + headers: { + 'Cache-Control': 'no-cache' + } + } + ) + .then((response) => { + return response.text(); + }) + .then((json) => { + this.setState({data: JSON.parse(json)}); + }) + .catch((error) => console.error(error)) +}*/ + render() { return ( - - + + + + Polls + + + + + Linking.openURL("https://google.com")}> + + + Press the image to take the poll! + + ) } } diff --git a/app/assets/polls.png b/app/assets/polls.png new file mode 100644 index 0000000000000000000000000000000000000000..ab4cb1894ec8d0a068260cf450602c459073a0f6 GIT binary patch literal 4549 zcmV;$5jyUPP)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*ksbmXFaQ{E1S9zZg^ZJ!7zbb(YX4qdT?2@^z3id3 z_0RtQT8xDvg#Z8~3v!N7At-{}1^`|zkjaYyAVxsB{mf#Sn#GV!+_Af2QVtm!d-D&>T*%(!}zZ zBz62Shc^nQ$EukIxmTJKpPNt7V(Dczbq4{q(i0xfKf{%Y4MQtA)6=)l4G?xm|dBe8$YBYS0<_bcYw?mNu$HH z_OYy7c~p{4Usj|TiWjR8OL*}*t|=C$#Ax$_?H2Gg{+mH=5=l9!Lv}=pNpVB52t^T* z+Ssv9ku+5oFLqZ}9G;{b+b1hb)am17QDL-NZU@;yQIf11i;pXYi&JYKkCPQArfB`d zv-A1m6Se-}B_IxPK?Gm{C9FAMI>-l-&fex;_)FUp1^7S?@_-0<=p;iU(ltF&_)G?6 z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known.png b/app/assets/unknown.png new file mode 100644 index 0000000000000000000000000000000000000000..2eb79d2b219160a1bb824521ec6189c06c76191f GIT binary patch literal 5923 zcmZ`+1z1$uw;xKnyE_Gj5Rjppp+QnQhK4~vYUoZ$>6VZ#0ciw5V3blRNkO_BssG@; z@819S-uL$Rt+UoydG^}-{PsC9S{h2YSX5X5000-PEU$y$;tz!J2yq47%(?>rI1mRp zIW4f99D|lS)Yicn0stt-yv{&3NmZimJ)q5Esg_2y3Gb3mrj%C1cpMt6CZj7$q)frj zhDs>Xtoxx|fka86iixa7UwT{mBPi}?%d5c>y;Y9vq8E?{X91??~bldG`tE}vSB=xm%nIVsF zx#hn|9Y-gQy%IE3h{)Zs0X9?xz%dl*9+VLy)=+VKrF%vj%?d3hwBBA+_h{+Q*W!9rMgKXl0!cn0$5uzgD13;l}g8-XeRpN6j5|d1+-tb+{ zHKmWTE#Wk*Jn@NNhdta`wZ(_rnhQ%)tjuCvcde3{1dQxF-uV0J^bu@~w9zcgD0Z6& z);;f$GfEnnnC)RCJBr-x;U+FGkt;(E)>dV4I7&KW%;CUFv2F%snr3BEOO-GiuvOf8 z2Y)65zv*v2Z>To$)lJbb*Ds-nC9fh-^*I97a*~yQv_A>kBRdqj%aL&<0*hA2dCA9u zU&u9JC=e#k%`|8vKhYxxdKu``(XJqg_hl9S39hY_iBP zPYOxsT&g{SEPE?66;jZV*KU!95OLh|aetSTkghFjl@}}qh=-b>TFEfp)O?Fi!5d3| zL?;`wM&E>8SQk-Wd40#ZDhP(gZ?@6klBVmvrZJAJmh+RFwLXI5nNS zQtciElPoB>2IoiAC)}D48^_c3YFK`15S+2BrmU~GHpKR#6DwX{5jxdsij1^XoxFSo z*i*jar#BZV2c=?-JsP7MyJ(lx;^yMfhw|-v&T_Z0XqtTf*;^MJJ&=l}m}uqe>*tGH zcvog`{tTFz4Mpn{zs{(>Aq0GQhK`Pof6p5C1F0?!bGOPbUWX(|-g z0(<6>SI9wc;5ZIm*y=L78=eWO!3UoA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