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

use legal/pref name on ticket #582

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
16 changes: 11 additions & 5 deletions src/components/QrCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,31 @@ const AppleWalletButton = styled.button`
// })
// }

const QrCode = ({ userInfo, userId }) => {
const QrCode = ({ userInfo, application, userId }) => {
const { Canvas } = useQRCode()
const applicantName =
Object.keys(application).length > 0
? application?.basicInfo?.preferredName
? application?.basicInfo?.preferredName
: application?.basicInfo?.legalFirstName + ' ' + application?.basicInfo?.legalLastName
: ''

const downloadAppleWalletPass = () => {
const userId = userInfo.uid
const name = userInfo.displayName
const name = applicantName
const email = userInfo.email
const url = `https://us-central1-wallet-cloud-func.cloudfunctions.net/getAppleWalletPass?userId=${userId}&name=${name}&email=${email}`
window.location.href = url
}

return (
<QRContainer>
<QRInfoMobileWelcome>Welcome, {userInfo.displayName}!</QRInfoMobileWelcome>
<QRInfoMobileWelcome>Welcome, {applicantName}!</QRInfoMobileWelcome>

<QRTicketContainer>
<QRCodeDesignContainer>
<QRCodeDesign id="QRCodeContainer">
<HackerName>{userInfo.displayName}</HackerName>
<HackerName>{applicantName}</HackerName>
<HackerEmail>{userInfo.email}</HackerEmail>

<QRTags>
Expand Down Expand Up @@ -208,7 +214,7 @@ const QrCode = ({ userInfo, userId }) => {

<QRInfo>
<QRInfoWelcome>Welcome,</QRInfoWelcome>
<QRInfoName>{userInfo.displayName}!</QRInfoName>
<QRInfoName>{applicantName}!</QRInfoName>
<QRInfoDes>
This ticket contains your personal QR code which will be scanned throughout the event.
Please add this ticket to your mobile wallet or take a screenshot.
Expand Down
15 changes: 13 additions & 2 deletions src/pages/Home.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useState, useEffect } from 'react'
import HackerCountdown from '../containers/HackerCountdown'
// import Announcements from '../components/Announcements'
// import { CommonLinks } from '../containers/Quicklinks'
Expand All @@ -11,6 +11,7 @@ import { APPLICATION_STATUS } from '../utility/Constants'
import { P } from '../../src/components/Typography'
import backgroundImage from '../assets/cmdf_homebg.svg'
import mobileBackgroundImage from '../assets/cmdf_mobilebg.svg'
import { getUserApplication } from '../utility/firebase'

//My Ticket
const HomeContainer = styled.div`
Expand Down Expand Up @@ -56,8 +57,18 @@ const StyledP = styled(P)`
`

export default withTheme(({ announcements, theme }) => {
const [applicantInfo, setApplicantInfo] = useState({})
const { user, isAuthed } = useAuth()

useEffect(() => {
const getApplicant = async () => {
const applicant = await getUserApplication(user.uid)
console.log(applicant)
setApplicantInfo(applicant)
}
getApplicant()
}, [user])

return (
<>
<HomeContainerBackground />
Expand All @@ -71,7 +82,7 @@ export default withTheme(({ announcements, theme }) => {

{/* Only display QR Code if logged in */}
{user?.status === APPLICATION_STATUS.accepted && isAuthed && user.uid ? (
<QrCode userInfo={user} userId={user.uid} />
<QrCode userInfo={user} application={applicantInfo} userId={user.uid} />
) : (
<StyledP>Please login with the email you used to apply to cmd-f 2024.</StyledP>
)}
Expand Down
Loading