Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions frontend/src/main-page/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
import { Routes, Route } from "react-router-dom";
import Dashboard from "./dashboard/Dashboard";
import GrantPage from "./grants/GrantPage";
import Header from "./header/Header";
import NavBar from "./navbar/NavBar";
import Users from "./users/Users";
import RestrictedPage from "./restricted/RestrictedPage";

import CashFlowPage from "./cash-flow/CashFlowPage";
import SettingsPage from "./settings/SettingsPage";

function MainPage() {


return (
<div className="w-full">
<Header />
<div className="w-full h-screen flex flex-row">
<NavBar/>
<div className="flex-1 overflow-auto">
<Routes>
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/all-grants" element={<GrantPage showOnlyMyGrants={false} />} />
<Route path="/my-grants" element={<GrantPage showOnlyMyGrants={true} />} />
<Route path="/users" element={<Users />} />
<Route path="/restricted" element={<RestrictedPage />} />
<Route path="/cash-flow" element={<CashFlowPage />} />
<Route path="/settings" element={<SettingsPage />} />
{/* fallback route */}
<Route path="*" element={<GrantPage />} />
</Routes>
</div>
</div>
);
}
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/main-page/cash-flow/CashFlowPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function CashFlowPage() {
return (
<div className="p-4">
<h1 className="text-2xl font-bold mb-4">PLACEHOLDER</h1>
{/* Add more content and components related to cash flow here */}
</div>
);
}

export default CashFlowPage;
5 changes: 5 additions & 0 deletions frontend/src/main-page/grants/GrantPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { toJS } from "mobx";
import { fetchGrants } from "./filter-bar/processGrantData.ts";
import { UserStatus } from "../../../../middle-layer/types/UserStatus.ts";
import { Navigate } from "react-router-dom";
import BellButton from "../navbar/Bell.tsx";

interface GrantPageProps {
showOnlyMyGrants?: boolean; //if true, filters grants by user email
Expand All @@ -29,6 +30,7 @@ function GrantPage({ showOnlyMyGrants = false }: GrantPageProps) {
const [showNewGrantModal, setShowNewGrantModal] = useState(false);
const [wasGrantSubmitted, setWasGrantSubmitted] = useState(false);
const [selectedGrant, setSelectedGrant] = useState<Grant | null>(null);
const [openModal, setOpenModal] = useState(false);

const { user } = useAuthContext(); //gets current logged in user
const userObj = toJS(user);
Expand Down Expand Up @@ -60,6 +62,9 @@ function GrantPage({ showOnlyMyGrants = false }: GrantPageProps) {
<div className="flex justify-end align-middle p-4 gap-4">
<GrantSearch />
<AddGrantButton onClick={() => setShowNewGrantModal(true)} />
<div className="bell-container">
<BellButton setOpenModal={setOpenModal} openModal={openModal} />
</div>
</div>
<div className="grid grid-cols-5 gap-8 px-4">
<div className="col-span-1">
Expand Down
78 changes: 0 additions & 78 deletions frontend/src/main-page/header/AccountInfo.tsx

This file was deleted.

85 changes: 0 additions & 85 deletions frontend/src/main-page/header/Header.tsx

This file was deleted.

43 changes: 0 additions & 43 deletions frontend/src/main-page/header/UserButton.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { api } from "../../api";

interface BellButtonProps {
// onClick handler to open notification popup
setOpenModal: (modal: string | null) => void;
openModal: string | null;
setOpenModal: (open: boolean) => void;
openModal: boolean;
}

const BellButton: React.FC<BellButtonProps> = observer(({ setOpenModal, openModal }) => {
Expand All @@ -38,7 +38,7 @@ const BellButton: React.FC<BellButtonProps> = observer(({ setOpenModal, openModa
console.log(response);
const currNotifications = await response.json();
setNotificationsAction(currNotifications);
setOpenModal(openModal === "bell" ? null : "bell");
setOpenModal(!openModal);
return notifications;
};

Expand All @@ -48,7 +48,7 @@ const BellButton: React.FC<BellButtonProps> = observer(({ setOpenModal, openModa
className="bell-wrapper inline-block relative p-2 hover:bg-primary-700 rounded-md"
>
<button
className={`bell-button ${openModal === "bell" ? "hovered" : ""} bg-none border-none relative`}
className={`bell-button ${openModal ? "hovered" : ""} bg-none border-none relative`}
onClick={handleClick}
>
<FontAwesomeIcon
Expand All @@ -63,7 +63,7 @@ const BellButton: React.FC<BellButtonProps> = observer(({ setOpenModal, openModa

</div>

{(openModal === "bell" ? (
{(openModal ? (
<NotificationPopup
setOpenModal={setOpenModal}
/>
Expand Down
Loading