Spaces:
Running
Running
axeronis commited on
Commit ·
2450a28
1
Parent(s): a367e7d
fix: mobile profile dropdown, iOS zoom fix, dvh support, chat SSR bug fix
Browse filesFiles changed (2)
649 unmodified lines650651652653649 unmodified lines.animate-marquee-infinite {animation: none;}}649 unmodified lines650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683649 unmodified lines.animate-marquee-infinite {animation: none;}}/* === MOBILE SPECIFIC === *//* Safe area for bottom navigation */.safe-area-bottom {padding-bottom: env(safe-area-inset-bottom, 0);}/* Prevent zoom on iOS when focusing inputs */@media screen and (max-width: 767px) {input,textarea,select {font-size: 16px !important;/* Prevents iOS zoom */}/* Add bottom padding for pages with bottom nav */.mobile-page-padding {padding-bottom: 80px;}}/* Fix for virtual keyboard pushing content */@supports (height: 100dvh) {.h-screen {height: 100dvh;}}
1234567891011121314151617181920212240 unmodified lines636465666768697071727374757677787980'use client'import { useState, useEffect } from 'react'import { Menu, X } from 'lucide-react'import { usePathname } from 'next/navigation'import { Shield, User } from 'lucide-react'import Link from 'next/link'import { useAuth } from '@/contexts/AuthContext'import { api } from '@/lib/api'import { cn } from '@/lib/utils'export function MobileHeader({ onOpen }: { onOpen?: () => void }) {const { user } = useAuth()const [usageStats, setUsageStats] = useState<{plan: stringconversations_used: numberconversations_limit: number | null} | null>(null)// Load usage statsuseEffect(() => {40 unmodified lines)}</div>{/* Right side: Profile, Admin, Menu */}<div className="flex items-center gap-1">{/* Profile Avatar - Opens menu for settings */}<buttononClick={() => document.dispatchEvent(new CustomEvent('toggle-mobile-sidebar'))}className={cn("w-8 h-8 rounded-full flex items-center justify-center text-white font-bold text-xs border border-white/20",getAvatarColor(user?.email))}>{getInitials(user?.full_name, user?.email)}</button>{/* Admin Button */}{(user?.is_superuser || user?.role === 'admin') && (123456789101112131415161718192021222340 unmodified lines646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126'use client'import { useState, useEffect } from 'react'import { Menu, X, User, Settings, LogOut, ChevronDown } from 'lucide-react'import { usePathname } from 'next/navigation'import { Shield } from 'lucide-react'import Link from 'next/link'import { useAuth } from '@/contexts/AuthContext'import { api } from '@/lib/api'import { cn } from '@/lib/utils'export function MobileHeader({ onOpen }: { onOpen?: () => void }) {const { user, logout } = useAuth()const [usageStats, setUsageStats] = useState<{plan: stringconversations_used: numberconversations_limit: number | null} | null>(null)const [showProfileMenu, setShowProfileMenu] = useState(false)// Load usage statsuseEffect(() => {40 unmodified lines)}</div>{/* Right side: Profile (with dropdown), Admin, Menu */}<div className="flex items-center gap-1">{/* Profile Avatar with Dropdown */}<div className="relative"><buttononClick={() => setShowProfileMenu(!showProfileMenu)}className={cn("w-8 h-8 rounded-full flex items-center justify-center text-white font-bold text-xs border border-white/20",getAvatarColor(user?.email))}>{getInitials(user?.full_name, user?.email)}</button>{/* Profile Dropdown */}{showProfileMenu && (<><divclassName="fixed inset-0 z-40"onClick={() => setShowProfileMenu(false)}/><div className="absolute right-0 top-full mt-2 w-48 bg-[#1E1F2E] border border-white/10 rounded-xl shadow-2xl z-50 overflow-hidden"><div className="p-3 border-b border-white/10"><p className="text-sm font-semibold text-white truncate">{user?.full_name}</p><p className="text-xs text-slate-500 truncate">{user?.email}</p></div><div className="py-1"><Linkhref="/settings/profile"onClick={() => setShowProfileMenu(false)}className="flex items-center gap-3 px-4 py-2.5 text-sm text-slate-400 hover:text-white hover:bg-white/5 transition"><User className="w-4 h-4" />Профиль</Link><Linkhref="/settings/brain"onClick={() => setShowProfileMenu(false)}className="flex items-center gap-3 px-4 py-2.5 text-sm text-slate-400 hover:text-white hover:bg-white/5 transition"><Settings className="w-4 h-4" />Настройки</Link></div><div className="border-t border-white/10 py-1"><buttononClick={() => { logout(); setShowProfileMenu(false) }}className="flex items-center gap-3 px-4 py-2.5 text-sm text-red-400 hover:text-red-300 hover:bg-red-500/10 transition w-full text-left"><LogOut className="w-4 h-4" />Выйти</button></div></div></>)}</div>{/* Admin Button */}{(user?.is_superuser || user?.role === 'admin') && (
frontend/app/globals.css+30
frontend/components/MobileNav.tsx+59-13