import React, { useContext, useState } from "react"; import { useTranslation } from "react-i18next"; import { Avatar, Button, ButtonVariant, Brand, Dropdown, DropdownItem, DropdownSeparator, DropdownToggle, KebabToggle, PageHeader, PageHeaderTools, PageHeaderToolsItem, PageHeaderToolsGroup, } from "@patternfly/react-core"; import { HelpIcon } from "@patternfly/react-icons"; import { KeycloakContext } from "./auth/KeycloakContext"; 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("Manage account")} ); }; const SignOutDropdownItem = () => { const keycloak = useContext(KeycloakContext); const { t } = useTranslation(); return ( keycloak?.logout()}> {t("Sign out")} ); }; const ServerInfoDropdownItem = () => { const { t } = useTranslation(); return {t("Server info")}; }; const HelpDropdownItem = () => { const { t } = useTranslation(); const help = t("Help"); return ( {` ${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 [isDropdownOpen, setDropdownOpen] = useState(false); const onDropdownToggle = () => { setDropdownOpen(!isDropdownOpen); }; return ( {keycloak?.loggedInUser} } dropdownItems={userDropdownItems} /> ); };