Skip to content

Commit

Permalink
dashboard and transaction greyed out and won't redirect when clicked …
Browse files Browse the repository at this point in the history
…unless logged in.
  • Loading branch information
LG9757 committed Apr 26, 2024
1 parent 7ddb7c9 commit 59d64be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/assets/css/Header.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,13 @@ body {
background-color: transparent;
border: none;
cursor: pointer;
}

.text-muted {
color: #6c757d;
pointer-events: none;
}

.bg-transparent {
background-color: transparent;
}
9 changes: 6 additions & 3 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import useWindowDimensions from "../hooks/WindowDimensionsHook.tsx";
import "../assets/css/Header.css"
import {Link, useNavigate} from "react-router-dom";
import {Link, useNavigate, useLocation} from "react-router-dom";
import {auth} from "../utils/firebase.ts";

interface Props {
Expand All @@ -16,12 +16,15 @@ export function Header({ user }: Props) {
const currentUser = auth.currentUser?.displayName?? "";

const navigate = useNavigate();
const location = useLocation();

const handleLogout = () => {
auth.signOut();
navigate("/", { replace: true });
};

const isIndexPage = location.pathname === "/";

return (
<header className="header">
{/* App Name reloads home page */}
Expand All @@ -32,10 +35,10 @@ export function Header({ user }: Props) {
{/* Pages */}
<ul className="header-nav">
{/* Links to dashboard with tiles */}
<li><Link to="/dash" className="header-item">Dashboard</Link></li>
<li><Link to="/dash" className={`header-item ${isIndexPage ? "text-muted bg-transparent" : "header-item"}`}>Dashboard</Link></li>

{/* Links to transactions page with table of expenses */}
<li><Link to="/transactions" className="header-item">Transactions</Link></li>
<li><Link to="/transactions" className={`header-item ${isIndexPage ? "text-muted bg-transparent" : "header-item"}`}>Transactions</Link></li>

<li><Link to="/test" className="header-item">Firestore Test</Link></li>

Expand Down

0 comments on commit 59d64be

Please sign in to comment.