From 94c8e73787ac40b73808785a5e12074bd1840bd9 Mon Sep 17 00:00:00 2001 From: Fringg Date: Fri, 20 Mar 2026 05:02:47 +0300 Subject: [PATCH] fix: bottom nav overlap and safe area handling in referral network - Raise portal z-index to z-50 so it covers MobileBottomNav - Use TG SDK bottom safe area (JS) via CSS variable instead of unreliable env() - Fix TicketNotificationBell regression: conditional inline style for fullscreen only - Add bottom safe area padding to detail panel scroll areas --- src/components/TicketNotificationBell.tsx | 4 ++-- src/hooks/useHeaderHeight.ts | 14 ++++++++++++-- src/pages/ReferralNetwork/ReferralNetwork.tsx | 17 +++++++++++------ .../components/CampaignDetailPanel.tsx | 2 +- .../components/UserDetailPanel.tsx | 2 +- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/components/TicketNotificationBell.tsx b/src/components/TicketNotificationBell.tsx index e840bc9..88ef9b4 100644 --- a/src/components/TicketNotificationBell.tsx +++ b/src/components/TicketNotificationBell.tsx @@ -37,7 +37,7 @@ export default function TicketNotificationBell({ isAdmin = false }: TicketNotifi const { showToast } = useToast(); const [isOpen, setIsOpen] = useState(false); const dropdownRef = useRef(null); - const { mobile: dropdownTop } = useHeaderHeight(); + const { mobile: dropdownTop, isMobileFullscreen } = useHeaderHeight(); // Show toast for WebSocket notification const showWSNotificationToast = useCallback( @@ -255,7 +255,7 @@ export default function TicketNotificationBell({ isAdmin = false }: TicketNotifi {isOpen && (
{/* Header */}
diff --git a/src/hooks/useHeaderHeight.ts b/src/hooks/useHeaderHeight.ts index 8b1b0d6..f9719f3 100644 --- a/src/hooks/useHeaderHeight.ts +++ b/src/hooks/useHeaderHeight.ts @@ -6,8 +6,14 @@ import { UI } from '@/config/constants'; * Telegram MiniApp safe area insets in fullscreen mode. * * Desktop: 56px (h-14). Mobile: 64px (h-16) + safe area + TG header when fullscreen. + * bottomSafeArea: TG SDK bottom inset (home indicator etc.), 0 outside TG. */ -export function useHeaderHeight(): { mobile: number; desktop: number } { +export function useHeaderHeight(): { + mobile: number; + desktop: number; + bottomSafeArea: number; + isMobileFullscreen: boolean; +} { const { isFullscreen, safeAreaInset, contentSafeAreaInset, platform, isMobile } = useTelegramSDK(); const isMobileFullscreen = isFullscreen && isMobile; @@ -21,5 +27,9 @@ export function useHeaderHeight(): { mobile: number; desktop: number } { telegramHeaderHeight : UI.MOBILE_HEADER_HEIGHT_PX; - return { mobile, desktop: UI.DESKTOP_HEADER_HEIGHT_PX }; + const bottomSafeArea = isMobileFullscreen + ? Math.max(safeAreaInset.bottom, contentSafeAreaInset.bottom) + : 0; + + return { mobile, desktop: UI.DESKTOP_HEADER_HEIGHT_PX, bottomSafeArea, isMobileFullscreen }; } diff --git a/src/pages/ReferralNetwork/ReferralNetwork.tsx b/src/pages/ReferralNetwork/ReferralNetwork.tsx index 5fbe7dc..21ed65f 100644 --- a/src/pages/ReferralNetwork/ReferralNetwork.tsx +++ b/src/pages/ReferralNetwork/ReferralNetwork.tsx @@ -21,7 +21,7 @@ export function ReferralNetwork() { const removeScope = useReferralNetworkStore((s) => s.removeScope); const clearScope = useReferralNetworkStore((s) => s.clearScope); - const { mobile: mobileHeaderHeight } = useHeaderHeight(); + const { mobile: mobileHeaderHeight, bottomSafeArea } = useHeaderHeight(); const hasScope = scope.length > 0; @@ -41,8 +41,13 @@ export function ReferralNetwork() { return createPortal(
{/* Mobile: two rows — title on top, selector below */} @@ -122,15 +127,15 @@ export function ReferralNetwork() { <> -
+
-
+
-
+
diff --git a/src/pages/ReferralNetwork/components/CampaignDetailPanel.tsx b/src/pages/ReferralNetwork/components/CampaignDetailPanel.tsx index 6ac5327..84c1ac6 100644 --- a/src/pages/ReferralNetwork/components/CampaignDetailPanel.tsx +++ b/src/pages/ReferralNetwork/components/CampaignDetailPanel.tsx @@ -50,7 +50,7 @@ export function CampaignDetailPanel({ campaignId, className }: CampaignDetailPan
{/* Content */} -
+
{isLoading && (
diff --git a/src/pages/ReferralNetwork/components/UserDetailPanel.tsx b/src/pages/ReferralNetwork/components/UserDetailPanel.tsx index 3ec117f..653a4ed 100644 --- a/src/pages/ReferralNetwork/components/UserDetailPanel.tsx +++ b/src/pages/ReferralNetwork/components/UserDetailPanel.tsx @@ -50,7 +50,7 @@ export function UserDetailPanel({ userId, className }: UserDetailPanelProps) {
{/* Content */} -
+
{isLoading && (