-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from ReflectionsProjections/dev/Bahl-Aryan/sta…
…ff_scan_page Staff Scan Page
- Loading branch information
Showing
28 changed files
with
728 additions
and
69 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { View, Text, StyleSheet } from 'react-native'; | ||
import RNPickerSelect from 'react-native-picker-select'; | ||
import { getEvents } from '../api/getEvents'; | ||
import Colors from '../constants/Colors'; | ||
|
||
interface Event { | ||
eventId: string; | ||
name: string; | ||
} | ||
|
||
interface EventDropdownProps { | ||
token: string; | ||
onEventSelect: (eventId: string | null) => void; | ||
} | ||
|
||
const EventDropdown: React.FC<EventDropdownProps> = ({ token, onEventSelect }) => { | ||
const [events, setEvents] = useState<Event[]>([]); | ||
const [selectedEvent, setSelectedEvent] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
const fetchEvents = async () => { | ||
try { | ||
const eventData = await getEvents(token); | ||
setEvents(eventData); | ||
} catch (error) { | ||
console.error('Error fetching events:', error); | ||
} | ||
}; | ||
|
||
fetchEvents(); | ||
}, [token]); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<RNPickerSelect | ||
onValueChange={(value) => { | ||
setSelectedEvent(value); | ||
onEventSelect(value); | ||
}} | ||
items={events.map((event) => ({ | ||
label: event.name, | ||
value: event.eventId, | ||
}))} | ||
style={pickerSelectStyles} | ||
placeholder={{ label: 'Select an event...', value: null}} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
padding: 25, | ||
paddingRight: -10 | ||
}, | ||
label: { | ||
fontSize: 18, | ||
marginBottom: 10, | ||
color: Colors.WHITE | ||
}, | ||
selectedEvent: { | ||
marginTop: 20, | ||
fontSize: 16, | ||
color: Colors.WHITE, | ||
}, | ||
}); | ||
|
||
const pickerSelectStyles = StyleSheet.create({ | ||
inputIOS: { | ||
textAlign: 'center', | ||
fontSize: 20, | ||
fontWeight: "bold", | ||
paddingVertical: 12, | ||
paddingHorizontal: 12, | ||
borderWidth: 3, | ||
borderColor: Colors.YELLOW, | ||
backgroundColor: Colors.DARK_BLUE, | ||
borderRadius: 6, | ||
color: Colors.WHITE, | ||
fontFamily: "Inter_500Medium", | ||
paddingRight: 12, // to ensure the text is never behind the icon | ||
|
||
}, | ||
inputAndroid: { | ||
fontSize: 20, | ||
paddingHorizontal: 10, | ||
paddingVertical: 8, | ||
borderWidth: 0.5, | ||
borderColor: 'purple', | ||
borderRadius: 8, | ||
color: Colors.WHITE, | ||
paddingRight: 12, // to ensure the text is never behind the icon | ||
}, | ||
}); | ||
|
||
export default EventDropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react'; | ||
import { View, Text } from 'react-native' | ||
import { StyledText } from './Text'; | ||
|
||
import Foodwave1 from '../assets/SVGs/foodwave/food_wave.svg' | ||
import Foodwave2 from '../assets/SVGs/foodwave/food_wave2.svg' | ||
import Foodwave3 from '../assets/SVGs/foodwave/food_wave3.svg' | ||
import Foodwave4 from '../assets/SVGs/foodwave/food_wave4.svg' | ||
|
||
|
||
interface FoodWaveSVGProps { | ||
foodWave: Number; // Ensure you define all props your component expects. | ||
} | ||
|
||
const FoodWaveSVG: React.FC<FoodWaveSVGProps> = ({ foodWave }) => { | ||
const getSVG = () => { | ||
switch(foodWave) { | ||
case 1: | ||
return <Foodwave1/>; | ||
case 2: | ||
return <Foodwave2/>; | ||
case 3: | ||
return <Foodwave3/>; | ||
case 4: | ||
return <Foodwave4/>; | ||
default: | ||
return <Text>No SVG available</Text> | ||
} | ||
}; | ||
|
||
return ( | ||
<View style={{ | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
position: 'relative', | ||
}}> | ||
{getSVG()} | ||
<StyledText variant="medium" position='absolute' top={5}> | ||
{`Food Wave: ${foodWave}`} | ||
</StyledText> | ||
</View> | ||
); | ||
}; | ||
|
||
export default FoodWaveSVG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {jwtDecode} from 'jwt-decode'; | ||
|
||
interface DecodedToken { | ||
userId: string; | ||
displayName: string; | ||
roles: string[]; | ||
} | ||
|
||
export function decodeToken(token: string): DecodedToken { | ||
try { | ||
const decoded = jwtDecode<DecodedToken>(token) | ||
return decoded; | ||
} catch (error) { | ||
console.error('Error decoding token:', error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import axios from "axios"; | ||
|
||
export const getEvents = async (token: string) => { | ||
try{ | ||
const response = await axios.get('https://api.reflectionsprojections.org/events/', { | ||
headers: { | ||
Authorization: token | ||
} | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
console.error("Error in catching events:", error); | ||
throw error; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import axios from "axios"; | ||
|
||
export const postCheckIn = async(token, eventId, qrCode) => { | ||
const payload = { eventId, qrCode } | ||
try { | ||
const response = await axios.post('https://api.reflectionsprojections.org/staff/scan/', payload, { | ||
headers: { | ||
Authorization: token, | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
console.log('post CheckIn:', response.data) | ||
} catch (error) { | ||
console.log('Error posting check in:', error) | ||
alert(`Error with scanning QR Code! Please double check selected event`); | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Oops, something went wrong.