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);
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen bg-gray-50">
|
||||
<div className="flex h-screen overflow-hidden bg-[#F8FAFC]">
|
||||
<Sidebar
|
||||
mobileOpen={mobileNavOpen}
|
||||
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)} />
|
||||
<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 />
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@@ -95,7 +95,7 @@ export function Sidebar({ mobileOpen, onClose }: SidebarProps = {}) {
|
||||
const asideContent = (
|
||||
<aside
|
||||
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 */}
|
||||
<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 (
|
||||
<>
|
||||
<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 */}
|
||||
{onMenuClick && (
|
||||
<button
|
||||
@@ -328,7 +328,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
||||
{assets.length > 0 && (
|
||||
<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">
|
||||
<Package className="h-3.5 w-3.5 text-[#1e3a8a]" />
|
||||
<Package className="h-3.5 w-3.5 text-[#2E5C9A]" />
|
||||
Assets ({assets.length})
|
||||
</div>
|
||||
{assets.map((asset) => (
|
||||
@@ -344,7 +344,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
||||
>
|
||||
<div className="min-w-0 flex-1">
|
||||
<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}
|
||||
</span>
|
||||
<span className="text-xs font-medium text-gray-900 truncate">
|
||||
@@ -432,7 +432,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
||||
type="button"
|
||||
disabled={savingDate || !dateInput}
|
||||
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
|
||||
</button>
|
||||
@@ -452,7 +452,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
||||
type="button"
|
||||
disabled={runningAlerts}
|
||||
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"
|
||||
>
|
||||
<Play className="h-3 w-3" />
|
||||
@@ -493,7 +493,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
||||
<button
|
||||
type="button"
|
||||
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" />
|
||||
Mark all read
|
||||
@@ -553,7 +553,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
||||
setBellOpen(false);
|
||||
navigate("/notifications");
|
||||
}}
|
||||
className="text-xs font-medium text-[#1e3a8a] hover:underline"
|
||||
className="text-xs font-medium text-[#2E5C9A] hover:underline"
|
||||
>
|
||||
View all notifications →
|
||||
</button>
|
||||
@@ -571,7 +571,7 @@ export function TopBar({ title, onMenuClick }: TopBarProps) {
|
||||
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"
|
||||
>
|
||||
<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" />
|
||||
</div>
|
||||
<div className="hidden sm:flex flex-col items-start leading-tight">
|
||||
|
||||
Reference in New Issue
Block a user