moved banner to top of the screen (#32765)

fixes: #32468

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-09-10 14:27:52 +02:00 committed by GitHub
parent b72bbd59f4
commit 54df62fe04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 10 deletions

View file

@ -7,16 +7,17 @@ import { Page } from "@patternfly/react-core";
import { PropsWithChildren, Suspense, useEffect, useState } from "react";
import { Outlet } from "react-router-dom";
import {
ErrorBoundaryFallback,
ErrorBoundaryProvider,
KeycloakSpinner,
} from "@keycloak/keycloak-ui-shared";
import { Banners } from "./Banners";
import { Header } from "./PageHeader";
import { PageNav } from "./PageNav";
import { AdminClientContext, initAdminClient } from "./admin-client";
import { PageBreadCrumbs } from "./components/bread-crumb/PageBreadCrumbs";
import { ErrorRenderer } from "./components/error/ErrorRenderer";
import { KeycloakSpinner } from "@keycloak/keycloak-ui-shared";
import {
ErrorBoundaryFallback,
ErrorBoundaryProvider,
} from "@keycloak/keycloak-ui-shared";
import { RecentRealmsProvider } from "./context/RecentRealms";
import { AccessContextProvider } from "./context/access/Access";
import { RealmContextProvider } from "./context/realm-context/RealmContext";
@ -25,7 +26,6 @@ import { WhoAmIContextProvider } from "./context/whoami/WhoAmI";
import type { Environment } from "./environment";
import { SubGroups } from "./groups/SubGroupsContext";
import { AuthWall } from "./root/AuthWall";
import { Banners } from "./Banners";
const AppContexts = ({ children }: PropsWithChildren) => (
<ErrorBoundaryProvider>
@ -59,6 +59,7 @@ export const App = () => {
return (
<AdminClientContext.Provider value={{ keycloak, adminClient }}>
<AppContexts>
<Banners />
<Page
header={<Header />}
isManagedSidebar
@ -66,7 +67,6 @@ export const App = () => {
breadcrumb={<PageBreadCrumbs />}
mainContainerId={mainPageContentId}
>
<Banners />
<ErrorBoundaryFallback fallback={ErrorRenderer}>
<Suspense fallback={<KeycloakSpinner />}>
<AuthWall>

View file

@ -3,7 +3,11 @@ import { ExclamationTriangleIcon } from "@patternfly/react-icons";
import { useWhoAmI } from "./context/whoami/WhoAmI";
import { useTranslation } from "react-i18next";
const WarnBanner = (msg: string) => {
type WarnBannerProps = {
msg: string;
};
const WarnBanner = ({ msg }: WarnBannerProps) => {
const { t } = useTranslation();
return (
@ -21,6 +25,5 @@ const WarnBanner = (msg: string) => {
export const Banners = () => {
const { whoAmI } = useWhoAmI();
if (whoAmI.isTemporary()) return WarnBanner("loggedInAsTempAdminUser");
// more banners in the future?
if (whoAmI.isTemporary()) return <WarnBanner msg="loggedInAsTempAdminUser" />;
};