import React, { useState, useCallback, useEffect } from "react"; import "./App.css"; import SignupModal from "./components/SignupModal.jsx"; import Login from "./components/Login.jsx"; import "bootstrap/dist/css/bootstrap.min.css"; import Col from "react-bootstrap/Col"; import Row from "react-bootstrap/Row"; import RecentLogins from "./components/RecentLogins.jsx"; import Button from "react-bootstrap/Button"; import UserAccount from "./components/UserAccount"; import PasswordReminderModal from "./components/PasswordReminderModal"; import { useDispatch, useSelector } from "react-redux"; import { subscribeAuth } from "./backend/backend"; import { profileLinkSet } from "./features/accountPage/accountPageSlice"; function App() { const user = useSelector((state) => state.user); const dispatch = useDispatch(); useEffect(() => { const unsubscribe = subscribeAuth(); return unsubscribe; }, []); //Handle the modal const [show, setShow] = useState(false); function handleClose() { setShow(false); } function handleShow() { setShow(true); } const handleCloseCallback = useCallback(handleClose, []); //get the first and lastName for the route of the profile const name = (user && user.displayName && user.displayName.trim().split(" ")) || []; const lastName = name.pop(); const firstName = name.join(" "); const profileLink = `/fakebook/${lastName}.${firstName}`; useEffect(() => dispatch(profileLinkSet(profileLink)), [profileLink, dispatch]); //handling the password reminder button const [isModalSignup, setModalSignup] = useState(true); function handleClickPasswordReminderBtn() { setModalSignup(false); handleShow(); } if (user.isLoading) { return