fix(layout): lock sidebar and topbar as fixed in viewport with independent scrollable main content
This commit is contained in:
@@ -8,14 +8,14 @@ export function AppShell() {
|
|||||||
const [mobileNavOpen, setMobileNavOpen] = useState(false);
|
const [mobileNavOpen, setMobileNavOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-screen bg-gray-50">
|
<div className="flex h-screen overflow-hidden bg-[#F8FAFC]">
|
||||||
<Sidebar
|
<Sidebar
|
||||||
mobileOpen={mobileNavOpen}
|
mobileOpen={mobileNavOpen}
|
||||||
onClose={() => setMobileNavOpen(false)}
|
onClose={() => setMobileNavOpen(false)}
|
||||||
/>
|
/>
|
||||||
<div className="flex-1 flex flex-col min-w-0">
|
<div className="flex-1 flex flex-col min-w-0 h-screen overflow-hidden">
|
||||||
<TopBar onMenuClick={() => setMobileNavOpen(true)} />
|
<TopBar onMenuClick={() => setMobileNavOpen(true)} />
|
||||||
<main className="flex-1 p-3 sm:p-4 lg:p-6 overflow-auto">
|
<main className="flex-1 overflow-y-auto p-3 sm:p-4 lg:p-6 focus:outline-none">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export function Sidebar({ mobileOpen, onClose }: SidebarProps = {}) {
|
|||||||
const asideContent = (
|
const asideContent = (
|
||||||
<aside
|
<aside
|
||||||
aria-label="Primary Navigation"
|
aria-label="Primary Navigation"
|
||||||
className="w-56 lg:w-64 shrink-0 min-h-screen bg-[#102C52] text-white flex flex-col"
|
className="w-56 lg:w-64 shrink-0 h-screen bg-[#102C52] text-white flex flex-col sticky top-0"
|
||||||
>
|
>
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<div className="px-4 py-4 border-b border-[#2E5C9A]/40 space-y-2 relative">
|
<div className="px-4 py-4 border-b border-[#2E5C9A]/40 space-y-2 relative">
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<header className="min-h-14 bg-white border-b border-gray-200 flex items-center flex-wrap px-3 sm:px-4 py-2 gap-2 sm:gap-3 sticky top-0 z-10">
|
<header className="shrink-0 min-h-14 bg-white/95 backdrop-blur-sm border-b border-[#E8EFF7] flex items-center flex-wrap px-3 sm:px-4 py-2 gap-2 sm:gap-3 sticky top-0 z-20 shadow-xs">
|
||||||
{/* Mobile/tablet nav toggle */}
|
{/* Mobile/tablet nav toggle */}
|
||||||
{onMenuClick && (
|
{onMenuClick && (
|
||||||
<button
|
<button
|
||||||
@@ -328,7 +328,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
|||||||
{assets.length > 0 && (
|
{assets.length > 0 && (
|
||||||
<div className="py-1.5">
|
<div className="py-1.5">
|
||||||
<div className="px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-gray-500 flex items-center gap-1.5">
|
<div className="px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-gray-500 flex items-center gap-1.5">
|
||||||
<Package className="h-3.5 w-3.5 text-[#1e3a8a]" />
|
<Package className="h-3.5 w-3.5 text-[#2E5C9A]" />
|
||||||
Assets ({assets.length})
|
Assets ({assets.length})
|
||||||
</div>
|
</div>
|
||||||
{assets.map((asset) => (
|
{assets.map((asset) => (
|
||||||
@@ -344,7 +344,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
|||||||
>
|
>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="font-mono text-xs font-semibold text-[#1e3a8a]">
|
<span className="font-mono text-xs font-semibold text-[#2E5C9A]">
|
||||||
{asset.asset_code}
|
{asset.asset_code}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-xs font-medium text-gray-900 truncate">
|
<span className="text-xs font-medium text-gray-900 truncate">
|
||||||
@@ -432,7 +432,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
|||||||
type="button"
|
type="button"
|
||||||
disabled={savingDate || !dateInput}
|
disabled={savingDate || !dateInput}
|
||||||
onClick={() => handleDemoDateUpdate(dateInput || null)}
|
onClick={() => handleDemoDateUpdate(dateInput || null)}
|
||||||
className="px-2 py-0.5 rounded bg-[#1e3a8a] text-white hover:bg-[#1e3480] disabled:opacity-40"
|
className="px-2 py-0.5 rounded bg-[#2E5C9A] text-white hover:bg-[#102C52] disabled:opacity-40"
|
||||||
>
|
>
|
||||||
Apply
|
Apply
|
||||||
</button>
|
</button>
|
||||||
@@ -452,7 +452,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
|||||||
type="button"
|
type="button"
|
||||||
disabled={runningAlerts}
|
disabled={runningAlerts}
|
||||||
onClick={handleRunAlertsNow}
|
onClick={handleRunAlertsNow}
|
||||||
className="inline-flex items-center gap-1 px-2 py-0.5 rounded border border-blue-300 bg-blue-50 text-[#1e3a8a] hover:bg-blue-100 disabled:opacity-40 font-medium"
|
className="inline-flex items-center gap-1 px-2 py-0.5 rounded border border-[#2E5C9A]/30 bg-[#E8EFF7] text-[#102C52] hover:bg-[#E8EFF7]/80 disabled:opacity-40 font-medium"
|
||||||
title="Run alert engine immediately for current effective date"
|
title="Run alert engine immediately for current effective date"
|
||||||
>
|
>
|
||||||
<Play className="h-3 w-3" />
|
<Play className="h-3 w-3" />
|
||||||
@@ -493,7 +493,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => markAllReadMutation.mutate()}
|
onClick={() => markAllReadMutation.mutate()}
|
||||||
className="inline-flex items-center gap-1 text-[11px] font-medium text-[#1e3a8a] hover:underline"
|
className="inline-flex items-center gap-1 text-[11px] font-medium text-[#2E5C9A] hover:underline"
|
||||||
>
|
>
|
||||||
<CheckCheck className="h-3.5 w-3.5" />
|
<CheckCheck className="h-3.5 w-3.5" />
|
||||||
Mark all read
|
Mark all read
|
||||||
@@ -553,7 +553,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
|||||||
setBellOpen(false);
|
setBellOpen(false);
|
||||||
navigate("/notifications");
|
navigate("/notifications");
|
||||||
}}
|
}}
|
||||||
className="text-xs font-medium text-[#1e3a8a] hover:underline"
|
className="text-xs font-medium text-[#2E5C9A] hover:underline"
|
||||||
>
|
>
|
||||||
View all notifications →
|
View all notifications →
|
||||||
</button>
|
</button>
|
||||||
@@ -571,7 +571,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
|||||||
aria-expanded={menuOpen}
|
aria-expanded={menuOpen}
|
||||||
className="flex items-center gap-2 px-2.5 py-1.5 rounded-md hover:bg-gray-100 text-sm text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500"
|
className="flex items-center gap-2 px-2.5 py-1.5 rounded-md hover:bg-gray-100 text-sm text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500"
|
||||||
>
|
>
|
||||||
<div className="h-7 w-7 rounded-full bg-[#1e3a8a] flex items-center justify-center text-white text-xs font-bold shrink-0">
|
<div className="h-7 w-7 rounded-full bg-[#102C52] flex items-center justify-center text-white text-xs font-bold shrink-0">
|
||||||
<User className="h-4 w-4" />
|
<User className="h-4 w-4" />
|
||||||
</div>
|
</div>
|
||||||
<div className="hidden sm:flex flex-col items-start leading-tight">
|
<div className="hidden sm:flex flex-col items-start leading-tight">
|
||||||
|
|||||||
Reference in New Issue
Block a user