/* eslint-disable */ // @ts-nocheck import logoSvgUrl from "./assets/logo.svg"; import { KeycloakMasthead, useEnvironment, useHelp, } from "../shared/keycloak-ui-shared"; import { DropdownItem, ToolbarItem } from "../shared/@patternfly/react-core"; import { HelpIcon } from "../shared/@patternfly/react-icons"; import { useTranslation } from "react-i18next"; import { Link, useHref } from "react-router-dom"; import { PageHeaderClearCachesModal } from "./PageHeaderClearCachesModal"; import { HelpHeader } from "./components/help-enabler/HelpHeader"; import { useAccess } from "./context/access/Access"; import { useRealm } from "./context/realm-context/RealmContext"; import { toDashboard } from "./dashboard/routes/Dashboard"; import type { Environment } from "./environment-types"; import { usePreviewLogo } from "./realm-settings/themes/LogoContext"; import { joinPath } from "./utils/joinPath"; import { useIsFeatureDisabled, Feature } from "./utils/useIsFeatureEnabled"; import useToggle from "./utils/useToggle"; const ManageAccountDropdownItem = () => { const { keycloak } = useEnvironment(); const { t } = useTranslation(); const isFeatureDisabled = useIsFeatureDisabled(); if (isFeatureDisabled(Feature.AccountV3)) { return null; } return ( keycloak.accountManagement()} > {t("manageAccount")} ); }; const ServerInfoDropdownItem = () => { const { realm } = useRealm(); const { t } = useTranslation(); return ( } > {t("realmInfo")} ); }; const ClearCachesDropdownItem = () => { const { t } = useTranslation(); const [open, toggleModal] = useToggle(); return ( <> toggleModal()}> {t("clearCachesTitle")} {open && toggleModal()} />} ); }; const HelpDropdownItem = () => { const { t } = useTranslation(); const { enabled, toggleHelp } = useHelp(); return ( } onClick={toggleHelp} > {enabled ? t("helpEnabled") : t("helpDisabled")} ); }; const kebabDropdownItems = (isMasterRealm: boolean, isManager: boolean) => [ , , ...(isMasterRealm && isManager ? [] : []), , ]; const userDropdownItems = (isMasterRealm: boolean, isManager: boolean) => [ , , ...(isMasterRealm && isManager ? [] : []), ]; export const Header = () => { const { environment, keycloak } = useEnvironment(); const { t } = useTranslation(); const { realm } = useRealm(); const { hasAccess } = useAccess(); const contextLogo = usePreviewLogo(); const customLogo = contextLogo?.logo; const isMasterRealm = realm === environment.masterRealm; const isManager = hasAccess("manage-realm"); const url = useHref(toDashboard({ realm })); const logoUrl = environment.logoUrl ? environment.logoUrl : url; return ( , ]} /> ); };