Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/bahl aryan/home page #31

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Components/FoodWaveSVG.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ const FoodWaveSVG: React.FC<FoodWaveSVGProps> = ({ foodWave }) => {
case 1:
return <Foodwave1/>;
case 2:
return <Foodwave2/>;
case 3:
return <Foodwave3/>;
case 4:
return <Foodwave4/>;
default:
return <Text>No SVG available</Text>
}
Expand Down
15 changes: 15 additions & 0 deletions api/getFoodWave.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import axios from "axios";

export const getFoodWave = async (token: string) => {
try{
const response = await axios.get('https://api.reflectionsprojections.org/attendee/foodwave/', {
headers: {
Authorization: token
}
});
return response.data;
} catch (error) {
console.error("Error in catching food wave:", error);
throw error;
}
}
9 changes: 9 additions & 0 deletions assets/SVGs/pink-question_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions assets/SVGs/purple-question_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions assets/SVGs/qrcode/QRFrame1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/SVGs/question 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions assets/SVGs/question_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 13 additions & 15 deletions navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { createStackNavigator } from "@react-navigation/stack";
import { FontAwesome } from "@expo/vector-icons";
import MaterialCommunityIcons from "@expo/vector-icons/MaterialCommunityIcons";
import { View } from "react-native";
import Home from "../screens/Home";
import Events from "../screens/Events";
Expand Down Expand Up @@ -36,53 +37,50 @@ const AppNavigator: React.FC = () => {
switch (route.name) {
case "Home":
return (
<FontAwesome
name="home"
<MaterialCommunityIcons
name="home-variant"
color={focused ? ACTIVE_COLOR : INACTIVE_COLOR}
size={35}
solid
/>
);
case "Events":
return (
<FontAwesome
<MaterialCommunityIcons
name="calendar"
color={focused ? ACTIVE_COLOR : INACTIVE_COLOR}
size={35}
solid

/>
);
case "Camera":
return (
<FontAwesome
name="camera"
color={focused ? ACTIVE_COLOR : INACTIVE_COLOR}
<MaterialCommunityIcons
name="qrcode-scan"
size={35}
solid
color={focused ? ACTIVE_COLOR : INACTIVE_COLOR}
/>
);
case "AdminScanner":
return (
<FontAwesome
<MaterialCommunityIcons
name="camera"
color={focused ? ACTIVE_COLOR : INACTIVE_COLOR}
size={35}
solid
/>
);
case "Shop":
return (
<FontAwesome
name="shopping-cart"
<MaterialCommunityIcons
name="shopping-outline"
color={focused ? ACTIVE_COLOR : INACTIVE_COLOR}
size={35}
solid
/>
);
case "Profile":
return (
<FontAwesome
name="user"
<MaterialCommunityIcons
name="account"
color={focused ? ACTIVE_COLOR : INACTIVE_COLOR}
size={35}
solid
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rp-mobile-2024",
"version": "1.0.0",
"version": "1.3.1",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
Expand Down Expand Up @@ -42,6 +42,7 @@
"jwt-decode": "^4.0.0",
"lucide-react-native": "^0.381.0",
"react": "18.2.0",
"react-icons": "^5.3.0",
"react-native": "0.74.2",
"react-native-gesture-handler": "^2.16.0",
"react-native-modal": "^13.0.1",
Expand Down
24 changes: 20 additions & 4 deletions screens/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import { logout } from "../redux/actions";
import { useNavigation } from "@react-navigation/native";
import { StackNavigationProp } from "@react-navigation/stack";

import QRFrame from '../assets/SVGs/qrcode/qr_frame.svg'
import QRFrame from '../assets/SVGs/qrcode/QRFrame1.svg'
import QRFrame2 from '../assets/SVGs/qrcode/qr_frame.svg'
import Background from '../assets/SVGs/home/home_bg.svg'
import Logout from '../assets/SVGs/profile/logout.svg'
import { getFoodWave } from "../api/getFoodWave";

const {width, height} = Dimensions.get("window")
type RootStackParamList = {
Expand All @@ -40,6 +42,8 @@ const Profile: React.FC = () => {
const attendee = useAppSelector((state: RootState) => state.attendee);
const qrcode = useAppSelector((state: RootState) => state.qrCodeURL);

const [foodWave, setFoodWave] = useState(null);

useEffect(() => {
if (token && !attendee) {
dispatch(getAttendee(token));
Expand All @@ -49,6 +53,14 @@ const Profile: React.FC = () => {
}
}, [token, attendee, qrcode, dispatch]);

useEffect(() => {
const fetchFoodWave = async () => {
const foodwave = await getFoodWave(token);
setFoodWave(foodwave.foodwave);
}
fetchFoodWave();
}, [token])

useEffect(() => {
const fetchQRCode = async() => {
if (token) {
Expand Down Expand Up @@ -119,16 +131,20 @@ const Profile: React.FC = () => {
{attendee && qrcode &&
<View style={styles.qrContainer}>
<View style={styles.qrFrameContainer}>
<QRFrame style={styles.qrFrame} height={qrCodeSize * 1.1} width={qrCodeSize * 1.4}/>
{foodWave == 1 ? (
<QRFrame style={styles.qrFrame} height={qrCodeSize * 1.1} width={qrCodeSize * 1.4}/>
) : (
<QRFrame2 style={styles.qrFrame} height={qrCodeSize * 1.1} width={qrCodeSize * 1.4}/>
)}
<View style={styles.qrCodeStyle}>
<QRCode
value="Sample QR Code Value"
value={qrcode}
size={qrCodeSize}
/>
</View>
</View>
<StyledText variant="profileText" color={Colors.WHITE} style={styles.profileText}>{attendee.name}</StyledText>
<FoodWaveSVG foodWave={attendee.foodWave} />
<FoodWaveSVG foodWave={foodWave} />
</View>}
</SafeAreaView>
);
Expand Down
42 changes: 29 additions & 13 deletions screens/Shop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import {
} from "@expo-google-fonts/press-start-2p";
import AppLoading from "expo-app-loading";

import Question1 from "../assets/SVGs/question_1.svg"
import Question2 from "../assets/SVGs/purple-question_1.svg"
import Question3 from "../assets/SVGs/pink-question_1.svg"

import VerticalProgressBar from '../Components/VerticalProgressBar';
import { getPoints } from "../api/getPoints";

Expand Down Expand Up @@ -47,14 +51,18 @@ const Shop: React.FC = () => {
source={require("../assets/token.png")}
style={styles.tokenImage}
/>
<Text style={styles.points}>x{userPoints}</Text>
<Text style={styles.myPoints}>x{userPoints}</Text>
</View>
<View style={styles.photoContainer}>
<View style={styles.leftSide}>
<View style={styles.photoWithPoints}>
<Image
source={{ uri: "https://via.placeholder.com/150" }}
{/* <Image
source={{ uri: "https://via.placeholder.com/100" }}
style={styles.smallPhoto}
/> */}
<Question1 //might have to consolidate this into single component
width={100}
height={100}
/>
<Image
source={require("../assets/token.png")}
Expand All @@ -63,9 +71,9 @@ const Shop: React.FC = () => {
<Text style={styles.points}>x{50}</Text>
</View>
<View style={styles.photoWithPoints}>
<Image
source={{ uri: "https://via.placeholder.com/150" }}
style={styles.smallPhoto}
<Question2
width={100}
height={100}
/>
<Image
source={require("../assets/token.png")}
Expand All @@ -74,9 +82,9 @@ const Shop: React.FC = () => {
<Text style={styles.points}>x{35}</Text>
</View>
<View style={styles.photoWithPoints}>
<Image
source={{ uri: "https://via.placeholder.com/150" }}
style={styles.smallPhoto}
<Question3
width={100}
height={100}
/>
<Image
source={require("../assets/token.png")}
Expand Down Expand Up @@ -105,9 +113,9 @@ const styles = StyleSheet.create({
},
description: {
fontSize: 15,
marginBottom: 10,
marginBottom: 20,
fontFamily: "PressStart2P_400Regular",
color: Colors.YELLOW,
color: Colors.WHITE,
},
pointsContainer: {
flexDirection: "row",
Expand All @@ -116,7 +124,13 @@ const styles = StyleSheet.create({
marginBottom: 20,
},
points: {
fontSize: 15,
fontSize: 17,
marginRight: 10,
fontFamily: "PressStart2P_400Regular",
color: Colors.WHITE,
},
myPoints: {
fontSize: 30,
marginRight: 10,
fontFamily: "PressStart2P_400Regular",
color: Colors.YELLOW,
Expand All @@ -134,13 +148,14 @@ const styles = StyleSheet.create({
leftSide: {
flex: 1, // Take up the remaining space
justifyContent: "space-around",
marginLeft: 10,
// marginLeft: 10,
// backgroundColor: 'blue',
},
photoWithPoints: {
flexDirection: "row",
alignItems: "center",
marginBottom: 10,
// backgroundColor: 'red'
},
smallPhoto: {
width: 100,
Expand All @@ -152,6 +167,7 @@ const styles = StyleSheet.create({
alignItems: "flex-end",
justifyContent: "center",
marginVertical: 50,
marginRight: 20,
// backgroundColor: 'red',
},
progressBar: {
Expand Down
Loading