import { useState, useContext, useEffect } from "react"; import { useNavigate } from "react-router-dom"; import { db } from "../../firebase"; import { collection, onSnapshot, query, where } from "firebase/firestore"; import Button from "../../pageElements/Button"; import { AppContext } from "../../Hooks/useContext/appContext"; import { AuthContext } from "../../Context/AuthProvider"; import ProgressBar from "../../pageElements/ProgressBar"; import ConfirmModal from "../Modals/ConfirmModal"; const AccountPage = () => { const navigate = useNavigate(); const { currentUserCreatedAt } = useContext(AuthContext); const { appState } = useContext(AppContext); const { group } = appState; const [docsGenerated, setDocsGenerated] = useState(null); const [docsAllowed, setDocsAllowed] = useState(10); const appUserId = group ? group.appUserId : null; const [showModal, setShowModal] = useState(false); function getDocumentsCount() { if (!appUserId) { return; } return onSnapshot( query(collection(db, "documents"), where("ownerId", "==", appUserId)), (snapshot) => setDocsGenerated(snapshot.docs.length) ); } useEffect(getDocumentsCount, [appUserId]); const telNumberFormat = (num) => { return `(${num.slice(0, 3)}) ${num.slice(4, 7)}-${num.slice(6, 10)}`; }; if (!group) { return null; } const handleCancelSub = () => { setShowModal(true); // API call }; const handleSupport = () => { const supReq = "5ac45d12"; navigate(`/requestpage/${supReq}`); }; return (
{/*
Personal Settings
Payment Settings
Membership Settings
Order History
*/}
{docsGenerated !== null ? (
You have generated {docsGenerated} out of {docsAllowed} response documents this billing period
Upgrade to get more
) : null} {/*
Take full advantage of the features included in your account
Give the gift of Novodraft
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Give the gift of Novodraft
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Give the gift of Novodraft
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Give the gift of Novodraft
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
*/}
Need Support?
{/*
1-222-333-4444
*/}
support@novodraft.ai
Or use our contact form
FAQ
Support
Billing
Privacy
Active Subscriptions
30 day free trial - 1 allowed document
Amount:
Free!
{typeof currentUserCreatedAt !== "undefined" ? (
Activated:
{currentUserCreatedAt.toLocaleDateString("en-US")}
) : null}
{group.firstName} {group.lastName}
{group.firm}
{group.email}
{telNumberFormat(group.telephone)}
{showModal ? ( setShowModal(false)} onConfirm={handleCancelSub} buttonLabelText="Confirm Cancel" modalText="Are you sure? Your subscription will end at the conclusion of the current billing period." /> ) : null}
); }; export default AccountPage;