From a057576fcd06dd863e249ab232576953b713c74a Mon Sep 17 00:00:00 2001 From: Lateefah Abdulkareem Date: Mon, 16 Jan 2023 11:16:45 -0500 Subject: [PATCH] implement authentication with google, save, retrieve and display code from firestore --- .gitignore | 2 + package.json | 4 + src/App.css | 4 + src/components/CodeEditorWindow.js | 2 +- src/components/CustomInput.js | 7 +- src/components/Landing.js | 139 ++++++++++++++---- src/components/LanguagesDropdown.js | 8 +- .../authentication/AuthenticationView.js | 21 +++ src/components/authentication/UserNav.js | 22 +++ src/components/authentication/firebase.js | 20 +++ src/components/submissions/index.tsx | 33 +++++ src/components/submissions/submissionList.tsx | 43 ++++++ src/contexts/AuthContext.js | 29 ++++ src/hooks/useGetUserSubmissions.tsx | 35 +++++ src/hooks/useGoogleAuth.js | 48 ++++++ src/hooks/useSaveSubmission.tsx | 26 ++++ src/index.js | 6 +- src/lib/localInterfaces.tsx | 3 + src/reducers/authReducer.js | 14 ++ tsconfig.json | 26 ++++ 20 files changed, 458 insertions(+), 34 deletions(-) create mode 100644 src/components/authentication/AuthenticationView.js create mode 100644 src/components/authentication/UserNav.js create mode 100644 src/components/authentication/firebase.js create mode 100644 src/components/submissions/index.tsx create mode 100644 src/components/submissions/submissionList.tsx create mode 100644 src/contexts/AuthContext.js create mode 100644 src/hooks/useGetUserSubmissions.tsx create mode 100644 src/hooks/useGoogleAuth.js create mode 100644 src/hooks/useSaveSubmission.tsx create mode 100644 src/lib/localInterfaces.tsx create mode 100644 src/reducers/authReducer.js create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index 4edfdee..32aea07 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ yarn-error.log* .env .env.build .vercel + +firebaseConfig.js diff --git a/package.json b/package.json index ae6b3fa..6177bee 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,13 @@ "@types/react": "^18.0.9", "@types/react-dom": "^18.0.3", "axios": "^0.27.2", + "bootstrap": "^5.2.3", + "firebase": "^9.15.0", "monaco-themes": "^0.4.1", "react": "^17.0.2", + "react-bootstrap": "^2.7.0", "react-dom": "^17.0.2", + "react-google-button": "^0.7.2", "react-scripts": "5.0.0", "react-select": "^5.3.1", "react-toastify": "^9.0.1", diff --git a/src/App.css b/src/App.css index 74b5e05..9d1dc96 100644 --- a/src/App.css +++ b/src/App.css @@ -36,3 +36,7 @@ transform: rotate(360deg); } } + +.authDiv { + margin-right: 40px; +} \ No newline at end of file diff --git a/src/components/CodeEditorWindow.js b/src/components/CodeEditorWindow.js index e8286d8..ccbf2fa 100644 --- a/src/components/CodeEditorWindow.js +++ b/src/components/CodeEditorWindow.js @@ -13,7 +13,7 @@ const CodeEditorWindow = ({ onChange, language, code, theme }) => { return (
{ return ( <> - {" "} + {/* {" "} */} +

+ Custom Input +