Files
Mav-Mobile-UI/src/components/UI/Header.tsx

77 lines
2.3 KiB
TypeScript
Raw Normal View History

2025-08-13 14:23:48 +01:00
import { Link } from "react-router";
import Logo from "/MAV.svg";
2025-08-29 10:07:59 +01:00
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faGear,
faHome,
faListCheck,
faMaximize,
faMinimize,
2025-09-18 15:14:47 +01:00
faRotate,
} from "@fortawesome/free-solid-svg-icons";
import { useState } from "react";
import SoundBtn from "./SoundBtn";
import { useNPEDContext } from "../../context/NPEDUserContext";
export default function Header() {
const [isFullscreen, setIsFullscreen] = useState(false);
const { sessionStarted } = useNPEDContext();
const toggleFullscreen = () => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
setIsFullscreen(true);
} else {
document.exitFullscreen();
setIsFullscreen(false);
}
};
2025-09-18 15:14:47 +01:00
const refreshBrowser = () => {
window.location.reload();
};
2025-08-13 14:23:48 +01:00
return (
<div className="relative bg-[#253445] border-b border-gray-500 items-center mx-auto sm:px-3 lg:px-4 py-4 flex flex-col md:flex-row justify-between mb-7 space-y-6 md:space-y-0">
<div className="w-28">
2025-08-13 14:23:48 +01:00
<Link to={"/"}>
<img src={Logo} alt="Logo" width={150} height={150} />
</Link>
</div>
<div className="flex flex-col lg:flex-row items-center space-x-24 justify-items-center">
{sessionStarted && (
<div className="text-green-400 font-bold">Session Active</div>
)}
2025-09-17 14:39:56 +01:00
<div className="flex flex-row space-x-8">
<Link to={"/"}>
<FontAwesomeIcon className="text-white" icon={faHome} size="2x" />
</Link>
<div onClick={toggleFullscreen} className="flex flex-col">
{isFullscreen ? (
<FontAwesomeIcon icon={faMinimize} size="2x" />
) : (
<FontAwesomeIcon icon={faMaximize} size="2x" />
)}
</div>
2025-09-18 15:14:47 +01:00
<div onClick={refreshBrowser}>
<FontAwesomeIcon icon={faRotate} size="2x" />
</div>
<SoundBtn />
2025-09-12 08:21:52 +01:00
<Link to={"/session-settings"}>
2025-09-17 14:39:56 +01:00
<FontAwesomeIcon
className="text-white"
icon={faListCheck}
size="2x"
/>
2025-09-12 08:21:52 +01:00
</Link>
2025-09-12 08:21:52 +01:00
<Link to={"/system-settings"}>
2025-09-17 14:39:56 +01:00
<FontAwesomeIcon className="text-white" icon={faGear} size="2x" />
2025-09-12 08:21:52 +01:00
</Link>
</div>
2025-08-13 14:23:48 +01:00
</div>
</div>
);
}