import React, { useContext, useState } from "react"; import { useTranslation } from "react-i18next"; import { Avatar, Brand, Dropdown, DropdownItem, DropdownSeparator, DropdownToggle, KebabToggle, PageHeader, PageHeaderTools, PageHeaderToolsItem, PageHeaderToolsGroup, } from "@patternfly/react-core"; import { HelpIcon } from "@patternfly/react-icons"; import { WhoAmIContext } from "./context/whoami/WhoAmI"; import { HelpHeader } from "./components/help-enabler/HelpHeader"; import { Link } from "react-router-dom"; import { useAdminClient } from "./context/auth/AdminClient"; export const Header = () => { const adminClient = useAdminClient(); const { t } = useTranslation(); const ManageAccountDropdownItem = () => { return ( adminClient.keycloak.accountManagement()} > {t("manageAccount")} ); }; const SignOutDropdownItem = () => { return ( adminClient.keycloak.logout({ redirectUri: "" })} > {t("signOut")} ); }; const ServerInfoDropdownItem = () => { const { t } = useTranslation(); return {t("serverInfo")}; }; const HelpDropdownItem = () => { const { t } = useTranslation(); return }>{t("help")}; }; const kebabDropdownItems = [ , , , , , ]; const userDropdownItems = [ , , , , ]; const headerTools = () => { return ( ); }; const KebabDropdown = () => { const [isDropdownOpen, setDropdownOpen] = useState(false); const onDropdownToggle = () => { setDropdownOpen(!isDropdownOpen); }; return ( } isOpen={isDropdownOpen} dropdownItems={kebabDropdownItems} /> ); }; const UserDropdown = () => { const whoami = useContext(WhoAmIContext); const [isDropdownOpen, setDropdownOpen] = useState(false); const onDropdownToggle = () => { setDropdownOpen(!isDropdownOpen); }; return ( {whoami.getDisplayName()} } dropdownItems={userDropdownItems} /> ); }; return ( } logoComponent="div" headerTools={headerTools()} /> ); };