more
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
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 Button from "../../pageElements/Button";
|
||||||
import { useSearchParams } from "react-router-dom";
|
import { useSearchParams } from "react-router-dom";
|
||||||
|
|
||||||
@@ -75,14 +80,15 @@ const PasswordResetPage = () => {
|
|||||||
} finally {
|
} finally {
|
||||||
setIsBusy(false);
|
setIsBusy(false);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
const resetMode = mode === "resetPassword" ? "resetPassword" : "enterEmail";
|
const resetMode = mode === "resetPassword" ? "resetPassword" : "enterEmail";
|
||||||
return (
|
return (
|
||||||
<div className="password-reset-container">
|
<div className="password-reset-container">
|
||||||
<div className="password-reset-form-wrapper">
|
<div className="password-reset-form-wrapper">
|
||||||
<div className="password-reset-form">
|
<div className="password-reset-form">
|
||||||
{resetMode === "enterEmail" ? <>
|
{resetMode === "enterEmail" ? (
|
||||||
|
<>
|
||||||
<div className="password-reset-header">
|
<div className="password-reset-header">
|
||||||
<h2 className="password-reset-header-text">
|
<h2 className="password-reset-header-text">
|
||||||
Enter Account Email
|
Enter Account Email
|
||||||
@@ -123,11 +129,15 @@ const PasswordResetPage = () => {
|
|||||||
) : null}
|
) : null}
|
||||||
{done && (
|
{done && (
|
||||||
<div className="success-container">
|
<div className="success-container">
|
||||||
<p className="reset-sent-text">A password reset link was sent.</p>
|
<p className="reset-sent-text">
|
||||||
|
A password reset link was sent.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</> : null}
|
</>
|
||||||
{resetMode === "resetPassword" ? <>
|
) : null}
|
||||||
|
{resetMode === "resetPassword" ? (
|
||||||
|
<>
|
||||||
<div className="password-reset-header">
|
<div className="password-reset-header">
|
||||||
<h2 className="password-reset-header-text">
|
<h2 className="password-reset-header-text">
|
||||||
Enter New Password
|
Enter New Password
|
||||||
@@ -159,7 +169,10 @@ const PasswordResetPage = () => {
|
|||||||
onChange={(e) => setConfirmPassword(e.target.value)}
|
onChange={(e) => setConfirmPassword(e.target.value)}
|
||||||
disabled={isBusy}
|
disabled={isBusy}
|
||||||
></input>
|
></input>
|
||||||
<label htmlFor="confirmPasswordInput" className="form-label">
|
<label
|
||||||
|
htmlFor="confirmPasswordInput"
|
||||||
|
className="form-label"
|
||||||
|
>
|
||||||
Confirm password
|
Confirm password
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -182,7 +195,9 @@ const PasswordResetPage = () => {
|
|||||||
) : null}
|
) : null}
|
||||||
{!done && isCodeValid !== null && !isCodeValid && (
|
{!done && isCodeValid !== null && !isCodeValid && (
|
||||||
<div className="success-container">
|
<div className="success-container">
|
||||||
<p className="reset-sent-text">Bad or already used password reset code.</p>
|
<p className="reset-sent-text">
|
||||||
|
Bad or already used password reset code.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{done && (
|
{done && (
|
||||||
@@ -190,7 +205,8 @@ const PasswordResetPage = () => {
|
|||||||
<p className="reset-sent-text">Password changed.</p>
|
<p className="reset-sent-text">Password changed.</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</> : null}
|
</>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,21 +15,26 @@ import { Typeahead } from "react-bootstrap-typeahead";
|
|||||||
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
||||||
import UploadModal from "../Modals/UploadModal.js";
|
import UploadModal from "../Modals/UploadModal.js";
|
||||||
import Button from "react-bootstrap/Button";
|
import Button from "react-bootstrap/Button";
|
||||||
|
import { getAuth } from "firebase/auth";
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
const size = window.innerWidth < 440;
|
const size = window.innerWidth < 440;
|
||||||
const [isMobile, setIsMobile] = useState(size);
|
const [isMobile, setIsMobile] = useState(size);
|
||||||
|
const auth = getAuth();
|
||||||
const count = useRef(null);
|
const count = useRef(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [allCases, setAllCases] = useState(null);
|
const [allCases, setAllCases] = useState(null);
|
||||||
const [selectedCase, setSelectedCase] = useState(null);
|
const [selectedCase, setSelectedCase] = useState(null);
|
||||||
const [showModal, setShowModal] = useState();
|
const [showModal, setShowModal] = useState();
|
||||||
const [docCount, setDocCount] = useState();
|
const [docCount, setDocCount] = useState();
|
||||||
|
const [isPromoFirstLogin, setIsPromoFirstLogin] = useState(true);
|
||||||
const [responseCount, setResponseCount] = useState();
|
const [responseCount, setResponseCount] = useState();
|
||||||
const { appState } = useContext(AppContext);
|
const { appState } = useContext(AppContext);
|
||||||
const { group } = appState;
|
const { group } = appState;
|
||||||
const appUserId = group ? group.appUserId : null;
|
const appUserId = group ? group.appUserId : null;
|
||||||
const isDashboard = true;
|
const isDashboard = true;
|
||||||
|
console.log("group on dashbaord page", group);
|
||||||
|
console.log("auth in dashoabrd page", auth);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (count.current == null) {
|
if (count.current == null) {
|
||||||
@@ -177,6 +182,34 @@ const Dashboard = () => {
|
|||||||
<div className="user-name-container2">{group.firm}</div>
|
<div className="user-name-container2">{group.firm}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="app-divider dash-divider" />
|
<div className="app-divider dash-divider" />
|
||||||
|
{isPromoFirstLogin ? (
|
||||||
|
<>
|
||||||
|
<div className="dash-promo-first-box">
|
||||||
|
<div className="dash-promo-first-wrap">
|
||||||
|
<div className="dash-promo-first-textwrap">
|
||||||
|
<div clasName="dash-promo-first-text">
|
||||||
|
Welcome to Novodraft, attorney {group.lastName}. We are
|
||||||
|
excited to introduce you to our application.
|
||||||
|
</div>
|
||||||
|
<div clasName="dash-promo-first-text">
|
||||||
|
Pleae review the step-by-step user guide by clicking "How-to"
|
||||||
|
in the navigation bar.
|
||||||
|
</div>
|
||||||
|
<div clasName="dash-promo-first-text">
|
||||||
|
You will use your email address and the temporary password
|
||||||
|
below to log in to Novodraft.
|
||||||
|
</div>
|
||||||
|
<div clasName="dash-promo-first-text">
|
||||||
|
Your temporary password been set to {"password"}. Please
|
||||||
|
change it by clicking here.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="app-divider dash-divider" />
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
<div className="stats-container">
|
<div className="stats-container">
|
||||||
<div className="stats-row-box">
|
<div className="stats-row-box">
|
||||||
<div className="stats-unit-wrapper">
|
<div className="stats-unit-wrapper">
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { v4 as uuidv4 } from "uuid";
|
|||||||
import arrow from "../../Assets/Images/Arrow.png";
|
import arrow from "../../Assets/Images/Arrow.png";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import ConfirmModal from "../Modals/ConfirmModal";
|
import ConfirmModal from "../Modals/ConfirmModal";
|
||||||
import { marchEmailPrm } from "../../secrets";
|
|
||||||
import { createUserWithEmailAndPassword } from "firebase/auth";
|
import { createUserWithEmailAndPassword } from "firebase/auth";
|
||||||
import { stateDataValues } from "../../Constants/Fields/SignupFields";
|
import { stateDataValues } from "../../Constants/Fields/SignupFields";
|
||||||
import "../../styles/homepage.scss";
|
import "../../styles/homepage.scss";
|
||||||
@@ -33,13 +32,17 @@ const HomePage = () => {
|
|||||||
subscriptionPeriodStart,
|
subscriptionPeriodStart,
|
||||||
subscriptionPeriodEnd,
|
subscriptionPeriodEnd,
|
||||||
subscriptionId,
|
subscriptionId,
|
||||||
isPromotionalMebership,
|
isPromotionalMebership = true,
|
||||||
docsAllowedPeMonth = 1
|
docsAllowedPeMonth = 1
|
||||||
) {
|
) {
|
||||||
if (!email || !password) {
|
if (!email || !password || !dataValues[0]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log(
|
||||||
|
"~~~~~~~~~~~~~~~~~~~~~email, password in saveUserData",
|
||||||
|
email,
|
||||||
|
password
|
||||||
|
);
|
||||||
const appUserId = uuidv4();
|
const appUserId = uuidv4();
|
||||||
const firmId = uuidv4();
|
const firmId = uuidv4();
|
||||||
const fbAuthUid = authId;
|
const fbAuthUid = authId;
|
||||||
@@ -64,12 +67,24 @@ const HomePage = () => {
|
|||||||
zipCode,
|
zipCode,
|
||||||
barNumber,
|
barNumber,
|
||||||
practiceArea,
|
practiceArea,
|
||||||
} = dataValues;
|
} = dataValues[0];
|
||||||
|
|
||||||
const userState = stateDataValues.filter((value) => {
|
const userState = stateDataValues.filter((value) => {
|
||||||
if (value.name === state) return 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 = {
|
const userData = {
|
||||||
docsAllowedPerMonth,
|
docsAllowedPerMonth,
|
||||||
docsGenerated,
|
docsGenerated,
|
||||||
@@ -88,6 +103,7 @@ const HomePage = () => {
|
|||||||
practiceArea,
|
practiceArea,
|
||||||
email,
|
email,
|
||||||
isPromotionalMebership,
|
isPromotionalMebership,
|
||||||
|
isPromotionalFirstLogin: true,
|
||||||
customerId: customerId,
|
customerId: customerId,
|
||||||
subscriptionId: subscriptionId,
|
subscriptionId: subscriptionId,
|
||||||
subscriptionPlan: "flordia-spring-promo-plan",
|
subscriptionPlan: "flordia-spring-promo-plan",
|
||||||
@@ -158,12 +174,13 @@ const HomePage = () => {
|
|||||||
|
|
||||||
const user = userCredential.user;
|
const user = userCredential.user;
|
||||||
dataValues = { ...dataValues };
|
dataValues = { ...dataValues };
|
||||||
|
|
||||||
const isPromotionalMebership = true;
|
const isPromotionalMebership = true;
|
||||||
console.log("userCredential", userCredential);
|
console.log("userCredential", userCredential);
|
||||||
const res = await saveUserData(
|
const res = await saveUserData(
|
||||||
user.uid,
|
user.uid,
|
||||||
dataValues,
|
dataValues,
|
||||||
|
email,
|
||||||
|
password,
|
||||||
customerId,
|
customerId,
|
||||||
subscriptionCreated,
|
subscriptionCreated,
|
||||||
subscriptionPeriodStart,
|
subscriptionPeriodStart,
|
||||||
|
|||||||
@@ -2,7 +2,13 @@ import React, { createContext, useContext, useEffect, useReducer } from "react";
|
|||||||
import { useGroupReducer } from "../useReducer/reducers";
|
import { useGroupReducer } from "../useReducer/reducers";
|
||||||
import { AuthContext } from "../../Context/AuthProvider";
|
import { AuthContext } from "../../Context/AuthProvider";
|
||||||
import { db } from "../../firebase.js";
|
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 = {
|
const initialState = {
|
||||||
group: undefined,
|
group: undefined,
|
||||||
@@ -16,9 +22,9 @@ const AppContext = createContext({
|
|||||||
const AppProvider = ({ children }) => {
|
const AppProvider = ({ children }) => {
|
||||||
const { currentUserEmail } = useContext(AuthContext);
|
const { currentUserEmail } = useContext(AuthContext);
|
||||||
const [appState, appDispatch] = useReducer(useGroupReducer, initialState);
|
const [appState, appDispatch] = useReducer(useGroupReducer, initialState);
|
||||||
|
console.log("currentUserEmail in AppProvider", currentUserEmail);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof currentUserEmail === 'undefined') {
|
if (typeof currentUserEmail === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!currentUserEmail) {
|
if (!currentUserEmail) {
|
||||||
@@ -26,13 +32,10 @@ const AppProvider = ({ children }) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return onSnapshot(
|
return onSnapshot(
|
||||||
query(
|
query(collection(db, "users"), where("email", "==", currentUserEmail)),
|
||||||
collection(db, "users"),
|
(snapshot) => {
|
||||||
where("email", "==", currentUserEmail)
|
|
||||||
),
|
|
||||||
snapshot => {
|
|
||||||
const doc = snapshot.docs[0];
|
const doc = snapshot.docs[0];
|
||||||
if (typeof doc === 'undefined') {
|
if (typeof doc === "undefined") {
|
||||||
appDispatch({ type: "DELETE_GROUP" });
|
appDispatch({ type: "DELETE_GROUP" });
|
||||||
} else {
|
} else {
|
||||||
appDispatch({ type: "CREATE_GROUP", payload: doc.data() });
|
appDispatch({ type: "CREATE_GROUP", payload: doc.data() });
|
||||||
|
|||||||
@@ -8,6 +8,29 @@
|
|||||||
margin: 30px 0px 0px 0px;
|
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 {
|
.dash-heading-text {
|
||||||
font-size: 1.3rem;
|
font-size: 1.3rem;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user