From e4cd975d9c2a8d7b2c7b6ac44739adfe9de7f008 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Fri, 5 Jun 2026 00:16:01 +0300 Subject: [PATCH] refactor(desktop-header): elegant labeled nav, drop hover-reveal + dead sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The desktop top-bar nav rendered icon-only buttons whose label only slid out on hover (max-w-0 -> group-hover:max-w-40) — mystery-meat, jumpy, hard to scan. Replace with always-visible 'icon + label' links and a single framer-motion pill (shared layoutId) that smoothly slides to the active item; compact spacing, refined active/hover states. Also delete DesktopSidebar.tsx — dead code since the cabinet's inception (never imported anywhere, only re-exported from the barrel). --- src/components/layout/AppShell/AppShell.tsx | 126 +++++------ .../layout/AppShell/DesktopSidebar.tsx | 212 ------------------ src/components/layout/AppShell/index.ts | 1 - 3 files changed, 51 insertions(+), 288 deletions(-) delete mode 100644 src/components/layout/AppShell/DesktopSidebar.tsx diff --git a/src/components/layout/AppShell/AppShell.tsx b/src/components/layout/AppShell/AppShell.tsx index 76bae6f..4eef427 100644 --- a/src/components/layout/AppShell/AppShell.tsx +++ b/src/components/layout/AppShell/AppShell.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'; import { useLocation, Link } from 'react-router'; import { useQuery } from '@tanstack/react-query'; import { useTranslation } from 'react-i18next'; +import { motion } from 'framer-motion'; import { useAuthStore } from '@/store/auth'; import { useHaptic } from '@/platform'; @@ -109,11 +110,13 @@ export function AppShell({ children }: AppShellProps) { }; }, []); - // Desktop navigation items - const desktopNavItems = [ + // Desktop navigation — labels always visible (no hover-reveal gimmick) + const desktopNav = [ { path: '/', label: t('nav.dashboard'), icon: HomeIcon }, { path: '/subscriptions', label: t('nav.subscription'), icon: SubscriptionIcon }, { path: '/balance', label: t('nav.balance'), icon: CreditCardIcon }, + ...(referralEnabled ? [{ path: '/referral', label: t('nav.referral'), icon: UsersIcon }] : []), + ...(giftEnabled ? [{ path: '/gift', label: t('nav.gift'), icon: GiftIcon }] : []), { path: '/support', label: t('nav.support'), icon: ChatIcon }, { path: '/info', label: t('nav.info'), icon: InfoIcon }, { path: '/profile', label: t('nav.profile'), icon: UserIcon }, @@ -128,6 +131,48 @@ export function AppShell({ children }: AppShellProps) { haptic.impact('light'); }; + // A single elegant nav link: icon + label always visible, with a shared + // framer-motion pill that slides to the active item on navigation. + const renderNavLink = ( + path: string, + label: string, + Icon: React.ComponentType<{ className?: string }>, + admin = false, + ) => { + const active = admin ? location.pathname.startsWith('/admin') : isActive(path); + return ( + + {active && ( + + )} + + {label} + + ); + }; + // headerHeight comes from useHeaderHeight() — accounts for TG safe area in fullscreen return ( @@ -170,81 +215,12 @@ export function AppShell({ children }: AppShellProps) { {/* Center Navigation */} -