fix: Move PageHeader above SubmenuBar (correct hierarchy)

Fixed the layout hierarchy - PageHeader should be ABOVE submenu, not below.

Correct Information Architecture:
1. Page Title (Contextual Header) ← "Where am I?"
2. Submenu Tabs ← "What can I do here?"
3. Content ← "The actual data"

Changes Made:

1.  Desktop Fullscreen Layout
   Before: Submenu → PageHeader
   After: PageHeader → Submenu

2.  Mobile Fullscreen Layout
   Before: Submenu → PageHeader (inside main)
   After: PageHeader → Submenu (outside main)

3.  Non-Fullscreen Layout
   Before: TopNav → Submenu → PageHeader
   After: TopNav → PageHeader → Submenu

4.  Updated Z-Index
   Before: PageHeader z-10 (below submenu)
   After: PageHeader z-20 (same as submenu, but DOM order puts it on top)

Why This Order Makes Sense:
- User sees PAGE TITLE first ("Store Details")
- Then sees NAVIGATION OPTIONS (WooNooW, Store Details, Payments, Shipping)
- Then sees CONTENT (the actual form fields)

Visual Flow:
┌─────────────────────────────────┐
│ Store Details          [Save]   │ ← Contextual header (what page)
├─────────────────────────────────┤
│ WooNooW | Store Details | ...   │ ← Submenu (navigation)
├─────────────────────────────────┤
│ Store Identity                  │
│ Store name *                    │ ← Content
│ [My Wordpress Store]            │
└─────────────────────────────────┘

Before (Wrong):
User: "What are these tabs for?" (sees submenu first)
Then: "Oh, I'm on Store Details" (sees title after)

After (Correct):
User: "I'm on Store Details" (sees title first)
Then: "I can navigate to WooNooW, Payments, etc." (sees options)

Files Modified:
- App.tsx: Reordered PageHeader to be before SubmenuBar in all 3 layouts
- PageHeader.tsx: Updated z-index to z-20 (same as submenu)

Result: Proper information hierarchy! 
This commit is contained in:
dwindown
2025-11-06 22:37:20 +07:00
parent 0ab31e234d
commit a779f9a226
2 changed files with 6 additions and 6 deletions

View File

@@ -473,12 +473,12 @@ function Shell() {
<div className="flex flex-1 min-h-0"> <div className="flex flex-1 min-h-0">
<Sidebar /> <Sidebar />
<main className="flex-1 flex flex-col min-h-0 min-w-0"> <main className="flex-1 flex flex-col min-h-0 min-w-0">
<PageHeader fullscreen={true} />
{isDashboardRoute ? ( {isDashboardRoute ? (
<DashboardSubmenuBar items={main.children} fullscreen={true} /> <DashboardSubmenuBar items={main.children} fullscreen={true} />
) : ( ) : (
<SubmenuBar items={main.children} fullscreen={true} /> <SubmenuBar items={main.children} fullscreen={true} />
)} )}
<PageHeader fullscreen={true} />
<div className="flex-1 overflow-auto p-4 min-w-0"> <div className="flex-1 overflow-auto p-4 min-w-0">
<AppRoutes /> <AppRoutes />
</div> </div>
@@ -486,13 +486,13 @@ function Shell() {
</div> </div>
) : ( ) : (
<div className={`flex flex-1 flex-col min-h-0 ${fullscreen ? 'pt-0' : 'pt-16'}`}> <div className={`flex flex-1 flex-col min-h-0 ${fullscreen ? 'pt-0' : 'pt-16'}`}>
<PageHeader fullscreen={true} />
{!isMorePage && (isDashboardRoute ? ( {!isMorePage && (isDashboardRoute ? (
<DashboardSubmenuBar items={main.children} fullscreen={true} headerVisible={isHeaderVisible} /> <DashboardSubmenuBar items={main.children} fullscreen={true} headerVisible={isHeaderVisible} />
) : ( ) : (
<SubmenuBar items={main.children} fullscreen={true} headerVisible={isHeaderVisible} /> <SubmenuBar items={main.children} fullscreen={true} headerVisible={isHeaderVisible} />
))} ))}
<main className="flex-1 flex flex-col min-h-0 min-w-0 pb-14"> <main className="flex-1 flex flex-col min-h-0 min-w-0 pb-14">
<PageHeader fullscreen={true} />
<div ref={scrollContainerRef} className="flex-1 overflow-auto p-4 min-w-0"> <div ref={scrollContainerRef} className="flex-1 overflow-auto p-4 min-w-0">
<AppRoutes /> <AppRoutes />
</div> </div>
@@ -504,12 +504,12 @@ function Shell() {
) : ( ) : (
<div className="flex flex-1 flex-col min-h-0"> <div className="flex flex-1 flex-col min-h-0">
<TopNav /> <TopNav />
<PageHeader fullscreen={false} />
{isDashboardRoute ? ( {isDashboardRoute ? (
<DashboardSubmenuBar items={main.children} fullscreen={false} /> <DashboardSubmenuBar items={main.children} fullscreen={false} />
) : ( ) : (
<SubmenuBar items={main.children} fullscreen={false} /> <SubmenuBar items={main.children} fullscreen={false} />
)} )}
<PageHeader fullscreen={false} />
<main className="flex-1 flex flex-col min-h-0 min-w-0"> <main className="flex-1 flex flex-col min-h-0 min-w-0">
<div className="flex-1 overflow-auto p-4 min-w-0"> <div className="flex-1 overflow-auto p-4 min-w-0">
<AppRoutes /> <AppRoutes />

View File

@@ -10,10 +10,10 @@ export function PageHeader({ fullscreen = false }: PageHeaderProps) {
if (!title) return null; if (!title) return null;
// PageHeader sticks at top-0 and naturally stacks below submenu (which has z-20) // PageHeader is now ABOVE submenu in DOM order
// Our z-10 ensures we're below the submenu in stacking order // z-20 ensures it stays on top when both are sticky
return ( return (
<div className="sticky top-0 z-10 border-b bg-background"> <div className="sticky top-0 z-20 border-b bg-background">
<div className="w-full max-w-5xl mx-auto px-4 py-3 flex items-center justify-between min-w-0"> <div className="w-full max-w-5xl mx-auto px-4 py-3 flex items-center justify-between min-w-0">
<div className="min-w-0 flex-1"> <div className="min-w-0 flex-1">
<h1 className="text-lg font-semibold truncate">{title}</h1> <h1 className="text-lg font-semibold truncate">{title}</h1>