Files
WooNooW/admin-spa
dwindown b93a873765 fix: Finally fix top-16 gap and add dashboard redirect on exit
The Real Problem:
After removing contextual headers, SubmenuBar still used headerVisible
logic to calculate top position. This caused the persistent top-16 gap
because it thought a header existed when it did not.

Root Cause Analysis:
1. We removed contextual headers from Dashboard pages ✓
2. But SubmenuBar still had: top-16 when headerVisible=true
3. Header was being tracked but did not exist
4. Result: 64px gap at top (top-16 = 4rem = 64px)

The Solution:
Since we removed ALL contextual headers, submenu should ALWAYS be at
top-0 in fullscreen mode. No conditional logic needed.

Changes Made:

1. SubmenuBar.tsx
   Before:
   const topClass = fullscreen
     ? (headerVisible ? "top-16" : "top-0")  ← Wrong!
     : "top-[calc(7rem+32px)]";

   After:
   const topClass = fullscreen
     ? "top-0"  ← Always top-0, no header exists!
     : "top-[calc(7rem+32px)]";

2. DashboardSubmenuBar.tsx
   Same fix as SubmenuBar

3. App.tsx
   - Removed headerVisible prop from submenu components
   - Removed isHeaderVisible state (no longer needed)
   - Removed onVisibilityChange from Header (no longer tracking)
   - Cleaned up unused scroll detection logic

4. More/index.tsx
   - Added handleExitFullscreen function
   - Exits fullscreen + navigates to dashboard (/)
   - User requested: "redirect member to dashboard overview"

Why This Was Hard:
The issue was not the padding itself, but the LOGIC that calculated it.
We had multiple layers of conditional logic (fullscreen, headerVisible,
standalone) that became inconsistent after removing contextual headers.

The fix required understanding the entire flow:
- No contextual headers → No header exists
- No header → No need to offset submenu
- Submenu always at top-0 in fullscreen

Result:
 No top gap - submenu starts at top-0
 Exit fullscreen redirects to dashboard
 Simplified logic - removed unnecessary tracking
 Clean, predictable behavior

Files Modified:
- SubmenuBar.tsx
- DashboardSubmenuBar.tsx
- App.tsx
- More/index.tsx

The top-16 nightmare is finally over! 🎯
2025-11-06 23:31:07 +07:00
..