mirror of
https://github.com/Blair-SGA-Dev-Team/blazerapp.git
synced 2026-07-16 06:50:22 -04:00
templates
This commit is contained in:
+13
-6
@@ -40,14 +40,22 @@ const getCurrentDate=()=>{
|
||||
const Announcement = ({item}) => {
|
||||
const todayDate = getCurrentDate()
|
||||
const itemDate = new Date(item.item.date)
|
||||
const dateInfo = todayDate.getTime()===itemDate.getTime()&&item.item.time!==undefined?item.item.time:(item.item.date+", " + item.item.time)
|
||||
|
||||
var time_array = item.item.time.split(':')
|
||||
if (time_array[0]>12) {
|
||||
var time = String(parseInt(time_array[0])-12) + ':' + String(time_array[1]) + ' PM'
|
||||
}
|
||||
else {
|
||||
var time = String(time_array[0])+':'+String(time_array[1]) + ' AM'
|
||||
}
|
||||
const dateInfo = todayDate.getTime()===itemDate.getTime()&&item.item.time!==undefined?item.item.time:(item.item.date+", " + time)
|
||||
return (
|
||||
<View style={{borderWidth: 1, borderColor: '#323232', padding: '2%', marginHorizontal: '2%', marginBottom: '2%', borderRadius: 12}}>
|
||||
<View style = {{display: 'flex', flexDirection: 'column', justifyContent: 'space-between'}}>
|
||||
<View style = {{width: '100%'}}>
|
||||
<Text style={styles.title}>{item.item.message}</Text>
|
||||
</View>
|
||||
{dateInfo!==undefined?<Text style={{fontSize: 12, fontWeight: '200'}}>{dateInfo}</Text>:<></>}
|
||||
{dateInfo!==undefined?<Text style={{fontSize: 12, fontWeight: '200'}}>Posted {dateInfo}</Text>:<></>}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
@@ -84,7 +92,7 @@ export const TeacherList = ({route}) => {
|
||||
var futureBoolean = true
|
||||
|
||||
for (var i = 0; i < route.params.data.length; i++) {
|
||||
const itemDate = new Date(route.params.data[i].date)
|
||||
const itemDate = new Date(parseInt(String(route.params.data[i].date).split('-')[0]), parseInt(String(route.params.data[i].date).split('-')[1])-1, parseInt(String(route.params.data[i].date).split('-')[2]))
|
||||
if (itemDate.getTime() == todayDate.getTime()) {
|
||||
today.push(route.params.data[i])
|
||||
}
|
||||
@@ -173,8 +181,8 @@ class Announcements extends React.Component {
|
||||
return response.text()
|
||||
})
|
||||
.then((txt) => {
|
||||
const data = JSON.parse(txt).data;
|
||||
console.log(data)
|
||||
const data = JSON.parse(txt);
|
||||
data.sort((a,b)=>a.id-b.id)
|
||||
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});
|
||||
@@ -185,7 +193,6 @@ class Announcements extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<ScrollView style={styles.moreDefault}>
|
||||
<TeacherButton data={this.state.data.filter(x=>x.teacher==null||x.teacher.trim()==='')} name="No Teacher" navigation={this.props.navigation} />
|
||||
<FlatList
|
||||
data={this.state.favoriteNames.concat(this.state.teacherNames.filter(x=>this.state.favoriteNames.map(({name})=>name).indexOf(x.name) < 0))}
|
||||
renderItem={({item})=><TeacherButton color={this.state.favoriteNames.indexOf(item) >= 0?'red':'lightgrey'} item={item} data={this.state.data.filter(x=>x.teacher===item.name)} name={item.name} navigation={this.props.navigation} icon={true} addFavorite={this.addFavorite}/>}
|
||||
|
||||
+1
-1
@@ -174,7 +174,7 @@ class Calendar extends React.Component {
|
||||
}
|
||||
|
||||
getData() {
|
||||
fetch(`http://127.0.0.1:8080/api/en/events`,{
|
||||
fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/events`,{
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache'
|
||||
} })
|
||||
|
||||
+20
-62
@@ -28,7 +28,8 @@ class ChallengeWeek extends React.Component {
|
||||
super(props)
|
||||
this.state = {
|
||||
isLoading: true,
|
||||
flip: true
|
||||
flip: true,
|
||||
data:[]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,74 +41,31 @@ class ChallengeWeek extends React.Component {
|
||||
).then((response) => {
|
||||
return response.text();
|
||||
}).then((json) => {
|
||||
this.setState({data: JSON.parse(json),isLoading:false});
|
||||
const data = JSON.parse(json)
|
||||
data.sort((a,b)=>a.id-b.id)
|
||||
this.setState({data: data,isLoading:false});
|
||||
}).catch((error) => console.error(error))
|
||||
|
||||
/*this.animatedValue=new Animated.Value(0);
|
||||
this.value=0;
|
||||
this.animatedValue.addListener(({value}) => {
|
||||
this.value=value;
|
||||
})
|
||||
this.frontInterpolate = this.animatedValue.interpolate({
|
||||
inputRange:[0,180],
|
||||
outputRange:['0deg', '180deg'],
|
||||
})
|
||||
this.backInterpolate = this.animatedValue.interpolate({
|
||||
inputRange:[0,180],
|
||||
outputRange: ['180deg','360deg']
|
||||
})*/
|
||||
}
|
||||
|
||||
/*flipCard() {
|
||||
if (this.value >= 90) {
|
||||
Animated.spring(this.animatedValue, {
|
||||
toValue:0,
|
||||
friction:8,
|
||||
tension: 10
|
||||
}).start();
|
||||
}
|
||||
else {
|
||||
Animated.spring(this.animatedValue, {
|
||||
toValue:180,
|
||||
friction: 8,
|
||||
tension: 10
|
||||
}).start();
|
||||
}
|
||||
this.setState({flip:!this.state.flip})
|
||||
}*/
|
||||
|
||||
render() {
|
||||
{/*const frontAnimatedStyle = {
|
||||
transform: [
|
||||
{rotateY:this.frontInterpolate}
|
||||
]
|
||||
}
|
||||
const backAnimatedStyle = {
|
||||
transform: [
|
||||
{rotateY:this.backInterpolate}
|
||||
]
|
||||
}
|
||||
var styling={}
|
||||
var styling2={}
|
||||
if (this.state.flip) {
|
||||
styling=({height: '100%', width: '100%', backgroundColor: 'white', borderRadius: 20, textAlign: 'center', display: 'flex', alignContent: 'center', padding: '5%', paddingTop: '15%', borderColor: 'red', borderWidth: 1})
|
||||
styling2=({display:'none'})
|
||||
}
|
||||
else {
|
||||
styling=({display:'none'})
|
||||
styling2=({height: '100%', width: '100%', backgroundColor: 'white', borderRadius: 20, textAlign: 'center', display: 'flex', alignContent: 'center', padding: '5%', paddingTop: '15%', borderColor: 'red', borderWidth: 1})
|
||||
}*/}
|
||||
|
||||
if (this.state.isLoading) {
|
||||
return <View/>
|
||||
} else {
|
||||
return (
|
||||
<View style={{alignItems:'center',paddingiorizontal:'10%', height: '100%', backgroundColor: 'white', justifyContent: 'center', padding: '2%'}}>
|
||||
<Text style={{fontSize: 32, fontWeight: 'bold', marginBottom: '10%', color: 'red', textAlign: 'center'}}>{this.state.data.title}</Text>
|
||||
<Text style={{textAlign:'center', fontSize: 24, marginBottom: '5%', textAlign: 'center', fontWeight: '200'}}>{this.state.data.text}</Text>
|
||||
<Text style={{textAlign:'center', fontSize: 20, textDecorationLine: 'underline', textDecorationStyle: "solid", textDecorationColor: "#000"}} onPress={() => Linking.openURL(this.state.data.link)}>{I18n.t("challenge.link")}</Text>
|
||||
</View>
|
||||
)
|
||||
if (this.state.data[this.state.data.length-1]==undefined) {
|
||||
return (
|
||||
<View style={{alignItems:'center',paddingiorizontal:'10%', height: '100%', backgroundColor: 'white', justifyContent: 'center', padding: '2%'}}>
|
||||
<Text style={{fontSize: 32, fontWeight: 'bold', marginBottom: '10%', color: 'red', textAlign: 'center'}}>No challenge</Text>
|
||||
</View>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<View style={{alignItems:'center',paddingiorizontal:'10%', height: '100%', backgroundColor: 'white', justifyContent: 'center', padding: '2%'}}>
|
||||
<Text style={{fontSize: 32, fontWeight: 'bold', marginBottom: '10%', color: 'red', textAlign: 'center'}}>{this.state.data[this.state.data.length-1].title}</Text>
|
||||
<Text style={{textAlign:'center', fontSize: 24, marginBottom: '5%', textAlign: 'center', fontWeight: '200'}}>{this.state.data[this.state.data.length-1].text}</Text>
|
||||
<Text style={{textAlign:'center', fontSize: 20, textDecorationLine: 'underline', textDecorationStyle: "solid", textDecorationColor: "#000"}} onPress={() => Linking.openURL(this.state.data[this.state.data.length-1].link)}>{I18n.t("challenge.link")}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -148,8 +148,12 @@ class Clubs extends React.Component {
|
||||
return response.text();
|
||||
})
|
||||
.then((json) => {
|
||||
this.setState({data: JSON.parse(json).clubs,dataSearch:JSON.parse(json).clubs });
|
||||
const data = JSON.parse(json)
|
||||
data.sort((a,b)=>a.id-b.id)
|
||||
this.setState({data: data,dataSearch:data });
|
||||
console.log(this.state.data)
|
||||
})
|
||||
|
||||
.catch((error) => console.error(error))
|
||||
}
|
||||
|
||||
|
||||
+51
-21
File diff suppressed because one or more lines are too long
+2
-1
@@ -54,7 +54,8 @@ export default {
|
||||
},
|
||||
lunch: {
|
||||
information: "Information",
|
||||
location: "Location"
|
||||
location: "Location",
|
||||
time: "Time of Event"
|
||||
},
|
||||
ssl: {
|
||||
information: "Information",
|
||||
|
||||
+2
-1
@@ -54,7 +54,8 @@ export default {
|
||||
},
|
||||
lunch: {
|
||||
information: "ESInformation",
|
||||
location: "ESLocation"
|
||||
location: "ESLocation",
|
||||
time:"ES TIME OF EVENT"
|
||||
},
|
||||
ssl: {
|
||||
information: "ESInformation",
|
||||
|
||||
+21
-3
@@ -55,6 +55,14 @@ const Stack = createStackNavigator();
|
||||
function LunchEvent (props) {
|
||||
const item = props.item
|
||||
const [expand, setExpand] = useState(false);
|
||||
|
||||
var time_array = item.time.split(':')
|
||||
if (time_array[0]>12) {
|
||||
var time = String(parseInt(time_array[0])-12) + ':' + String(time_array[1]) + ' PM'
|
||||
}
|
||||
else {
|
||||
var time = String(time_array[0])+':'+String(time_array[1]) + ' AM'
|
||||
}
|
||||
return(
|
||||
<View>
|
||||
<TouchableOpacity style={styles.listItem} onPress={()=>setExpand(!expand)}>
|
||||
@@ -65,7 +73,15 @@ function LunchEvent (props) {
|
||||
{expand?<LinearGradient start={{x: 0, y: 0.25}} end={{x: .5, y: 1}} colors={['red', '#FF7373']} style={{borderRadius: 24, alignSelf: 'center'}}><Image source = {require('./assets/collapse.png')} style={{tintColor: 'white'}}/></LinearGradient>:<Image source = {require('./assets/expand.png')} style={{tintColor: '#b2b2b2', alignSelf: 'center'}}/>}
|
||||
</View>
|
||||
</View>
|
||||
{expand?<View style={{marginLeft: 50}}><Text style={styles.accordianHeader}>{I18n.t('lunch.information')}</Text><Text style={styles.accordianText}>{item.text}</Text><Text style={styles.accordianHeader}>{'\n'}{I18n.t('lunch.location')}</Text><Text style={[styles.accordianText, {paddingBottom: '4%'}]}>{item.loc}</Text></View>:<></>}
|
||||
{expand?
|
||||
<View style={{marginLeft: 50}}>
|
||||
<Text style={styles.accordianHeader}>{I18n.t('lunch.information')}</Text>
|
||||
<Text style={styles.accordianText}>{item.text}</Text>
|
||||
<Text style={styles.accordianHeader}>{'\n'}{I18n.t('lunch.location')}</Text>
|
||||
<Text style={[styles.accordianText, {paddingBottom: '4%'}]}>{item.location}</Text>
|
||||
<Text syle={styles.accordianHeader}>{'\n'}{I18n.t('lunch.time')}</Text>
|
||||
<Text style={[styles.accordianText, {paddingBottom: '4%'}]}>{time}</Text>
|
||||
</View>:<></>}
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
)
|
||||
@@ -81,7 +97,7 @@ class LunchEvents extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/lunchEvents`,{
|
||||
fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/lunch_events`,{
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache'
|
||||
}
|
||||
@@ -91,7 +107,9 @@ class LunchEvents extends React.Component {
|
||||
return response.text();
|
||||
})
|
||||
.then((json) => {
|
||||
this.setState({data: JSON.parse(json)});
|
||||
const data = JSON.parse(json)
|
||||
data.sort((a,b)=>a.id-b.id)
|
||||
this.setState({data: data});
|
||||
})
|
||||
.catch((error) => console.error(error))
|
||||
}
|
||||
|
||||
+45
-12
@@ -80,21 +80,54 @@ import {
|
||||
DebugInstructions,
|
||||
ReloadInstructions,
|
||||
} from 'react-native/Libraries/NewAppScreen';
|
||||
import { url } from './resources/fetchInfo.json'
|
||||
import {WebView} from 'react-native-webview';
|
||||
import I18n from 'i18n-js';
|
||||
|
||||
class Poll extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
data:[]
|
||||
}
|
||||
}
|
||||
componentDidMount() {
|
||||
fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/polls`,{
|
||||
headers: {
|
||||
'Cache-Control': 'no-cache'
|
||||
}}
|
||||
).then((response) => {
|
||||
return response.text();
|
||||
}).then((json) => {
|
||||
const data = JSON.parse(json)
|
||||
data.sort((a,b)=>a.id-b.id)
|
||||
this.setState({data: data});
|
||||
}).catch((error) => console.error(error))
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<WebView
|
||||
source = {{uri: 'https://docs.google.com/forms/d/e/1FAIpQLSfR0XP2yo3TV3egz7aMok56wnP9kG4FQt2v3rHrrayf8uC7Vw/viewform?usp=sf_link'}}
|
||||
javaScriptEnabled={true}
|
||||
domStorageEnabled={true}
|
||||
startInLoadingState={true}
|
||||
style={{marginTop: 0}}
|
||||
cacheEnabled={true}
|
||||
|
||||
/>
|
||||
|
||||
)
|
||||
if (this.state.isLoading) {
|
||||
return <View/>
|
||||
} else {
|
||||
if (this.state.data.length==0) {
|
||||
return (
|
||||
<View style={{alignItems:'center',paddingiorizontal:'10%', height: '100%', backgroundColor: 'white', justifyContent: 'center', padding: '2%'}}>
|
||||
<Text style={{fontSize: 32, fontWeight: 'bold', marginBottom: '10%', color: 'red', textAlign: 'center'}}>No Poll</Text>
|
||||
</View>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<WebView
|
||||
source = {{uri: this.state.data[this.state.data.length-1].url}}
|
||||
javaScriptEnabled={true}
|
||||
domStorageEnabled={true}
|
||||
startInLoadingState={true}
|
||||
style={{marginTop: 0}}
|
||||
cacheEnabled={true}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,8 @@ class SSLOps extends React.Component {
|
||||
return response.text();
|
||||
})
|
||||
.then((json) => {
|
||||
const data = JSON.parse(json)
|
||||
data.sort((a,b)=>a.id-b.id)
|
||||
this.setState({data: JSON.parse(json)});
|
||||
})
|
||||
.catch((error) => console.error(error))
|
||||
|
||||
+8
-4
@@ -179,8 +179,10 @@ class Staffs extends React.Component {
|
||||
return response.text();
|
||||
})
|
||||
.then((json) => {
|
||||
this.setState({data: JSON.parse(json).data});
|
||||
this.setState({dataSearch:JSON.parse(json).data});
|
||||
const data = JSON.parse(json)
|
||||
data.sort((a,b)=>a.id-b.id)
|
||||
this.setState({data: data});
|
||||
this.setState({dataSearch: data});
|
||||
})
|
||||
.catch((error) => console.error(error))
|
||||
}
|
||||
@@ -197,7 +199,9 @@ class Staffs extends React.Component {
|
||||
}
|
||||
render() {
|
||||
const { data , dataSearch,search} = this.state;
|
||||
|
||||
if (this.state.isLoading) {
|
||||
return <View/>
|
||||
} else {
|
||||
return (
|
||||
<SafeAreaView style={styles.moreDefault}>
|
||||
<SearchBar
|
||||
@@ -214,7 +218,7 @@ class Staffs extends React.Component {
|
||||
/>
|
||||
</SafeAreaView>
|
||||
|
||||
);
|
||||
);}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-8
@@ -57,8 +57,9 @@ class StudentWeek extends React.Component {
|
||||
).then((response) => {
|
||||
return response.text();
|
||||
}).then((json) => {
|
||||
|
||||
this.setState({data: JSON.parse(json),isLoading:false});
|
||||
const data = JSON.parse(json)
|
||||
data.sort((a,b)=>a.id-b.id)
|
||||
this.setState({data: data,isLoading:false});
|
||||
console.log(this.state.data)
|
||||
}).catch((error) => console.error(error))
|
||||
}
|
||||
@@ -67,17 +68,18 @@ class StudentWeek extends React.Component {
|
||||
if (this.state.isLoading) {
|
||||
return <View/>
|
||||
} else {
|
||||
const iconURI = this.state.data.icon !== undefined?`data:image/png;charset=utf-8;base64,${this.state.data.icon}`:'';
|
||||
const hobbyText = (<Text style = {{marginLeft: 50, paddingHorizontal: '2%', paddingBottom: '2%'}}>{this.state.data.hobbies}</Text>)
|
||||
const achievementText = (<Text style = {{marginLeft: 50, paddingHorizontal: '2%', paddingBottom: '2%'}}>{this.state.data.achievements}</Text>)
|
||||
const messageText = (<Text style = {{marginLeft: 50, paddingHorizontal: '2%', paddingBottom: '2%'}}>{this.state.data.messages}</Text>)
|
||||
console.log(this.state.data[this.state.data.length-1].image)
|
||||
const iconURI = this.state.data[this.state.data.length-1].image !== undefined?`data:image/png;charset=utf-8;base64,${this.state.data[this.state.data.length-1].image}`:'';
|
||||
const hobbyText = (<Text style = {{marginLeft: 50, paddingHorizontal: '2%', paddingBottom: '2%'}}>{this.state.data[this.state.data.length-1].hobbies}</Text>)
|
||||
const achievementText = (<Text style = {{marginLeft: 50, paddingHorizontal: '2%', paddingBottom: '2%'}}>{this.state.data[this.state.data.length-1].achievements}</Text>)
|
||||
const messageText = (<Text style = {{marginLeft: 50, paddingHorizontal: '2%', paddingBottom: '2%'}}>{this.state.data[this.state.data.length-1].messages}</Text>)
|
||||
return (
|
||||
<ScrollView style={{paddingTop:'5%',paddingHorizontal:'10%', backgroundColor: 'white', height: '100%'}}>
|
||||
<View style={{backgroundColor: 'white',borderRadius: 150, height: 300, width: 300, alignSelf: 'center', shadowColor: 'red', shadowOffset: {width: 0, height: 2}, shadowOpacity: 0.5, shadowRadius: 7}}>
|
||||
<Image style={{resizeMode: 'cover',borderRadius: 150, height: 300, width: 300, alignSelf: 'center'}} source = {{iconURI}} />
|
||||
</View>
|
||||
<Text style={{fontSize:28,marginTop:'5%',textAlign:'center'}}>{this.state.data.name}</Text>
|
||||
<Text style={{fontSize:20,textAlign:'center', fontWeight: '200'}}>{I18n.t('student.Grade')} {this.state.data.year}</Text>
|
||||
<Text style={{fontSize:28,marginTop:'5%',textAlign:'center'}}>{this.state.data[this.state.data.length-1].name}</Text>
|
||||
<Text style={{fontSize:20,textAlign:'center', fontWeight: '200'}}>{I18n.t('student.Grade')} {this.state.data[this.state.data.length-1].grade}</Text>
|
||||
<View>
|
||||
<View style={{display: 'flex', padding:'2%', borderRadius: 8, marginTop:'5%'}}>
|
||||
<TouchableOpacity onPress = {this.clickHobby.bind(this)}>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"url":"https://blazerappcms.ml/"}
|
||||
{"url":"http://127.0.0.1:8080"}
|
||||
Reference in New Issue
Block a user