Spaces:
Running
Running
axeronis commited on
Commit ·
48e3948
1
Parent(s): 34d95a0
fix(ui): implement infinity mobile layout with viewport-fit=cover and borderless navigation
Browse files- frontend/app/globals.css +3 -23
- frontend/app/layout.tsx +14 -106
- frontend/components/ChatWindow/ChatHeader.tsx +2 -2
- frontend/components/ChatWindow/MessageInput.tsx +4 -4
- frontend/components/MobileBottomNav.tsx +16 -13
- frontend/components/MobileNav.tsx +18 -7
- frontend/components/layout/LayoutClient.tsx +111 -0
frontend/app/globals.css
CHANGED
|
@@ -163,9 +163,9 @@ html {
|
|
| 163 |
--md-sys-elevation-4: 0px 2px 3px 0px rgba(0, 0, 0, 0.3), 0px 6px 10px 4px rgba(0, 0, 0, 0.15);
|
| 164 |
--md-sys-elevation-5: 0px 4px 4px 0px rgba(0, 0, 0, 0.3), 0px 8px 12px 6px rgba(0, 0, 0, 0.15);
|
| 165 |
|
| 166 |
-
/* Mobile Layout Constants
|
| 167 |
-
--header-height-mobile: calc(
|
| 168 |
-
--footer-height-mobile: calc(
|
| 169 |
|
| 170 |
@media (min-width: 768px) {
|
| 171 |
--header-height-mobile: 0px;
|
|
@@ -173,26 +173,6 @@ html {
|
|
| 173 |
}
|
| 174 |
}
|
| 175 |
|
| 176 |
-
.glass-nav {
|
| 177 |
-
background: rgba(13, 14, 24, 0.4);
|
| 178 |
-
backdrop-filter: blur(24px) saturate(180%);
|
| 179 |
-
-webkit-backdrop-filter: blur(24px) saturate(180%);
|
| 180 |
-
border: 0px solid transparent;
|
| 181 |
-
}
|
| 182 |
-
|
| 183 |
-
.glass-nav-header {
|
| 184 |
-
border-bottom: 1px solid rgba(255, 255, 255, 0.03);
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
.glass-nav-footer {
|
| 188 |
-
border-top: 1px solid rgba(255, 255, 255, 0.03);
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
-
.backdrop-blur-3xl {
|
| 192 |
-
backdrop-filter: blur(64px);
|
| 193 |
-
-webkit-backdrop-filter: blur(64px);
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
body {
|
| 197 |
background-color: var(--background);
|
| 198 |
background-image:
|
|
|
|
| 163 |
--md-sys-elevation-4: 0px 2px 3px 0px rgba(0, 0, 0, 0.3), 0px 6px 10px 4px rgba(0, 0, 0, 0.15);
|
| 164 |
--md-sys-elevation-5: 0px 4px 4px 0px rgba(0, 0, 0, 0.3), 0px 8px 12px 6px rgba(0, 0, 0, 0.15);
|
| 165 |
|
| 166 |
+
/* Mobile Layout Constants */
|
| 167 |
+
--header-height-mobile: calc(52px + env(safe-area-inset-top, 0px));
|
| 168 |
+
--footer-height-mobile: calc(50px + env(safe-area-inset-bottom, 0px));
|
| 169 |
|
| 170 |
@media (min-width: 768px) {
|
| 171 |
--header-height-mobile: 0px;
|
|
|
|
| 173 |
}
|
| 174 |
}
|
| 175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
body {
|
| 177 |
background-color: var(--background);
|
| 178 |
background-image:
|
frontend/app/layout.tsx
CHANGED
|
@@ -1,48 +1,22 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
import type { Metadata } from 'next'
|
| 4 |
import { Inter } from 'next/font/google'
|
| 5 |
import './globals.css'
|
| 6 |
-
import {
|
| 7 |
-
import { Sidebar } from '@/components/Sidebar'
|
| 8 |
-
import { Header } from '@/components/Header'
|
| 9 |
-
import { usePathname } from 'next/navigation'
|
| 10 |
-
|
| 11 |
-
import { useAuth } from '@/contexts/AuthContext'
|
| 12 |
-
import { cn } from '@/lib/utils'
|
| 13 |
-
import { useEffect } from 'react'
|
| 14 |
-
import { useRouter } from 'next/navigation'
|
| 15 |
-
import { MobileHeader, MobileSidebarWrapper } from '@/components/MobileNav'
|
| 16 |
-
import { MobileBottomNav } from '@/components/MobileBottomNav'
|
| 17 |
-
import { SecondaryNav } from '@/components/SecondaryNav'
|
| 18 |
|
| 19 |
const inter = Inter({ subsets: ['latin', 'cyrillic'] })
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
useEffect(() => {
|
| 26 |
-
// Only redirect if definitely not authenticated (not loading and no user)
|
| 27 |
-
if (!isLoading && !user) {
|
| 28 |
-
router.push('/login')
|
| 29 |
-
}
|
| 30 |
-
}, [isLoading, user, router])
|
| 31 |
-
|
| 32 |
-
// OPTIMIZATION: If we have user (from cache), render immediately
|
| 33 |
-
// Only show loading if no user AND still loading (first visit / cache miss)
|
| 34 |
-
if (!user && isLoading) {
|
| 35 |
-
return (
|
| 36 |
-
<div className="flex h-screen items-center justify-center bg-background">
|
| 37 |
-
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"></div>
|
| 38 |
-
</div>
|
| 39 |
-
)
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
// If user exists (cached or fresh), render children immediately
|
| 43 |
-
if (!user) return null
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
}
|
| 47 |
|
| 48 |
export default function RootLayout({
|
|
@@ -50,76 +24,10 @@ export default function RootLayout({
|
|
| 50 |
}: {
|
| 51 |
children: React.ReactNode
|
| 52 |
}) {
|
| 53 |
-
const pathname = usePathname()
|
| 54 |
-
|
| 55 |
-
// Pages without sidebar (public pages)
|
| 56 |
-
const publicPages = ['/', '/login', '/register', '/verify-email', '/forgot-password', '/terms', '/privacy', '/refund', '/pricing']
|
| 57 |
-
const isPublicPage = publicPages.includes(pathname)
|
| 58 |
-
|
| 59 |
return (
|
| 60 |
<html lang="ru">
|
| 61 |
<body className={inter.className}>
|
| 62 |
-
<
|
| 63 |
-
{/* Global Background Atmosphere - Synced with Landing */}
|
| 64 |
-
<div className="fixed inset-0 z-0 pointer-events-none overflow-hidden bg-[#050510]">
|
| 65 |
-
<div className="absolute top-[-10%] right-[-5%] w-[60%] h-[60%] bg-gradient-to-b from-cyan-500/10 via-emerald-500/5 to-transparent blur-[120px] rounded-full" />
|
| 66 |
-
<div className="absolute bottom-[-10%] left-[-10%] w-[60%] h-[60%] bg-gradient-to-t from-indigo-600/10 via-purple-600/5 to-transparent blur-[120px] rounded-full" />
|
| 67 |
-
</div>
|
| 68 |
-
|
| 69 |
-
{isPublicPage ? (
|
| 70 |
-
// Public layout (no sidebar)
|
| 71 |
-
<div className="relative z-10">{children}</div>
|
| 72 |
-
) : (
|
| 73 |
-
// App layout (with sidebar)
|
| 74 |
-
<ProtectedLayout>
|
| 75 |
-
<div className="flex h-[100dvh] relative text-white">
|
| 76 |
-
{/* Desktop Sidebar */}
|
| 77 |
-
<div className="hidden lg:flex h-full relative z-20 w-72 shrink-0">
|
| 78 |
-
<Sidebar />
|
| 79 |
-
</div>
|
| 80 |
-
|
| 81 |
-
{/* Mobile Sidebar (Drawer - opens from menu button) */}
|
| 82 |
-
<MobileSidebarWrapper>
|
| 83 |
-
<Sidebar />
|
| 84 |
-
</MobileSidebarWrapper>
|
| 85 |
-
|
| 86 |
-
{/* Main Content Area Container */}
|
| 87 |
-
<div className="flex-1 flex flex-col h-full min-w-0 overflow-hidden">
|
| 88 |
-
{/* Desktop Header */}
|
| 89 |
-
<Header />
|
| 90 |
-
|
| 91 |
-
{/* Secondary Nav - Tablet/Small Desktop Only (Full Sidebar Content) */}
|
| 92 |
-
<SecondaryNav />
|
| 93 |
-
|
| 94 |
-
{/* Mobile Header - FIXED at top - ONLY for Mobile (< md) */}
|
| 95 |
-
<div className="md:hidden fixed top-0 left-0 right-0 z-[60]">
|
| 96 |
-
<MobileHeader />
|
| 97 |
-
</div>
|
| 98 |
-
|
| 99 |
-
{/* Main Content - with padding for fixed header (64px) and bottom nav on Mobile */}
|
| 100 |
-
<main
|
| 101 |
-
className={cn(
|
| 102 |
-
"flex-1 w-full md:pt-0 md:pb-0 overflow-x-hidden",
|
| 103 |
-
// Disable global scroll on chats page to fix layout issues
|
| 104 |
-
pathname?.startsWith('/chats') ? "overflow-y-hidden" : "overflow-y-auto"
|
| 105 |
-
)}
|
| 106 |
-
style={{
|
| 107 |
-
paddingTop: pathname?.startsWith('/chats') ? '0px' : 'var(--header-height-mobile)',
|
| 108 |
-
paddingBottom: 'var(--footer-height-mobile)'
|
| 109 |
-
}}
|
| 110 |
-
>
|
| 111 |
-
{children}
|
| 112 |
-
</main>
|
| 113 |
-
|
| 114 |
-
{/* Mobile Bottom Navigation - FIXED at bottom - ONLY for Mobile (< md) */}
|
| 115 |
-
<div className="md:hidden fixed bottom-0 left-0 right-0 z-40">
|
| 116 |
-
<MobileBottomNav />
|
| 117 |
-
</div>
|
| 118 |
-
</div>
|
| 119 |
-
</div>
|
| 120 |
-
</ProtectedLayout>
|
| 121 |
-
)}
|
| 122 |
-
</Providers>
|
| 123 |
</body>
|
| 124 |
</html>
|
| 125 |
)
|
|
|
|
| 1 |
+
import type { Metadata, Viewport } from 'next'
|
|
|
|
|
|
|
| 2 |
import { Inter } from 'next/font/google'
|
| 3 |
import './globals.css'
|
| 4 |
+
import { LayoutClient } from '@/components/layout/LayoutClient'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
const inter = Inter({ subsets: ['latin', 'cyrillic'] })
|
| 7 |
|
| 8 |
+
export const metadata: Metadata = {
|
| 9 |
+
title: 'MicroFunnel Platform',
|
| 10 |
+
description: 'AI-Powered Business Automation',
|
| 11 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
export const viewport: Viewport = {
|
| 14 |
+
width: 'device-width',
|
| 15 |
+
initialScale: 1,
|
| 16 |
+
maximumScale: 1,
|
| 17 |
+
userScalable: false,
|
| 18 |
+
viewportFit: 'cover',
|
| 19 |
+
themeColor: '#050510',
|
| 20 |
}
|
| 21 |
|
| 22 |
export default function RootLayout({
|
|
|
|
| 24 |
}: {
|
| 25 |
children: React.ReactNode
|
| 26 |
}) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
return (
|
| 28 |
<html lang="ru">
|
| 29 |
<body className={inter.className}>
|
| 30 |
+
<LayoutClient>{children}</LayoutClient>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
</body>
|
| 32 |
</html>
|
| 33 |
)
|
frontend/components/ChatWindow/ChatHeader.tsx
CHANGED
|
@@ -33,9 +33,9 @@ export function ChatHeader({
|
|
| 33 |
onTrainAI,
|
| 34 |
}: ChatHeaderProps) {
|
| 35 |
return (
|
| 36 |
-
<div className="h-[
|
| 37 |
{/* Aurora Background Atmosphere - Synced */}
|
| 38 |
-
<div className="absolute inset-0 pointer-events-none overflow-hidden -z-10 bg-gradient-to-r from-indigo-500/5 to-purple-500/5 opacity-
|
| 39 |
|
| 40 |
{/* Left: Lead Info */}
|
| 41 |
<div className="flex items-center gap-2 md:gap-3 overflow-hidden">
|
|
|
|
| 33 |
onTrainAI,
|
| 34 |
}: ChatHeaderProps) {
|
| 35 |
return (
|
| 36 |
+
<div className="h-[52px] md:h-16 shrink-0 flex items-center justify-between px-3 md:px-6 relative z-[50] border-b border-white/5 bg-[#0D0E18]/40 backdrop-blur-2xl backdrop-saturate-[2]">
|
| 37 |
{/* Aurora Background Atmosphere - Synced */}
|
| 38 |
+
<div className="absolute inset-0 pointer-events-none overflow-hidden -z-10 bg-gradient-to-r from-indigo-500/5 to-purple-500/5 opacity-40" />
|
| 39 |
|
| 40 |
{/* Left: Lead Info */}
|
| 41 |
<div className="flex items-center gap-2 md:gap-3 overflow-hidden">
|
frontend/components/ChatWindow/MessageInput.tsx
CHANGED
|
@@ -133,7 +133,7 @@ export function MessageInput({
|
|
| 133 |
}
|
| 134 |
|
| 135 |
return (
|
| 136 |
-
<div className="px-3 pb-2 pt-2 bg-
|
| 137 |
<div className="max-w-4xl mx-auto relative">
|
| 138 |
{/* File Preview */}
|
| 139 |
{selectedFile && (
|
|
@@ -234,7 +234,7 @@ export function MessageInput({
|
|
| 234 |
onChange={(e) => onChange(e.target.value)}
|
| 235 |
onKeyDown={handleKeyDown}
|
| 236 |
placeholder="Сообщение..."
|
| 237 |
-
className="flex-1 bg-white/5 border border-white/5 rounded-2xl focus:ring-1 focus:ring-
|
| 238 |
rows={1}
|
| 239 |
style={{ minHeight: '44px' }}
|
| 240 |
disabled={disabled || isRecording}
|
|
@@ -244,9 +244,9 @@ export function MessageInput({
|
|
| 244 |
type="submit"
|
| 245 |
disabled={(!value.trim() && !selectedFile) || isSending || disabled}
|
| 246 |
className={cn(
|
| 247 |
-
"p-2.5 rounded-xl transition-all duration-
|
| 248 |
((value.trim() || selectedFile) && !isSending && !disabled)
|
| 249 |
-
? "text-
|
| 250 |
: "text-slate-600/50 opacity-50 grayscale"
|
| 251 |
)}
|
| 252 |
>
|
|
|
|
| 133 |
}
|
| 134 |
|
| 135 |
return (
|
| 136 |
+
<div className="px-2 sm:px-3 pb-2 pt-2 bg-[#0D0E18]/70 backdrop-blur-3xl flex-shrink-0 relative z-30">
|
| 137 |
<div className="max-w-4xl mx-auto relative">
|
| 138 |
{/* File Preview */}
|
| 139 |
{selectedFile && (
|
|
|
|
| 234 |
onChange={(e) => onChange(e.target.value)}
|
| 235 |
onKeyDown={handleKeyDown}
|
| 236 |
placeholder="Сообщение..."
|
| 237 |
+
className="flex-1 bg-white/5 border border-white/5 rounded-2xl focus:ring-1 focus:ring-white/10 resize-none max-h-24 sm:max-h-32 py-2.5 sm:py-3 px-3 sm:px-4 text-[16px] leading-tight text-white placeholder:text-slate-500/60 overflow-y-auto transition-all"
|
| 238 |
rows={1}
|
| 239 |
style={{ minHeight: '44px' }}
|
| 240 |
disabled={disabled || isRecording}
|
|
|
|
| 244 |
type="submit"
|
| 245 |
disabled={(!value.trim() && !selectedFile) || isSending || disabled}
|
| 246 |
className={cn(
|
| 247 |
+
"p-2.5 rounded-xl transition-all duration-500 relative flex items-center justify-center",
|
| 248 |
((value.trim() || selectedFile) && !isSending && !disabled)
|
| 249 |
+
? "text-white"
|
| 250 |
: "text-slate-600/50 opacity-50 grayscale"
|
| 251 |
)}
|
| 252 |
>
|
frontend/components/MobileBottomNav.tsx
CHANGED
|
@@ -53,55 +53,58 @@ export function MobileBottomNav() {
|
|
| 53 |
animate={{ y: 0 }}
|
| 54 |
exit={{ y: '100%' }}
|
| 55 |
transition={{ type: 'spring', damping: 20, stiffness: 200 }}
|
| 56 |
-
className="fixed bottom-0 left-0 right-0 z-[
|
| 57 |
>
|
| 58 |
-
<div className="flex items-center justify-around h-[
|
|
|
|
|
|
|
| 59 |
{/* Главная */}
|
| 60 |
<Link
|
| 61 |
href="/settings/brain"
|
| 62 |
className={cn(
|
| 63 |
-
"flex items-center justify-center
|
| 64 |
isActive('/settings/brain')
|
| 65 |
-
? "text-indigo-400 bg-
|
| 66 |
: "text-slate-500 hover:text-slate-300"
|
| 67 |
)}
|
| 68 |
>
|
| 69 |
-
<LayoutDashboard className="w-[
|
| 70 |
</Link>
|
| 71 |
|
| 72 |
{/* Чаты */}
|
| 73 |
<button
|
| 74 |
onClick={handleChatsClick}
|
| 75 |
className={cn(
|
| 76 |
-
"flex items-center justify-center
|
| 77 |
isActive('/chats')
|
| 78 |
-
? "text-indigo-400 bg-
|
| 79 |
: "text-slate-500 hover:text-slate-300"
|
| 80 |
)}
|
| 81 |
>
|
| 82 |
-
<MessageSquare className="w-[
|
| 83 |
</button>
|
| 84 |
|
| 85 |
{/* Записи */}
|
| 86 |
<Link
|
| 87 |
href="/appointments"
|
| 88 |
className={cn(
|
| 89 |
-
"flex items-center justify-center
|
| 90 |
isActive('/appointments')
|
| 91 |
-
? "text-indigo-400 bg-
|
| 92 |
: "text-slate-500 hover:text-slate-300"
|
| 93 |
)}
|
| 94 |
>
|
| 95 |
-
<Calendar className="w-[
|
| 96 |
</Link>
|
| 97 |
|
| 98 |
{/* Menu */}
|
| 99 |
<button
|
| 100 |
onClick={() => document.dispatchEvent(new CustomEvent('toggle-mobile-sidebar'))}
|
| 101 |
-
className="flex items-center justify-center
|
| 102 |
>
|
| 103 |
-
<Menu className="w-[
|
| 104 |
</button>
|
|
|
|
| 105 |
</div>
|
| 106 |
</motion.nav>
|
| 107 |
)}
|
|
|
|
| 53 |
animate={{ y: 0 }}
|
| 54 |
exit={{ y: '100%' }}
|
| 55 |
transition={{ type: 'spring', damping: 20, stiffness: 200 }}
|
| 56 |
+
className="fixed bottom-0 left-0 right-0 z-40 bg-[#0D0E18]/70 backdrop-blur-3xl backdrop-saturate-[1.8] pb-[env(safe-area-inset-bottom,0px)]"
|
| 57 |
>
|
| 58 |
+
<div className="flex items-center justify-around h-[50px] px-2 relative">
|
| 59 |
+
{/* Aurora Atmosphere inside the bar */}
|
| 60 |
+
<div className="absolute inset-0 pointer-events-none bg-gradient-to-t from-indigo-500/5 to-transparent overflow-hidden" />
|
| 61 |
{/* Главная */}
|
| 62 |
<Link
|
| 63 |
href="/settings/brain"
|
| 64 |
className={cn(
|
| 65 |
+
"flex flex-col items-center justify-center p-2 rounded-xl transition-all active:scale-90",
|
| 66 |
isActive('/settings/brain')
|
| 67 |
+
? "text-indigo-400 bg-indigo-500/5 shadow-[inset_0_0_10px_rgba(99,102,241,0.05)]"
|
| 68 |
: "text-slate-500 hover:text-slate-300"
|
| 69 |
)}
|
| 70 |
>
|
| 71 |
+
<LayoutDashboard className="w-[22px] h-[22px]" />
|
| 72 |
</Link>
|
| 73 |
|
| 74 |
{/* Чаты */}
|
| 75 |
<button
|
| 76 |
onClick={handleChatsClick}
|
| 77 |
className={cn(
|
| 78 |
+
"flex flex-col items-center justify-center p-2 rounded-xl transition-all active:scale-90",
|
| 79 |
isActive('/chats')
|
| 80 |
+
? "text-indigo-400 bg-indigo-500/5 shadow-[inset_0_0_10px_rgba(99,102,241,0.05)]"
|
| 81 |
: "text-slate-500 hover:text-slate-300"
|
| 82 |
)}
|
| 83 |
>
|
| 84 |
+
<MessageSquare className="w-[22px] h-[22px]" />
|
| 85 |
</button>
|
| 86 |
|
| 87 |
{/* Записи */}
|
| 88 |
<Link
|
| 89 |
href="/appointments"
|
| 90 |
className={cn(
|
| 91 |
+
"flex flex-col items-center justify-center p-2 rounded-xl transition-all active:scale-90",
|
| 92 |
isActive('/appointments')
|
| 93 |
+
? "text-indigo-400 bg-indigo-500/5 shadow-[inset_0_0_10px_rgba(99,102,241,0.05)]"
|
| 94 |
: "text-slate-500 hover:text-slate-300"
|
| 95 |
)}
|
| 96 |
>
|
| 97 |
+
<Calendar className="w-[22px] h-[22px]" />
|
| 98 |
</Link>
|
| 99 |
|
| 100 |
{/* Menu */}
|
| 101 |
<button
|
| 102 |
onClick={() => document.dispatchEvent(new CustomEvent('toggle-mobile-sidebar'))}
|
| 103 |
+
className="flex flex-col items-center justify-center p-2 rounded-xl text-slate-500 active:scale-90 hover:text-slate-300 transition-all"
|
| 104 |
>
|
| 105 |
+
<Menu className="w-[22px] h-[22px]" />
|
| 106 |
</button>
|
| 107 |
+
|
| 108 |
</div>
|
| 109 |
</motion.nav>
|
| 110 |
)}
|
frontend/components/MobileNav.tsx
CHANGED
|
@@ -57,17 +57,28 @@ export function MobileHeader({ onOpen }: { onOpen?: () => void }) {
|
|
| 57 |
const isUnlimited = limitDialogs === null || limitDialogs === undefined
|
| 58 |
|
| 59 |
return (
|
| 60 |
-
<div className="flex flex-col fixed top-0 left-0 right-0 z-[60]
|
| 61 |
-
<div className="flex items-center justify-between px-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
| 64 |
<div className="w-7 h-7 relative">
|
| 65 |
-
<img src="/logo-v2.png" alt="Logo" className="w-full h-full object-contain" />
|
| 66 |
</div>
|
|
|
|
|
|
|
|
|
|
| 67 |
</Link>
|
| 68 |
|
| 69 |
-
{/* Right:
|
| 70 |
-
<div className="flex items-center">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
<UserMenu user={user} logout={logout} companyName={companyName} getInitials={getInitials} getAvatarColor={getAvatarColor} />
|
| 72 |
</div>
|
| 73 |
</div>
|
|
|
|
| 57 |
const isUnlimited = limitDialogs === null || limitDialogs === undefined
|
| 58 |
|
| 59 |
return (
|
| 60 |
+
<div className="flex flex-col fixed top-0 left-0 right-0 z-[60] bg-[#0D0E18]/70 backdrop-blur-3xl backdrop-saturate-[1.8] pt-[env(safe-area-inset-top,0px)]">
|
| 61 |
+
<div className="flex items-center justify-between px-3 h-[52px] text-white w-full relative">
|
| 62 |
+
<div className="absolute inset-0 pointer-events-none bg-gradient-to-b from-indigo-500/5 to-transparent overflow-hidden" />
|
| 63 |
+
{/* Left: Logo + Brand Name */}
|
| 64 |
+
<Link href="/settings/brain" className="flex items-center gap-2.5 active:scale-95 transition-transform">
|
| 65 |
<div className="w-7 h-7 relative">
|
| 66 |
+
<img src="/logo-v2.png" alt="Logo" className="w-full h-full object-contain relative z-10" />
|
| 67 |
</div>
|
| 68 |
+
<span className="font-bold text-base tracking-[0.18em] uppercase text-white">
|
| 69 |
+
MICROFUNNEL
|
| 70 |
+
</span>
|
| 71 |
</Link>
|
| 72 |
|
| 73 |
+
{/* Right: Hub */}
|
| 74 |
+
<div className="flex items-center gap-2">
|
| 75 |
+
{usageStats && (
|
| 76 |
+
<div className="hidden sm:block text-[9px] font-bold text-indigo-400 bg-indigo-500/10 px-2 py-0.5 rounded-full border border-indigo-500/20 uppercase tracking-tighter">
|
| 77 |
+
{usedDialogs}/{isUnlimited ? '∞' : limitDialogs}
|
| 78 |
+
</div>
|
| 79 |
+
)}
|
| 80 |
+
|
| 81 |
+
{/* Profile avatar and menu */}
|
| 82 |
<UserMenu user={user} logout={logout} companyName={companyName} getInitials={getInitials} getAvatarColor={getAvatarColor} />
|
| 83 |
</div>
|
| 84 |
</div>
|
frontend/components/layout/LayoutClient.tsx
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client'
|
| 2 |
+
|
| 3 |
+
import { Sidebar } from '@/components/Sidebar'
|
| 4 |
+
import { Header } from '@/components/Header'
|
| 5 |
+
import { usePathname } from 'next/navigation'
|
| 6 |
+
import { useAuth } from '@/contexts/AuthContext'
|
| 7 |
+
import { cn } from '@/lib/utils'
|
| 8 |
+
import { useEffect } from 'react'
|
| 9 |
+
import { useRouter } from 'next/navigation'
|
| 10 |
+
import { MobileHeader, MobileSidebarWrapper } from '@/components/MobileNav'
|
| 11 |
+
import { MobileBottomNav } from '@/components/MobileBottomNav'
|
| 12 |
+
import { SecondaryNav } from '@/components/SecondaryNav'
|
| 13 |
+
|
| 14 |
+
function ProtectedLayout({ children }: { children: React.ReactNode }) {
|
| 15 |
+
const { user, isLoading } = useAuth()
|
| 16 |
+
const router = useRouter()
|
| 17 |
+
|
| 18 |
+
useEffect(() => {
|
| 19 |
+
if (!isLoading && !user) {
|
| 20 |
+
router.push('/login')
|
| 21 |
+
}
|
| 22 |
+
}, [isLoading, user, router])
|
| 23 |
+
|
| 24 |
+
if (!user && isLoading) {
|
| 25 |
+
return (
|
| 26 |
+
<div className="flex h-screen items-center justify-center bg-background">
|
| 27 |
+
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-600"></div>
|
| 28 |
+
</div>
|
| 29 |
+
)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (!user) return null
|
| 33 |
+
|
| 34 |
+
return <>{children}</>
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
export function LayoutClient({ children }: { children: React.ReactNode }) {
|
| 38 |
+
const pathname = usePathname()
|
| 39 |
+
|
| 40 |
+
// Pages without sidebar (public pages)
|
| 41 |
+
const publicPages = ['/', '/login', '/register', '/verify-email', '/forgot-password', '/terms', '/privacy', '/refund', '/pricing']
|
| 42 |
+
const isPublicPage = publicPages.includes(pathname)
|
| 43 |
+
|
| 44 |
+
return (
|
| 45 |
+
<>
|
| 46 |
+
{/* Global Background Atmosphere - Synced with Landing */}
|
| 47 |
+
<div className="fixed inset-0 z-0 pointer-events-none overflow-hidden bg-[#050510]">
|
| 48 |
+
<div className="absolute top-[-10%] right-[-5%] w-[60%] h-[60%] bg-gradient-to-b from-cyan-500/10 via-emerald-500/5 to-transparent blur-[120px] rounded-full" />
|
| 49 |
+
<div className="absolute bottom-[-10%] left-[-10%] w-[60%] h-[60%] bg-gradient-to-t from-indigo-600/10 via-purple-600/5 to-transparent blur-[120px] rounded-full" />
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
{isPublicPage ? (
|
| 53 |
+
// Public layout (no sidebar)
|
| 54 |
+
<div className="relative z-10">{children}</div>
|
| 55 |
+
) : (
|
| 56 |
+
// App layout (with sidebar)
|
| 57 |
+
<ProtectedLayout>
|
| 58 |
+
<div className="flex h-[100dvh] relative text-white overflow-hidden">
|
| 59 |
+
{/* Desktop Sidebar */}
|
| 60 |
+
<div className="hidden lg:flex h-full relative z-20 w-72 shrink-0">
|
| 61 |
+
<Sidebar />
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
{/* Mobile Sidebar (Drawer - opens from menu button) */}
|
| 65 |
+
<MobileSidebarWrapper>
|
| 66 |
+
<Sidebar />
|
| 67 |
+
</MobileSidebarWrapper>
|
| 68 |
+
|
| 69 |
+
{/* Main Content Area Container */}
|
| 70 |
+
<div className="flex-1 flex flex-col h-full min-w-0 relative">
|
| 71 |
+
{/* Desktop Header */}
|
| 72 |
+
<Header />
|
| 73 |
+
|
| 74 |
+
{/* Secondary Nav - Tablet/Small Desktop Only (Full Sidebar Content) */}
|
| 75 |
+
<SecondaryNav />
|
| 76 |
+
|
| 77 |
+
{/* Mobile Header - FIXED at top - ONLY for Mobile (< md) */}
|
| 78 |
+
<MobileHeader />
|
| 79 |
+
|
| 80 |
+
{/* Main Content - with padding for fixed header and bottom nav on Mobile */}
|
| 81 |
+
<main
|
| 82 |
+
className={cn(
|
| 83 |
+
"flex-1 w-full md:pt-0 md:pb-0 overflow-x-hidden",
|
| 84 |
+
// Disable global scroll on chats page to fix layout issues
|
| 85 |
+
pathname?.startsWith('/chats') ? "overflow-y-hidden" : "overflow-y-auto"
|
| 86 |
+
)}
|
| 87 |
+
style={{
|
| 88 |
+
// paddingTop: pathname?.startsWith('/chats') ? '0px' : 'var(--header-height-mobile)',
|
| 89 |
+
// paddingBottom: 'var(--footer-height-mobile)'
|
| 90 |
+
}}
|
| 91 |
+
>
|
| 92 |
+
<div
|
| 93 |
+
className="w-full h-full"
|
| 94 |
+
style={{
|
| 95 |
+
paddingTop: pathname?.startsWith('/chats') ? '0px' : 'var(--header-height-mobile)',
|
| 96 |
+
paddingBottom: 'var(--footer-height-mobile)'
|
| 97 |
+
}}
|
| 98 |
+
>
|
| 99 |
+
{children}
|
| 100 |
+
</div>
|
| 101 |
+
</main>
|
| 102 |
+
|
| 103 |
+
{/* Mobile Bottom Navigation - FIXED at bottom - ONLY for Mobile (< md) */}
|
| 104 |
+
<MobileBottomNav />
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
</ProtectedLayout>
|
| 108 |
+
)}
|
| 109 |
+
</>
|
| 110 |
+
)
|
| 111 |
+
}
|