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:
parent
b72bbd59f4
commit
54df62fe04
2 changed files with 13 additions and 10 deletions
|
@ -7,16 +7,17 @@ import { Page } from "@patternfly/react-core";
|
||||||
import { PropsWithChildren, Suspense, useEffect, useState } from "react";
|
import { PropsWithChildren, Suspense, useEffect, useState } from "react";
|
||||||
import { Outlet } from "react-router-dom";
|
import { Outlet } from "react-router-dom";
|
||||||
|
|
||||||
|
import {
|
||||||
|
ErrorBoundaryFallback,
|
||||||
|
ErrorBoundaryProvider,
|
||||||
|
KeycloakSpinner,
|
||||||
|
} from "@keycloak/keycloak-ui-shared";
|
||||||
|
import { Banners } from "./Banners";
|
||||||
import { Header } from "./PageHeader";
|
import { Header } from "./PageHeader";
|
||||||
import { PageNav } from "./PageNav";
|
import { PageNav } from "./PageNav";
|
||||||
import { AdminClientContext, initAdminClient } from "./admin-client";
|
import { AdminClientContext, initAdminClient } from "./admin-client";
|
||||||
import { PageBreadCrumbs } from "./components/bread-crumb/PageBreadCrumbs";
|
import { PageBreadCrumbs } from "./components/bread-crumb/PageBreadCrumbs";
|
||||||
import { ErrorRenderer } from "./components/error/ErrorRenderer";
|
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 { RecentRealmsProvider } from "./context/RecentRealms";
|
||||||
import { AccessContextProvider } from "./context/access/Access";
|
import { AccessContextProvider } from "./context/access/Access";
|
||||||
import { RealmContextProvider } from "./context/realm-context/RealmContext";
|
import { RealmContextProvider } from "./context/realm-context/RealmContext";
|
||||||
|
@ -25,7 +26,6 @@ import { WhoAmIContextProvider } from "./context/whoami/WhoAmI";
|
||||||
import type { Environment } from "./environment";
|
import type { Environment } from "./environment";
|
||||||
import { SubGroups } from "./groups/SubGroupsContext";
|
import { SubGroups } from "./groups/SubGroupsContext";
|
||||||
import { AuthWall } from "./root/AuthWall";
|
import { AuthWall } from "./root/AuthWall";
|
||||||
import { Banners } from "./Banners";
|
|
||||||
|
|
||||||
const AppContexts = ({ children }: PropsWithChildren) => (
|
const AppContexts = ({ children }: PropsWithChildren) => (
|
||||||
<ErrorBoundaryProvider>
|
<ErrorBoundaryProvider>
|
||||||
|
@ -59,6 +59,7 @@ export const App = () => {
|
||||||
return (
|
return (
|
||||||
<AdminClientContext.Provider value={{ keycloak, adminClient }}>
|
<AdminClientContext.Provider value={{ keycloak, adminClient }}>
|
||||||
<AppContexts>
|
<AppContexts>
|
||||||
|
<Banners />
|
||||||
<Page
|
<Page
|
||||||
header={<Header />}
|
header={<Header />}
|
||||||
isManagedSidebar
|
isManagedSidebar
|
||||||
|
@ -66,7 +67,6 @@ export const App = () => {
|
||||||
breadcrumb={<PageBreadCrumbs />}
|
breadcrumb={<PageBreadCrumbs />}
|
||||||
mainContainerId={mainPageContentId}
|
mainContainerId={mainPageContentId}
|
||||||
>
|
>
|
||||||
<Banners />
|
|
||||||
<ErrorBoundaryFallback fallback={ErrorRenderer}>
|
<ErrorBoundaryFallback fallback={ErrorRenderer}>
|
||||||
<Suspense fallback={<KeycloakSpinner />}>
|
<Suspense fallback={<KeycloakSpinner />}>
|
||||||
<AuthWall>
|
<AuthWall>
|
||||||
|
|
|
@ -3,7 +3,11 @@ import { ExclamationTriangleIcon } from "@patternfly/react-icons";
|
||||||
import { useWhoAmI } from "./context/whoami/WhoAmI";
|
import { useWhoAmI } from "./context/whoami/WhoAmI";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const WarnBanner = (msg: string) => {
|
type WarnBannerProps = {
|
||||||
|
msg: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const WarnBanner = ({ msg }: WarnBannerProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -21,6 +25,5 @@ const WarnBanner = (msg: string) => {
|
||||||
export const Banners = () => {
|
export const Banners = () => {
|
||||||
const { whoAmI } = useWhoAmI();
|
const { whoAmI } = useWhoAmI();
|
||||||
|
|
||||||
if (whoAmI.isTemporary()) return WarnBanner("loggedInAsTempAdminUser");
|
if (whoAmI.isTemporary()) return <WarnBanner msg="loggedInAsTempAdminUser" />;
|
||||||
// more banners in the future?
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue