diff --git a/src/components/BottomBar.tsx b/src/components/BottomBar.tsx new file mode 100644 index 00000000..49968ef3 --- /dev/null +++ b/src/components/BottomBar.tsx @@ -0,0 +1,63 @@ +import clsx from "clsx"; +import {IconType} from "react-icons"; +import {MdSpaceDashboard} from "react-icons/md"; +import {BsFileEarmarkText, BsClockHistory, BsPencil, BsGraphUp} from "react-icons/bs"; +import {RiLogoutBoxFill} from "react-icons/ri"; +import {SlPencil} from "react-icons/sl"; +import {FaAward} from "react-icons/fa"; +import Link from "next/link"; +import {useRouter} from "next/router"; +import axios from "axios"; +import FocusLayer from "@/components/FocusLayer"; +import {preventNavigation} from "@/utils/navigation.disabled"; +interface Props { + path: string; + navDisabled?: boolean; + focusMode?: boolean; + onFocusLayerMouseEnter?: () => void; + className?: string; +} + +interface NavProps { + Icon: IconType; + label: string; + path: string; + keyPath: string; + disabled?: boolean; +} + +const Nav = ({Icon, label, path, keyPath, disabled = false}: NavProps) => ( + + + +); + +export default function BottomBar({path, navDisabled = false, focusMode = false, onFocusLayerMouseEnter, className}: Props) { + const router = useRouter(); + + const logout = async () => { + axios.post("/api/logout").finally(() => { + setTimeout(() => router.reload(), 500); + }); + }; + + const disableNavigation = preventNavigation(navDisabled, focusMode); + + return ( +
+
+
+ {focusMode && } +
+ ); +} diff --git a/src/components/High/Layout.tsx b/src/components/High/Layout.tsx index cd2d5214..b5f86908 100644 --- a/src/components/High/Layout.tsx +++ b/src/components/High/Layout.tsx @@ -1,6 +1,7 @@ import {User} from "@/interfaces/user"; import clsx from "clsx"; import {useRouter} from "next/router"; +import BottomBar from "../BottomBar"; import Navbar from "../Navbar"; import Sidebar from "../Sidebar"; @@ -17,13 +18,26 @@ export default function Layout({user, children, className, navDisabled = false, const router = useRouter(); return ( -
+
+
- +
{children} diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 694b9c26..3c0abe06 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -3,6 +3,10 @@ import Link from "next/link"; import {Avatar} from "primereact/avatar"; import FocusLayer from "@/components/FocusLayer"; import {preventNavigation} from "@/utils/navigation.disabled"; +import {useRouter} from "next/router"; +import axios from "axios"; +import {RiLogoutBoxFill} from "react-icons/ri"; +import {BsPower} from "react-icons/bs"; interface Props { user: User; @@ -14,18 +18,30 @@ interface Props { /* eslint-disable @next/next/no-img-element */ export default function Navbar({user, navDisabled = false, focusMode = false, onFocusLayerMouseEnter}: Props) { const disableNavigation = preventNavigation(navDisabled, focusMode); + const router = useRouter(); + + const logout = async () => { + axios.post("/api/logout").finally(() => { + setTimeout(() => router.reload(), 500); + }); + }; return ( -
-
+
+ EnCoach's Logo -

EnCoach

-
-
- - +

EnCoach

+ +
+ + {user.name} - {user.name} + {user.name} +
{focusMode && } diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index acb60652..e8c296d4 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -15,6 +15,7 @@ interface Props { navDisabled?: boolean; focusMode?: boolean; onFocusLayerMouseEnter?: () => void; + className?: string; } interface NavProps { @@ -37,7 +38,7 @@ const Nav = ({Icon, label, path, keyPath, disabled = false}: NavProps) => ( ); -export default function Sidebar({path, navDisabled = false, focusMode = false, onFocusLayerMouseEnter}: Props) { +export default function Sidebar({path, navDisabled = false, focusMode = false, onFocusLayerMouseEnter, className}: Props) { const router = useRouter(); const logout = async () => { @@ -49,7 +50,7 @@ export default function Sidebar({path, navDisabled = false, focusMode = false, o const disableNavigation = preventNavigation(navDisabled, focusMode); return ( -
+