Skip to content

Commit

Permalink
Merge pull request #43 from Bostonhacks/resume-upload
Browse files Browse the repository at this point in the history
updated resume
  • Loading branch information
danielyu12 authored Sep 25, 2023
2 parents 64a85ab + 8aaf487 commit 603daaf
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 14 deletions.
35 changes: 29 additions & 6 deletions src/components/common/svg/GoogleIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
import React from 'react';

const GoogleIcon = () => {
return (
<svg className="fullSVG" width="30px" height="30px" viewBox="0 0 262 262" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027" fill="#4285F4"/><path d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1" fill="#34A853"/><path d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782" fill="#FBBC05"/><path d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251" fill="#EB4335"/></svg>
);
}
return (
<svg
className="fullSVG"
width="40vw"
height=""
viewBox="0 0 262 262"
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid"
>
<path
d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"
fill="#4285F4"
/>
<path
d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"
fill="#34A853"
/>
<path
d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782"
fill="#FBBC05"
/>
<path
d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"
fill="#EB4335"
/>
</svg>
);
};


export default GoogleIcon;
export default GoogleIcon;
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
signOut,
} from 'firebase/auth';

import { getStorage } from 'firebase/storage';

const firebaseConfig = {
apiKey: 'AIzaSyBhN3fCW3J8o_eRzUiUZrARHtN2VBQKyC4',
authDomain: 'bhacks-2023.firebaseapp.com',
Expand Down Expand Up @@ -83,3 +85,5 @@ export const addApplicationDoc = async (formData, uid) => {
throw err;
}
};

export const storage = getStorage(app);
41 changes: 36 additions & 5 deletions src/pages/Application.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';

import { useNavigate } from 'react-router-dom';

import { auth, addApplicationDoc, db } from '../firebase/firebase-config';
import {
auth,
addApplicationDoc,
db,
storage,
} from '../firebase/firebase-config';
import { useAuthState } from 'react-firebase-hooks/auth';
import { doc, getDoc, updateDoc } from 'firebase/firestore';
import { doc, updateDoc } from 'firebase/firestore';
import { ref, uploadBytes } from 'firebase/storage';

import { useForm, Controller } from 'react-hook-form';
import Select from 'react-select';
Expand Down Expand Up @@ -95,12 +101,12 @@ const Application = ({ applicationId }) => {
{ language: '', experienceLevel: '' },
]);
const [user, loading] = useAuthState(auth);
const [resume, setResume] = useState(null);
const navigate = useNavigate();
const { register, handleSubmit, control } = useForm();

// Function runs on application form submission.
const onSubmit = async (data) => {
console.log('inside submit');
// Allow null college major
if (!data.collegeMajor) {
data.collegeMajor = 'N/A';
Expand Down Expand Up @@ -139,7 +145,16 @@ const Application = ({ applicationId }) => {
languageExperience: programmingInputs,
status: 'Submitted',
});
navigate('/login');

if (resume != null) {
const resumeRef = ref(storage, `resumes/${applicationId}`);
uploadBytes(resumeRef, resume).then(() => {
navigate('/login');
});
} else {
alert('please upload a resume');
return;
}
};

const onError = async (data, e) => {
Expand Down Expand Up @@ -189,6 +204,7 @@ const Application = ({ applicationId }) => {
useEffect(() => {
if (loading) return;

console.log(user);
if (!user) navigate('/login');
}, [user, loading, navigate]);

Expand Down Expand Up @@ -787,6 +803,21 @@ const Application = ({ applicationId }) => {
</div>
</div>

<hr className="border border-black w-3/4 mx-auto" />

<div className="my-[50px]">
<p className="font-minecraft text-[#453119] text-[30px] font-bold mb-10">
Resume Upload
</p>
<input
type="file"
placeholder="Please upload a copy of your resume:"
accept=".pdf, .docx"
onChange={(e) => {
setResume(e.target.files[0]);
}}
/>
</div>
<div className="w-full flex justify-end">
<input
type="submit"
Expand Down
8 changes: 5 additions & 3 deletions src/pages/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ export default function Login() {
<div className="flex justify-center items-center h-screen">
<button
onClick={signInWithGoogle}
className="font-bold flex items-center space-x-2 px-4 py-6 rounded-lg"
className="font-bold flex flex-col items-center space-x-2 px-4 py-6 rounded-lg"
>
<GoogleIcon />
<span>Login with Google</span>
<p className="text-[#453119] text-[60px] font-bold font-minecraft">
Click me to login with Google
</p>
</button>

<Footer />
{/* <Footer /> */}
</div>
);
}

0 comments on commit 603daaf

Please sign in to comment.