Skip to content

Commit 757e712

Browse files
committed
feat: #309 - Remove forced login; update UI elements to reflect public vs. admin login
1 parent f81704f commit 757e712

File tree

5 files changed

+6
-127
lines changed

5 files changed

+6
-127
lines changed

frontend/src/components/Header/Header.tsx

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useState, useRef, useEffect, Fragment } from "react";
22
// import { useState, Fragment } from "react";
33
import accountLogo from "../../assets/account.svg";
44
import { Link, useNavigate, useLocation } from "react-router-dom";
5-
import LoginMenuDropDown from "./LoginMenuDropDown";
65
import "../../components/Header/header.css";
76
import Chat from "./Chat";
87
import { FeatureMenuDropDown } from "./FeatureMenuDropDown";
@@ -24,7 +23,6 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
2423
const dropdownRef = useRef(null);
2524
let delayTimeout: number | null = null;
2625
const [showChat, setShowChat] = useState(false);
27-
const [showLoginMenu, setShowLoginMenu] = useState(false);
2826
const [redirect, setRedirect] = useState(false);
2927
const { setShowSummary, setEnterNewPatient, triggerFormReset, setIsEditing } =
3028
useGlobalContext();
@@ -36,19 +34,6 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
3634
setRedirect(false);
3735
};
3836

39-
const guestLinks = () => (
40-
<nav onClick={handleLoginMenu} className="flex cursor-pointer items-center">
41-
<img
42-
src={accountLogo}
43-
alt="logo"
44-
className="mr-5 h-5 object-contain lg:h-4 "
45-
/>
46-
<span className=" text-black hover:border-b-2 hover:border-blue-600 hover:text-black hover:no-underline lg:text-sm xl:text-lg">
47-
Sign in
48-
</span>
49-
</nav>
50-
);
51-
5237
const authLinks = () => (
5338
<nav onClick={logout_user} className="flex cursor-pointer items-center">
5439
<img src={accountLogo} alt="logo" className="mr-5 h-5 object-contain " />
@@ -58,10 +43,6 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
5843
</nav>
5944
);
6045

61-
const handleLoginMenu = () => {
62-
setShowLoginMenu(!showLoginMenu);
63-
};
64-
6546
const handleMouseEnter = () => {
6647
if (delayTimeout !== null) {
6748
clearTimeout(delayTimeout);
@@ -136,7 +117,7 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
136117
Balancer
137118
</span>
138119
</Link>
139-
<nav className=" flex space-x-2 font-satoshi lg:space-x-3 xl:gap-3 xl:font-bold ">
120+
<nav className="flex space-x-2 font-satoshi lg:space-x-3 xl:gap-3 xl:font-bold ">
140121
<Link
141122
to="/"
142123
onClick={() => handleForm()}
@@ -196,7 +177,7 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
196177
>
197178
Donate
198179
</a>
199-
{isSuperuser && (
180+
{(isAuthenticated && isSuperuser) && (
200181
<div
201182
onMouseEnter={handleMouseEnter}
202183
onMouseLeave={handleMouseLeave}
@@ -230,15 +211,12 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
230211
{redirect ? navigate("/") : <Fragment></Fragment>}
231212
</>
232213
</nav>
233-
<LoginMenuDropDown
234-
showLoginMenu={showLoginMenu}
235-
handleLoginMenu={handleLoginMenu}
236-
/>
237214
{isAuthenticated && (
238-
<Chat showChat={showChat} setShowChat={setShowChat} />
215+
<>
216+
<Chat showChat={showChat} setShowChat={setShowChat} />
217+
</>
239218
)}
240-
{/* <Chat showChat={showChat} setShowChat={setShowChat} /> */}
241-
{isAuthenticated ? authLinks() : guestLinks()}
219+
{isAuthenticated && authLinks()}
242220
</div>
243221
<MdNavBar handleForm={handleForm} isAuthenticated={isAuthenticated} />
244222
</header>

frontend/src/components/Header/LoginMenuDropDown.tsx

Lines changed: 0 additions & 78 deletions
This file was deleted.

frontend/src/pages/Layout/Layout.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import {ReactNode, useState, useEffect} from "react";
33
import Header from "../../components/Header/Header";
44
import Footer from "../../components/Footer/Footer";
5-
import LoginMenuDropDown from "../../components/Header/LoginMenuDropDown";
65
import {connect} from "react-redux";
76
import {useAuth} from "./authHooks.ts";
87
import {RootState} from "../../services/actions/types";
@@ -50,12 +49,6 @@ export const Layout = ({
5049
<div className="gradient"/>
5150
</div>
5251
<div className="relative z-10 mx-auto flex w-full flex-col items-center">
53-
{!isAuthenticated && showLoginMenu && (
54-
<LoginMenuDropDown
55-
showLoginMenu={showLoginMenu}
56-
handleLoginMenu={handleLoginMenu}
57-
/>
58-
)}
5952
<Header/>
6053
{children}
6154
<Footer/>

frontend/src/pages/Layout/Layout_V2_Header.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useState, useEffect } from "react";
22
import { Link, useLocation } from "react-router-dom";
3-
import LoginMenuDropDown from "../../components/Header/LoginMenuDropDown.tsx";
43
import { useAuth } from "./authHooks.ts";
54
import { useGlobalContext } from "../../../src/contexts/GlobalContext.tsx";
65

@@ -65,14 +64,6 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated }) => {
6564
)}
6665
</div>
6766
</nav>
68-
{!isAuthenticated && showLoginMenu && (
69-
<div className="flex w-1/6 flex-none justify-end">
70-
<LoginMenuDropDown
71-
showLoginMenu={showLoginMenu}
72-
handleLoginMenu={handleLoginMenu}
73-
/>
74-
</div>
75-
)}
7667
</header>
7768
);
7869
};

frontend/src/pages/Login/LoginForm.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ function LoginForm({ isAuthenticated, loginError }: LoginFormProps) {
109109
</div>
110110

111111
<div className="flex items-center justify-between">
112-
{/* <Link to="/resetpassword">
113-
<button className="btnGray" type="submit">
114-
Forgot Password?
115-
</button>
116-
</Link> */}
117112
<button className="btnBlue w-full text-lg" type="submit">
118113
Sign In
119114
</button>

0 commit comments

Comments
 (0)