import { Avatar, Brand, Dropdown, DropdownItem, DropdownSeparator, DropdownToggle, KebabToggle, PageHeader, PageHeaderTools, PageHeaderToolsGroup, PageHeaderToolsItem, } from "@patternfly/react-core"; import { HelpIcon } from "@patternfly/react-icons"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { HelpHeader, useHelp } from "./components/help-enabler/HelpHeader"; import { useAdminClient } from "./context/auth/AdminClient"; import { useRealm } from "./context/realm-context/RealmContext"; import { useWhoAmI } from "./context/whoami/WhoAmI"; import { toDashboard } from "./dashboard/routes/Dashboard"; import environment from "./environment"; export const Header = () => { const { realm } = useRealm(); const adminClient = useAdminClient(); const { t } = useTranslation(); const ManageAccountDropdownItem = () => adminClient.keycloak ? ( adminClient.keycloak?.accountManagement()} > {t("manageAccount")} ) : null; const SignOutDropdownItem = () => adminClient.keycloak ? ( adminClient.keycloak?.logout({ redirectUri: "" })} > {t("signOut")} ) : null; const ServerInfoDropdownItem = () => { const { realm } = useRealm(); const { t } = useTranslation(); return ( ( )} > {t("realmInfo")} ); }; const HelpDropdownItem = () => { const { t } = useTranslation(); const { enabled, toggleHelp } = useHelp(); return ( } onClick={toggleHelp}> {enabled ? t("helpEnabled") : t("helpDisabled")} ); }; 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 } = useWhoAmI(); const [isDropdownOpen, setDropdownOpen] = useState(false); const onDropdownToggle = () => { setDropdownOpen(!isDropdownOpen); }; return ( {whoAmI.getDisplayName()} } dropdownItems={userDropdownItems} /> ); }; return (