more
This commit is contained in:
@@ -83,6 +83,7 @@ const CaseListPage = ({ perPage }) => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const dropDownOptions = [
|
const dropDownOptions = [
|
||||||
{ label: "Case name a - z", value: "caption" },
|
{ label: "Case name a - z", value: "caption" },
|
||||||
{ label: "Case name z - a", value: "caption2" },
|
{ label: "Case name z - a", value: "caption2" },
|
||||||
@@ -159,11 +160,17 @@ const CaseListPage = ({ perPage }) => {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="nodocs-text-container">
|
<div className="nodocs-text-container">
|
||||||
<p> You have not created any cases yet.</p>
|
<p> Please create your first case.</p>
|
||||||
<p>
|
<p>
|
||||||
To get started, click "Create New Case" and enter case
|
To create a discovery request or response, you will first enter
|
||||||
information.
|
some basic information about the case they will pertain to -
|
||||||
|
i.e. the caption and case number.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Then, you will upload a document (i.e. interrogatories or a
|
||||||
|
complaint), for use in generating a request/response.
|
||||||
|
</p>
|
||||||
|
<p>Click "Create New Case" to get started.</p>
|
||||||
{createNewButton()}
|
{createNewButton()}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,30 +1,183 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { collection, setDoc, doc } from "firebase/firestore";
|
import { collection, setDoc, doc } from "firebase/firestore";
|
||||||
import { db } from "../../firebase";
|
import { db, auth } from "../../firebase";
|
||||||
import Button from "../../pageElements/Button";
|
import Button from "../../pageElements/Button";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
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 { stateDataValues } from "../../Constants/Fields/SignupFields";
|
||||||
import "../../styles/homepage.scss";
|
import "../../styles/homepage.scss";
|
||||||
|
|
||||||
const HomePage = () => {
|
const HomePage = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [showPromoModal, setShowPromoModal] = useState(false);
|
const [showPromoModal, setShowPromoModal] = useState(false);
|
||||||
const issueText = "";
|
const [isBusy, setIsBusy] = useState(false);
|
||||||
|
const [notice, setNotice] = useState("");
|
||||||
|
|
||||||
const handleNavigate = () => {
|
const apiUrl =
|
||||||
navigate("/signup");
|
process.env.NODE_ENV === "development"
|
||||||
|
? process.env.REACT_APP_API_DEV
|
||||||
|
: process.env.REACT_APP_API_PROD;
|
||||||
|
|
||||||
|
async function saveUserData(
|
||||||
|
authId,
|
||||||
|
dataValues,
|
||||||
|
customerId,
|
||||||
|
subscriptionCreated,
|
||||||
|
subscriptionPeriodStart,
|
||||||
|
subscriptionPeriodEnd,
|
||||||
|
subscriptionId,
|
||||||
|
isPromotionalMebership
|
||||||
|
) {
|
||||||
|
const appUserId = uuidv4();
|
||||||
|
const firmId = uuidv4();
|
||||||
|
const fbAuthUid = authId;
|
||||||
|
//let plan = selectedPlan;
|
||||||
|
let docsAllowedPerMonth;
|
||||||
|
if (isPromotionalMebership === true) {
|
||||||
|
docsAllowedPerMonth = 1;
|
||||||
|
subscriptionId = uuidv4();
|
||||||
|
let plan = "promo plan";
|
||||||
|
} else {
|
||||||
|
//docsAllowedPerMonth = selectedPlan[0].docsAllowedPerMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
const docsGenerated = 0;
|
||||||
|
|
||||||
|
const {
|
||||||
|
firstName,
|
||||||
|
lastName,
|
||||||
|
firm,
|
||||||
|
telephone,
|
||||||
|
streetAddress,
|
||||||
|
city,
|
||||||
|
state,
|
||||||
|
zipCode,
|
||||||
|
barNumber,
|
||||||
|
practiceArea,
|
||||||
|
email,
|
||||||
|
} = dataValues;
|
||||||
|
|
||||||
|
const userState = stateDataValues.filter((value) => {
|
||||||
|
if (value.name === state) return value;
|
||||||
|
});
|
||||||
|
|
||||||
|
const userData = {
|
||||||
|
docsAllowedPerMonth,
|
||||||
|
docsGenerated,
|
||||||
|
appUserId,
|
||||||
|
fbAuthUid,
|
||||||
|
firmId,
|
||||||
|
firstName,
|
||||||
|
lastName,
|
||||||
|
firm,
|
||||||
|
telephone,
|
||||||
|
streetAddress,
|
||||||
|
city,
|
||||||
|
state: userState,
|
||||||
|
zipCode,
|
||||||
|
barNumber,
|
||||||
|
practiceArea,
|
||||||
|
email,
|
||||||
|
isPromotionalMebership,
|
||||||
|
customerId: customerId,
|
||||||
|
subscriptionId: subscriptionId,
|
||||||
|
//subscriptionPlan: plan,
|
||||||
|
subscriptionCreated: subscriptionCreated,
|
||||||
|
subscriptionPeriodStart: subscriptionPeriodStart,
|
||||||
|
subscriptionPeriodEnd: subscriptionPeriodEnd,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const usersRef = collection(db, "users");
|
||||||
|
const res = await setDoc(doc(usersRef, fbAuthUid), userData);
|
||||||
|
return res;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Error saving new user to db: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getFocusData(code) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${apiUrl}/v1/get-focused-data/${code}`, {
|
||||||
|
method: "GET",
|
||||||
|
});
|
||||||
|
const res = await response.json();
|
||||||
|
return res;
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Error in get rqst:", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleProcessPromoSubscription(code) {
|
||||||
|
console.log("code in handleProcessPromoSubscription", code);
|
||||||
|
setShowPromoModal(false);
|
||||||
|
if (!code) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIsBusy(true);
|
||||||
|
const userData = await getFocusData(code);
|
||||||
|
if (!userData) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
handlePromoSignup(userData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePromoSignup = async (dataValues) => {
|
||||||
|
console.log("dataValues in handlePromoSignup", dataValues);
|
||||||
|
return;
|
||||||
|
if (dataValues) {
|
||||||
|
try {
|
||||||
|
const customerId = `${uuidv4()}-florida-spring-promo`;
|
||||||
|
const today = new Date();
|
||||||
|
const subscriptionCreated = today;
|
||||||
|
const subscriptionPeriodStart = today;
|
||||||
|
console.log(subscriptionPeriodStart);
|
||||||
|
const subscriptionPeriodEnd = today;
|
||||||
|
const subscriptionId = uuidv4();
|
||||||
|
|
||||||
|
const userCredential = await createUserWithEmailAndPassword(
|
||||||
|
auth,
|
||||||
|
dataValues.email,
|
||||||
|
dataValues.password
|
||||||
|
);
|
||||||
|
|
||||||
|
const user = userCredential.user;
|
||||||
|
dataValues = { ...dataValues };
|
||||||
|
|
||||||
|
const isPromotionalMebership = true;
|
||||||
|
const res = await saveUserData(
|
||||||
|
user.uid,
|
||||||
|
dataValues,
|
||||||
|
customerId,
|
||||||
|
subscriptionCreated,
|
||||||
|
subscriptionPeriodStart,
|
||||||
|
subscriptionPeriodEnd,
|
||||||
|
subscriptionId,
|
||||||
|
isPromotionalMebership
|
||||||
|
);
|
||||||
|
setIsBusy(false);
|
||||||
|
navigate("/dashboard");
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error handling request", error, error.message);
|
||||||
|
setIsBusy(false);
|
||||||
|
setNotice("Sorry, something went wrong. Please try again.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleTryItButton = () => {
|
||||||
|
setShowPromoModal(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLogin = () => {
|
const handleLogin = () => {
|
||||||
navigate("/login");
|
navigate("/login");
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleConfirmPromoCode = () => {
|
|
||||||
//
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancelModal = () => {
|
const handleCancelModal = () => {
|
||||||
setShowPromoModal(!showPromoModal);
|
setShowPromoModal(!showPromoModal);
|
||||||
navigate("/signup");
|
navigate("/signup");
|
||||||
@@ -73,7 +226,7 @@ const HomePage = () => {
|
|||||||
<Button
|
<Button
|
||||||
className="primary-button homepage-button"
|
className="primary-button homepage-button"
|
||||||
labelText="Try It For Free"
|
labelText="Try It For Free"
|
||||||
onClick={handleNavigate}
|
onClick={handleTryItButton}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -90,7 +243,7 @@ const HomePage = () => {
|
|||||||
<Button
|
<Button
|
||||||
className="primary-button homepage-button"
|
className="primary-button homepage-button"
|
||||||
labelText="Try It For Free"
|
labelText="Try It For Free"
|
||||||
onClick={handleNavigate}
|
onClick={handleTryItButton}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -300,8 +453,7 @@ const HomePage = () => {
|
|||||||
onCancel={handleCancelModal}
|
onCancel={handleCancelModal}
|
||||||
buttonLabelText="Enter Code"
|
buttonLabelText="Enter Code"
|
||||||
isPromoModal={true}
|
isPromoModal={true}
|
||||||
issueText={issueText ? issueText : null}
|
onConfirm={handleProcessPromoSubscription}
|
||||||
onConfirm={handleConfirmPromoCode}
|
|
||||||
cancelButtonText="I don't have a code"
|
cancelButtonText="I don't have a code"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const ConfirmModal = ({
|
|||||||
isPromoModal,
|
isPromoModal,
|
||||||
cancelButtonText,
|
cancelButtonText,
|
||||||
}) => {
|
}) => {
|
||||||
|
const [inputValue, setInputValue] = useState("");
|
||||||
const title = titleText ? titleText : "Confirmation";
|
const title = titleText ? titleText : "Confirmation";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -53,11 +54,11 @@ const ConfirmModal = ({
|
|||||||
<TextInput
|
<TextInput
|
||||||
key={"captionTwo"}
|
key={"captionTwo"}
|
||||||
name={"captionTwo"}
|
name={"captionTwo"}
|
||||||
value={issueText}
|
value={inputValue}
|
||||||
message={"data.captionTwo.message"}
|
message={"data.captionTwo.message"}
|
||||||
onChange={(e) => setIssueText(e.target.value)}
|
onChange={(e) => setInputValue(e.target.value)}
|
||||||
label={
|
label={
|
||||||
issueText
|
inputValue
|
||||||
? ""
|
? ""
|
||||||
: isPromoModal
|
: isPromoModal
|
||||||
? "Enter your promotional code"
|
? "Enter your promotional code"
|
||||||
@@ -79,7 +80,7 @@ const ConfirmModal = ({
|
|||||||
<Button
|
<Button
|
||||||
disabled={isBusy}
|
disabled={isBusy}
|
||||||
className="primary-button"
|
className="primary-button"
|
||||||
onClick={onConfirm}
|
onClick={() => onConfirm(inputValue)}
|
||||||
labelText={buttonLabelText}
|
labelText={buttonLabelText}
|
||||||
/>
|
/>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ const SignupPage = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleConfirmPromoCode = () => {
|
const handleConfirmPromoCode = (code) => {
|
||||||
if (issueText === marchEmailPrm) {
|
if (code === marchEmailPrm) {
|
||||||
handlePromoSignup();
|
handlePromoSignup(code);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -467,7 +467,7 @@ const SignupPage = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePromoSignup = async () => {
|
const handlePromoSignup = async (code) => {
|
||||||
let dataValues = validateUserData();
|
let dataValues = validateUserData();
|
||||||
if (dataValues === null) {
|
if (dataValues === null) {
|
||||||
return;
|
return;
|
||||||
@@ -540,7 +540,8 @@ const SignupPage = () => {
|
|||||||
<h1 className="signup-header-text">Create A Novodraft Account</h1>
|
<h1 className="signup-header-text">Create A Novodraft Account</h1>
|
||||||
{!isUpgrade ? (
|
{!isUpgrade ? (
|
||||||
<h5 className="signup-header-text trial">
|
<h5 className="signup-header-text trial">
|
||||||
Start a free trial - save hours and draft smarter discovery
|
Create an account to start a free trial - save time and draft
|
||||||
|
smarter
|
||||||
</h5>
|
</h5>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
|
|||||||
Reference in New Issue
Block a user