diff --git a/govtool/frontend/src/components/organisms/DashboardTopNav.tsx b/govtool/frontend/src/components/organisms/DashboardTopNav.tsx index ef0d91dd7..8c1d07ec0 100644 --- a/govtool/frontend/src/components/organisms/DashboardTopNav.tsx +++ b/govtool/frontend/src/components/organisms/DashboardTopNav.tsx @@ -10,7 +10,6 @@ import { } from "@hooks"; import { DashboardDrawerMobile, - useMaintenanceEndingBannerContext, } from "@organisms"; import { useCardano } from "@context"; @@ -31,8 +30,6 @@ export const DashboardTopNav = ({ const { isEnableLoading } = useCardano(); const { voter } = useGetVoterInfo(); const { dRepVotingPower } = useGetDRepVotingPowerQuery(voter); - const { height: maintenanceEndingBannerHeight } = - useMaintenanceEndingBannerContext(); const openDrawer = () => { setIsDrawerOpen(true); @@ -58,7 +55,7 @@ export const DashboardTopNav = ({ alignItems: "center", backdropFilter: "blur(10px)", backgroundColor: - windowScroll > POSITION_TO_BLUR + maintenanceEndingBannerHeight + windowScroll > POSITION_TO_BLUR ? "rgba(256, 256, 256, 0.7)" : isMobile ? "#FBFBFF59" @@ -70,7 +67,7 @@ export const DashboardTopNav = ({ minHeight: isMobile ? 36 : 48, px: isMobile ? 2 : 5, py: 3, - top: maintenanceEndingBannerHeight || 0, + top: 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 d54c729a0..abaaa1ca4 100644 --- a/govtool/frontend/src/components/organisms/Drawer.tsx +++ b/govtool/frontend/src/components/organisms/Drawer.tsx @@ -7,7 +7,6 @@ import { useFeatureFlag } from "@context"; import { useGetVoterInfo } from "@hooks"; import { WalletInfoCard, DRepInfoCard } from "@molecules"; import { openInNewTab } from "@utils"; -import { useMaintenanceEndingBannerContext } from "./MaintenanceEndingBanner"; export const Drawer = () => { const { @@ -15,8 +14,6 @@ export const Drawer = () => { isGovernanceOutcomesPillarEnabled, } = useFeatureFlag(); const { voter } = useGetVoterInfo(); - const { height: maintenanceEndingBannerHeight } = - useMaintenanceEndingBannerContext(); return ( { height: "100vh", position: "sticky", width: `${DRAWER_WIDTH}px`, - top: maintenanceEndingBannerHeight || 0, + top: 0, overflowY: "auto", - maxHeight: `calc(100vh - ${maintenanceEndingBannerHeight || 0}px)`, + maxHeight: `calc(100vh - ${0}px)`, }} > { - const { ref, isExpanded, toggleExpanded } = - useMaintenanceEndingBannerContext(); - const { t } = useTranslation(); - - return ( - - {/* Banner Header */} - - - - {t("system.maintenanceEnding.title")} - - - - - {isExpanded ? : } - - - - - {/* Expandable Content */} - - - - , - ]} - /> - - - , - ]} - /> - - - - - ); -}; diff --git a/govtool/frontend/src/components/organisms/MaintenanceEndingBanner/MaintenanceEndingBannerContext.tsx b/govtool/frontend/src/components/organisms/MaintenanceEndingBanner/MaintenanceEndingBannerContext.tsx deleted file mode 100644 index f57e25d8d..000000000 --- a/govtool/frontend/src/components/organisms/MaintenanceEndingBanner/MaintenanceEndingBannerContext.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import { - createContext, - createRef, - useContext, - useMemo, - useRef, - useState, - useLayoutEffect, - useEffect, -} from "react"; -import { - getItemFromLocalStorage, - MAINTENANCE_ENDING_BANNER_EXPANDED_KEY, - setItemToLocalStorage, -} from "@/utils"; - -interface MaintenanceEndingBannerContextType { - ref: React.RefObject; - height: number; - isExpanded: boolean; - toggleExpanded: () => void; -} - -const MaintenanceEndingBannerContext = - createContext({ - ref: createRef(), - height: 0, - isExpanded: true, - toggleExpanded: () => {}, - }); - -export const MaintenanceEndingBannerProvider = ({ - children, -}: React.PropsWithChildren) => { - const ref = useRef(null); - const [height, setHeight] = useState(0); - const [isExpanded, setIsExpanded] = useState(true); - - useEffect(() => { - const storedValue = getItemFromLocalStorage( - MAINTENANCE_ENDING_BANNER_EXPANDED_KEY, - ); - if (storedValue !== null) { - setIsExpanded(JSON.parse(storedValue)); - } - }, []); - - const toggleExpanded = () => { - setItemToLocalStorage(MAINTENANCE_ENDING_BANNER_EXPANDED_KEY, !isExpanded); - setIsExpanded((prev) => !prev); - }; - - useLayoutEffect(() => { - let frameId: number | null = null; - - const updatePosition = () => { - if (ref.current) { - const rect = ref.current.getBoundingClientRect(); - - setHeight(rect.height); - } - }; - - const throttledUpdate = () => { - // Context skipping update - frame already queued - if (frameId) return; - - frameId = requestAnimationFrame(() => { - updatePosition(); - frameId = null; - }); - }; - - updatePosition(); - - window.addEventListener("scroll", throttledUpdate, { passive: true }); - window.addEventListener("resize", throttledUpdate); - - return () => { - window.removeEventListener("scroll", throttledUpdate); - window.removeEventListener("resize", throttledUpdate); - - if (frameId) { - cancelAnimationFrame(frameId); - } - }; - }, []); - - const value = useMemo( - () => ({ - ref, - height, - isExpanded, - toggleExpanded, - }), - [ref, height, isExpanded, toggleExpanded], - ); - - return ( - - {children} - - ); -}; - -export const useMaintenanceEndingBannerContext = () => { - const context = useContext(MaintenanceEndingBannerContext); - if (!context) { - throw new Error( - "useMaintenanceEndingBannerContext must be used within a MaintenanceEndingBannerProvider", - ); - } - return context; -}; diff --git a/govtool/frontend/src/components/organisms/MaintenanceEndingBanner/index.ts b/govtool/frontend/src/components/organisms/MaintenanceEndingBanner/index.ts deleted file mode 100644 index e3253604a..000000000 --- a/govtool/frontend/src/components/organisms/MaintenanceEndingBanner/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./MaintenanceEndingBanner"; -export * from "./MaintenanceEndingBannerContext"; diff --git a/govtool/frontend/src/components/organisms/TopBanners.tsx b/govtool/frontend/src/components/organisms/TopBanners.tsx index ad4a878f8..75c0a2e46 100644 --- a/govtool/frontend/src/components/organisms/TopBanners.tsx +++ b/govtool/frontend/src/components/organisms/TopBanners.tsx @@ -3,7 +3,6 @@ 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 = ({ children }: PropsWithChildren) => { const { isMainnet, networkName, isInBootstrapPhase, isAppInitializing } = @@ -48,9 +47,6 @@ export const TopBanners = ({ children }: PropsWithChildren) => { )} - {/* GOVTOOL MAINTENANCE ENDING SOON BANNER */} - - {/* BOOTSTRAPPING BANNER */} {isInBootstrapPhase && ( diff --git a/govtool/frontend/src/components/organisms/TopNav.tsx b/govtool/frontend/src/components/organisms/TopNav.tsx index 533fe60d7..e9434fdbf 100644 --- a/govtool/frontend/src/components/organisms/TopNav.tsx +++ b/govtool/frontend/src/components/organisms/TopNav.tsx @@ -8,7 +8,6 @@ import { useCardano, useFeatureFlag, useModal } from "@context"; import { useScreenDimension, useTranslation } from "@hooks"; import { openInNewTab } from "@utils"; import { DrawerMobile } from "./DrawerMobile"; -import { useMaintenanceEndingBannerContext } from "./MaintenanceEndingBanner"; const POSITION_TO_BLUR = 80; @@ -25,9 +24,6 @@ export const TopNav = ({ isConnectButton = true }) => { const navigate = useNavigate(); const { t } = useTranslation(); - const { height: maintenanceEndingBannerHeight } = - useMaintenanceEndingBannerContext(); - useEffect(() => { const onScroll = () => { if (!containerRef.current?.nextElementSibling) return; @@ -141,7 +137,6 @@ export const TopNav = ({ isConnectButton = true }) => { ( - - {children} - + {children} diff --git a/govtool/frontend/src/i18n/locales/en.json b/govtool/frontend/src/i18n/locales/en.json index 4a5b42401..48a977b83 100644 --- a/govtool/frontend/src/i18n/locales/en.json +++ b/govtool/frontend/src/i18n/locales/en.json @@ -794,12 +794,7 @@ "system": { "description": "The Cardano GovTool is a tool that allows you to participate in the governance of the Cardano network. You can propose, vote on, and delegate your voting power to other users.", "title": "This tool is connected to {{networkName}}", - "bootstrappingWarning": "Govtool is in the Bootstrapping phase. Some features are not available. Learn more", - "maintenanceEnding": { - "title": "\uD83D\uDCA1 Next Step: Treasury Withdrawal based on your feedback has been submitted", - "description1": "<0>The Info Action has passed — thank you for your support!", - "description2": "We have now submitted a <0>Treasury Withdrawal that reflects the feedback gathered during the voting phase to ensure continued development and maintenance of GovTool as a community-owned governance interface on Cardano." - } + "bootstrappingWarning": "Govtool is in the Bootstrapping phase. Some features are not available. Learn more" }, "tooltips": { "delegateTodRep": {