import { useSystem, useSystemSettings } from "@/apis/hooks"; import { ActionButton, SearchBar } from "@/components"; import { setSidebar } from "@/modules/redux/actions"; import { useIsOffline } from "@/modules/redux/hooks"; import { useReduxAction } from "@/modules/redux/hooks/base"; import { Environment, useGotoHomepage, useIsMobile } from "@/utilities"; import { faBars, faHeart, faNetworkWired, faUser, } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FunctionComponent, useMemo } from "react"; import { Button, Col, Container, Dropdown, Image, Navbar, Row, } from "react-bootstrap"; import { Helmet } from "react-helmet"; import NotificationCenter from "./Notification"; const Header: FunctionComponent = () => { const { data: settings } = useSystemSettings(); const hasLogout = (settings?.auth.type ?? "none") === "form"; const changeSidebar = useReduxAction(setSidebar); const offline = useIsOffline(); const isMobile = useIsMobile(); const { shutdown, restart, logout } = useSystem(); const serverActions = useMemo( () => ( { restart(); }} > Restart { shutdown(); }} > Shutdown ), [hasLogout, logout, restart, shutdown] ); const goHome = useGotoHomepage(); return (
brand
{offline ? ( {isMobile ? "" : "Connecting..."} ) : ( serverActions )}
); }; export default Header;