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 { KeycloakContext } from "./context/auth/KeycloakContext"; import { WhoAmIContext } from "./context/whoami/WhoAmI"; import { HelpHeader } from "./components/help-enabler/HelpHeader"; import { Link } from "react-router-dom"; export const Header = () => { return ( } logoComponent="div" headerTools={headerTools()} /> ); }; const ManageAccountDropdownItem = () => { const keycloak = useContext(KeycloakContext); const { t } = useTranslation(); return ( keycloak?.account()}> {t("manageAccount")} ); }; const SignOutDropdownItem = () => { const keycloak = useContext(KeycloakContext); const { t } = useTranslation(); return ( keycloak?.logout()}> {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 keycloak = useContext(KeycloakContext); const whoami = useContext(WhoAmIContext); const [isDropdownOpen, setDropdownOpen] = useState(false); const onDropdownToggle = () => { setDropdownOpen(!isDropdownOpen); }; return ( {whoami.getDisplayName()} } dropdownItems={userDropdownItems} /> ); };