diff --git a/src/Components/Account/PasswordReset.js b/src/Components/Account/PasswordReset.js index d43d83e..6db299b 100644 --- a/src/Components/Account/PasswordReset.js +++ b/src/Components/Account/PasswordReset.js @@ -1,5 +1,10 @@ import React, { useState, useEffect } from "react"; -import { checkActionCode, confirmPasswordReset, getAuth, sendPasswordResetEmail } from "firebase/auth"; +import { + checkActionCode, + confirmPasswordReset, + getAuth, + sendPasswordResetEmail, +} from "firebase/auth"; import Button from "../../pageElements/Button"; import { useSearchParams } from "react-router-dom"; @@ -75,122 +80,133 @@ const PasswordResetPage = () => { } finally { setIsBusy(false); } - } + }; const resetMode = mode === "resetPassword" ? "resetPassword" : "enterEmail"; return (
- {resetMode === "enterEmail" ? <> -
-

- Enter Account Email -

-
- {!done ? ( -
-
- setEmail(e.target.value)} - disabled={isBusy} - > - -
-
- {"" !== notice && ( -
- {notice} -
- )} -
-
-
-
- ) : null} - {done && ( -
-

A password reset link was sent.

+ {resetMode === "enterEmail" ? ( + <> +
+

+ Enter Account Email +

- )} - : null} - {resetMode === "resetPassword" ? <> -
-

- Enter New Password -

-
- {!done && isCodeValid !== null && isCodeValid ? ( -
-
- setPassword(e.target.value)} - disabled={isBusy} - > - + {!done ? ( + +
+ setEmail(e.target.value)} + disabled={isBusy} + > + +
+
+ {"" !== notice && ( +
+ {notice} +
+ )} +
+
+
+ + ) : null} + {done && ( +
+

+ A password reset link was sent. +

-
- setConfirmPassword(e.target.value)} - disabled={isBusy} - > - -
-
- {"" !== notice && ( -
- {notice} -
- )} -
-
-
- - ) : null} - {!done && isCodeValid !== null && !isCodeValid && ( -
-

Bad or already used password reset code.

+ )} + + ) : null} + {resetMode === "resetPassword" ? ( + <> +
+

+ Enter New Password +

- )} - {done && ( -
-

Password changed.

-
- )} - : null} + {!done && isCodeValid !== null && isCodeValid ? ( +
+
+ setPassword(e.target.value)} + disabled={isBusy} + > + +
+
+ setConfirmPassword(e.target.value)} + disabled={isBusy} + > + +
+
+ {"" !== notice && ( +
+ {notice} +
+ )} +
+
+
+
+ ) : null} + {!done && isCodeValid !== null && !isCodeValid && ( +
+

+ Bad or already used password reset code. +

+
+ )} + {done && ( +
+

Password changed.

+
+ )} + + ) : null}
diff --git a/src/Components/Dashboard/Dashboard.js b/src/Components/Dashboard/Dashboard.js index b7475e6..a4679e6 100644 --- a/src/Components/Dashboard/Dashboard.js +++ b/src/Components/Dashboard/Dashboard.js @@ -15,21 +15,26 @@ import { Typeahead } from "react-bootstrap-typeahead"; import { AppContext } from "../../Hooks/useContext/appContext.js"; import UploadModal from "../Modals/UploadModal.js"; import Button from "react-bootstrap/Button"; +import { getAuth } from "firebase/auth"; const Dashboard = () => { const size = window.innerWidth < 440; const [isMobile, setIsMobile] = useState(size); + const auth = getAuth(); const count = useRef(null); const navigate = useNavigate(); const [allCases, setAllCases] = useState(null); const [selectedCase, setSelectedCase] = useState(null); const [showModal, setShowModal] = useState(); const [docCount, setDocCount] = useState(); + const [isPromoFirstLogin, setIsPromoFirstLogin] = useState(true); const [responseCount, setResponseCount] = useState(); const { appState } = useContext(AppContext); const { group } = appState; const appUserId = group ? group.appUserId : null; const isDashboard = true; + console.log("group on dashbaord page", group); + console.log("auth in dashoabrd page", auth); useEffect(() => { if (count.current == null) { @@ -177,6 +182,34 @@ const Dashboard = () => {
{group.firm}
+ {isPromoFirstLogin ? ( + <> +
+
+
+
+ Welcome to Novodraft, attorney {group.lastName}. We are + excited to introduce you to our application. +
+
+ Pleae review the step-by-step user guide by clicking "How-to" + in the navigation bar. +
+
+ You will use your email address and the temporary password + below to log in to Novodraft. +
+
+ Your temporary password been set to {"password"}. Please + change it by clicking here. +
+
+
+
+ +
+ + ) : null}
diff --git a/src/Components/Home/HomePage.js b/src/Components/Home/HomePage.js index 82391a8..e6fbf97 100644 --- a/src/Components/Home/HomePage.js +++ b/src/Components/Home/HomePage.js @@ -6,7 +6,6 @@ import { v4 as uuidv4 } from "uuid"; import arrow from "../../Assets/Images/Arrow.png"; import { useNavigate } from "react-router-dom"; import ConfirmModal from "../Modals/ConfirmModal"; -import { marchEmailPrm } from "../../secrets"; import { createUserWithEmailAndPassword } from "firebase/auth"; import { stateDataValues } from "../../Constants/Fields/SignupFields"; import "../../styles/homepage.scss"; @@ -33,13 +32,17 @@ const HomePage = () => { subscriptionPeriodStart, subscriptionPeriodEnd, subscriptionId, - isPromotionalMebership, + isPromotionalMebership = true, docsAllowedPeMonth = 1 ) { - if (!email || !password) { + if (!email || !password || !dataValues[0]) { return; } - + console.log( + "~~~~~~~~~~~~~~~~~~~~~email, password in saveUserData", + email, + password + ); const appUserId = uuidv4(); const firmId = uuidv4(); const fbAuthUid = authId; @@ -64,12 +67,24 @@ const HomePage = () => { zipCode, barNumber, practiceArea, - } = dataValues; + } = dataValues[0]; const userState = stateDataValues.filter((value) => { if (value.name === state) return value; }); - + console.log( + "firstName, lastName, firm, telephone, streetAddress, city, state, zipCode, barNumber, practiceArea", + firstName, + lastName, + firm, + telephone, + streetAddress, + city, + state, + zipCode, + barNumber, + practiceArea + ); const userData = { docsAllowedPerMonth, docsGenerated, @@ -88,6 +103,7 @@ const HomePage = () => { practiceArea, email, isPromotionalMebership, + isPromotionalFirstLogin: true, customerId: customerId, subscriptionId: subscriptionId, subscriptionPlan: "flordia-spring-promo-plan", @@ -158,12 +174,13 @@ const HomePage = () => { const user = userCredential.user; dataValues = { ...dataValues }; - const isPromotionalMebership = true; console.log("userCredential", userCredential); const res = await saveUserData( user.uid, dataValues, + email, + password, customerId, subscriptionCreated, subscriptionPeriodStart, diff --git a/src/Hooks/useContext/appContext.js b/src/Hooks/useContext/appContext.js index af7b00e..a9a33c6 100755 --- a/src/Hooks/useContext/appContext.js +++ b/src/Hooks/useContext/appContext.js @@ -2,7 +2,13 @@ import React, { createContext, useContext, useEffect, useReducer } from "react"; import { useGroupReducer } from "../useReducer/reducers"; import { AuthContext } from "../../Context/AuthProvider"; import { db } from "../../firebase.js"; -import { collection, getDocs, query, where, onSnapshot } from "firebase/firestore"; +import { + collection, + getDocs, + query, + where, + onSnapshot, +} from "firebase/firestore"; const initialState = { group: undefined, @@ -16,9 +22,9 @@ const AppContext = createContext({ const AppProvider = ({ children }) => { const { currentUserEmail } = useContext(AuthContext); const [appState, appDispatch] = useReducer(useGroupReducer, initialState); - + console.log("currentUserEmail in AppProvider", currentUserEmail); useEffect(() => { - if (typeof currentUserEmail === 'undefined') { + if (typeof currentUserEmail === "undefined") { return; } if (!currentUserEmail) { @@ -26,13 +32,10 @@ const AppProvider = ({ children }) => { return; } return onSnapshot( - query( - collection(db, "users"), - where("email", "==", currentUserEmail) - ), - snapshot => { + query(collection(db, "users"), where("email", "==", currentUserEmail)), + (snapshot) => { const doc = snapshot.docs[0]; - if (typeof doc === 'undefined') { + if (typeof doc === "undefined") { appDispatch({ type: "DELETE_GROUP" }); } else { appDispatch({ type: "CREATE_GROUP", payload: doc.data() }); diff --git a/src/styles/dashboard.scss b/src/styles/dashboard.scss index 0df1f5b..7080fee 100644 --- a/src/styles/dashboard.scss +++ b/src/styles/dashboard.scss @@ -8,6 +8,29 @@ margin: 30px 0px 0px 0px; } +.dash-promo-first-box { + margin-top: 8px; + padding: 8px 88px; +} + +.dash-promo-first-wrap { + padding: 8px 62; + background-color: aliceblue; + display: flex; + flex-direction: column; + border: 1px solid orange; + border-radius: 5px; +} + +.dash-promo-first-textwrap { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin: auto; + max-width: 620; +} + .dash-heading-text { font-size: 1.3rem; }