Commit 2702ec3f authored by Thomas's avatar Thomas
Browse files

no message

parent 513f56db
......@@ -6,9 +6,9 @@
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"image": "./assets/loadingImage.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
"backgroundColor": "#A5D6AA"
},
"updates": {
"fallbackToCacheTimeout": 0
......@@ -21,8 +21,8 @@
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
"foregroundImage": "./assets/icon.png",
"backgroundColor": "#A5D6AA"
}
},
"web": {
......
TraCloSo/assets/icon.png

21.9 KB | W: | H:

TraCloSo/assets/icon.png

89.5 KB | W: | H:

TraCloSo/assets/icon.png
TraCloSo/assets/icon.png
TraCloSo/assets/icon.png
TraCloSo/assets/icon.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -17,7 +17,14 @@ const Card = (props) => {
}
return(
<TouchableOpacity onPress={() => navigation.navigate('Brand', {BrandName: props.BrandName, Score:props.Score, Logo: props.Logo })}>
<TouchableOpacity onPress={() => navigation.navigate('Brand', {
BrandName: props.BrandName,
Score:props.Score,
Logo: props.Logo,
Summary: props.Summary,
Updated: props.Updated
})}>
<View style={style.cardStyle}>
<View style={{flexDirection: 'row'}}>
<Image
......@@ -82,7 +89,7 @@ const style = StyleSheet.create ({
},
shadowOpacity: 0.58 ,
shadowRadius: 16,
elevation: 24,
elevation: 16,
marginTop: 3
},
transparancyText: {
......
......@@ -6479,6 +6479,11 @@
"resolved": "https://registry.npmjs.org/mockdate/-/mockdate-3.0.5.tgz",
"integrity": "sha512-iniQP4rj1FhBdBYS/+eQv7j1tadJ9lJtdzgOpvsOHng/GbcDh2Fhdeq+ZRldrPYdXvCyfFUmFeEwEGXZB5I/AQ=="
},
"moment": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
......
......@@ -6,13 +6,11 @@ import { MaterialCommunityIcons } from '@expo/vector-icons';
import MapView from 'react-native-maps';
import { Overlay } from 'react-native-elements';
import * as SQLite from 'expo-sqlite';
import moment from 'moment';
export default function BrandScreen({ navigation, route }) {
const {BrandName, Score, Logo} = route.params
const {BrandName, Score, Logo, Summary, Updated} = route.params
const db = SQLite.openDatabase('traclo_db.db')
const onShare = async () => {
try {
const result = await Share.share({
......@@ -32,10 +30,6 @@ export default function BrandScreen({ navigation, route }) {
alert(error.message);
}}
var BrandSummary =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in oluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
let transparencyColor;
if (Score <= 100 && Score >= 70) {
var transparancyColor = '#52D858'
......@@ -51,6 +45,10 @@ export default function BrandScreen({ navigation, route }) {
setVisible(!visible);
};
var unformattedDate = Updated.seconds;
var t = new Date(unformattedDate * 1000);
var dateFormatted = ('0' + t.getDate()).slice(-2) + '-' + ('0' + t.getMonth()).slice(-2) + '-' + ('0' + t.getYear()).slice(-2) + ' ' + ('0' + t.getHours()).slice(-2) + ':' + ('0' + t.getMinutes()).slice(-2);
return(
<SafeAreaView style={style.Container}>
{/*header */}
......@@ -83,7 +81,7 @@ export default function BrandScreen({ navigation, route }) {
<MaterialCommunityIcons style={style.Arrow} name="chevron-left" size={18}/>
<Text>back</Text>
</TouchableOpacity>
<Text style={style.UpdateText}>Last updated on 24-5-2021 13:37</Text>
<Text style={style.UpdateText}>Last updated on {dateFormatted}</Text>
</View>
{/*transparancy score*/}
<View style={[style.transparancyBox, {shadowColor: transparancyColor}]}>
......@@ -94,7 +92,7 @@ export default function BrandScreen({ navigation, route }) {
<View style={style.content}>
{/*summary*/}
<Text style={style.header}>Summary</Text>
<Text>{BrandSummary}
<Text>{Summary}
{"\n"} {"\n"}
More info about how the score is calculated? Take a look at our information page</Text>
{/*facilities*/}
......
......@@ -12,7 +12,9 @@ export default function Home({ navigation }) {
setSelectedIndex
] = React.useState(0);
let [listData, setListData] = useState([]);
let [listDataAZ, setListDataAZ] = useState([]);
let [listDataHighest, setListDataHighest] = useState([]);
let [listDataSport, setListDataSport] = useState([]);
const firebaseConfig = {
apiKey: "AIzaSyDUlK-IJcotasPrL9WUqCO1Z86JufUNwJE",
......@@ -31,32 +33,66 @@ export default function Home({ navigation }) {
useEffect(() => {
//retrieve record from firebase database
firebase.firestore().collection('Brand').get().then((querySnapshot) => {
firebase.firestore().collection('Brand').orderBy('brand_name').get().then((querySnapshot) => {
let temp = []
console.log('Total brands: ', querySnapshot.size);
querySnapshot.forEach(snapshot => {
console.log('brand ID: ', snapshot.data().brand_name)
let brandDetails = {};
brandDetails = snapshot.data();
temp.push(brandDetails);
setListData(temp)
setListDataAZ(temp)
});
});
}, []);
useEffect(() => {
//retrieve record from firebase database
firebase.firestore().collection('Brand').orderBy('brand_score', 'desc').get().then((querySnapshot) => {
let temp = []
querySnapshot.forEach(snapshot => {
let brandDetails = {};
brandDetails = snapshot.data();
temp.push(brandDetails);
setListDataHighest(temp)
});
});
}, []);
useEffect(() => {
//retrieve record from firebase database
firebase.firestore().collection("Brand").where("brand_sport", "==", true).get().then((querySnapshot) => {
let temp = []
querySnapshot.forEach(snapshot => {
let brandDetails = {};
brandDetails = snapshot.data();
temp.push(brandDetails);
setListDataSport(temp)
});
});
}, []);
if (selectedIndex == 0) {
var listToRender = listDataAZ
} else if (selectedIndex == 1) {
var listToRender = listDataHighest
} else {
var listToRender = listDataSport
}
let renderCard = ({ item }) => {
return(
<Card
BrandName = {item.brand_name}
Score = {item.brand_score}
Logo = {item.brand_logo}
Summary = {item.brand_summary}
Updated = {item.updated_at}
/>
);
};
console.log(listData)
return (
//this 'SafeAreaView' is required to render it safe on the screen, within the margins
<SafeAreaView forceInset={{ bottom: 'always' }} style={style.container}>
......@@ -65,7 +101,7 @@ export default function Home({ navigation }) {
setSelectedIndex={setSelectedIndex}
/>
<FlatList
data={listData}
data={listToRender}
keyExtractor={(item, index) => index.toString()}
renderItem = {renderCard}
/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment