From ea68d940d940b0d9df9702905013072f69d05206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Thu, 29 May 2025 12:12:40 +0200 Subject: [PATCH] fix: overlapping banners over app content --- govtool/frontend/src/App.tsx | 5 ++--- .../components/organisms/DashboardTopNav.tsx | 11 ++++++++--- .../src/components/organisms/Drawer.tsx | 5 ++--- .../MaintenanceEndingBanner.tsx | 3 +++ .../src/components/organisms/TopBanners.tsx | 19 ++++++------------- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/govtool/frontend/src/App.tsx b/govtool/frontend/src/App.tsx index 3ef7a5c0a..c4903b4d8 100644 --- a/govtool/frontend/src/App.tsx +++ b/govtool/frontend/src/App.tsx @@ -93,9 +93,8 @@ export default () => { }, [checkTheWalletIsActive]); return ( - <> + - } /> } /> @@ -226,6 +225,6 @@ export default () => { {modals[modal.type].component!} )} - + ); }; diff --git a/govtool/frontend/src/components/organisms/DashboardTopNav.tsx b/govtool/frontend/src/components/organisms/DashboardTopNav.tsx index 45d51d8d3..ef0d91dd7 100644 --- a/govtool/frontend/src/components/organisms/DashboardTopNav.tsx +++ b/govtool/frontend/src/components/organisms/DashboardTopNav.tsx @@ -8,7 +8,10 @@ import { useGetVoterInfo, useScreenDimension, } from "@hooks"; -import { DashboardDrawerMobile } from "@organisms"; +import { + DashboardDrawerMobile, + useMaintenanceEndingBannerContext, +} from "@organisms"; import { useCardano } from "@context"; type DashboardTopNavProps = { @@ -28,6 +31,8 @@ export const DashboardTopNav = ({ const { isEnableLoading } = useCardano(); const { voter } = useGetVoterInfo(); const { dRepVotingPower } = useGetDRepVotingPowerQuery(voter); + const { height: maintenanceEndingBannerHeight } = + useMaintenanceEndingBannerContext(); const openDrawer = () => { setIsDrawerOpen(true); @@ -53,7 +58,7 @@ export const DashboardTopNav = ({ alignItems: "center", backdropFilter: "blur(10px)", backgroundColor: - windowScroll > POSITION_TO_BLUR + windowScroll > POSITION_TO_BLUR + maintenanceEndingBannerHeight ? "rgba(256, 256, 256, 0.7)" : isMobile ? "#FBFBFF59" @@ -65,7 +70,7 @@ export const DashboardTopNav = ({ minHeight: isMobile ? 36 : 48, px: isMobile ? 2 : 5, py: 3, - top: 0, + top: maintenanceEndingBannerHeight || 0, width: "fill-available", zIndex: 100, }} diff --git a/govtool/frontend/src/components/organisms/Drawer.tsx b/govtool/frontend/src/components/organisms/Drawer.tsx index 5797acc7b..d54c729a0 100644 --- a/govtool/frontend/src/components/organisms/Drawer.tsx +++ b/govtool/frontend/src/components/organisms/Drawer.tsx @@ -26,11 +26,10 @@ export const Drawer = () => { flexDirection: "column", height: "100vh", position: "sticky", - top: maintenanceEndingBannerHeight, width: `${DRAWER_WIDTH}px`, - + top: maintenanceEndingBannerHeight || 0, overflowY: "auto", - maxHeight: "100vh", + maxHeight: `calc(100vh - ${maintenanceEndingBannerHeight || 0}px)`, }} > { width: "100%", overflow: "hidden", transition: "all 0.3s ease-in-out", + position: "sticky", + top: 0, + zIndex: 1200, }} > {/* Banner Header */} diff --git a/govtool/frontend/src/components/organisms/TopBanners.tsx b/govtool/frontend/src/components/organisms/TopBanners.tsx index df04c01db..ad4a878f8 100644 --- a/govtool/frontend/src/components/organisms/TopBanners.tsx +++ b/govtool/frontend/src/components/organisms/TopBanners.tsx @@ -1,10 +1,11 @@ +import { PropsWithChildren } from "react"; import { Box, Link, Typography } from "@mui/material"; import { Trans, useTranslation } from "react-i18next"; import { useAppContext } from "@/context"; import { LINKS } from "@/consts/links"; import { MaintenanceEndingBanner } from "./MaintenanceEndingBanner"; -export const TopBanners = () => { +export const TopBanners = ({ children }: PropsWithChildren) => { const { isMainnet, networkName, isInBootstrapPhase, isAppInitializing } = useAppContext(); const { t } = useTranslation(); @@ -14,7 +15,7 @@ export const TopBanners = () => { } return ( - <> + {/* NETWORK BANNER */} {!isMainnet && ( @@ -48,16 +49,7 @@ export const TopBanners = () => { {/* GOVTOOL MAINTENANCE ENDING SOON BANNER */} - - - + {/* BOOTSTRAPPING BANNER */} @@ -89,6 +81,7 @@ export const TopBanners = () => { )} - + {children} + ); };