Perps-Terminal / frontend /src /components /layout /MobileBottomNav.tsx
Naufal Arhab
feat(chart): add real-time pro terminal, multi-exchange order flow, and canvas performance optimizations
7843862
Raw History Blame Contribute Delete
5.74 kB
import { Activity, Bot, BookOpen, Layers, Settings, Sparkles, BarChart2 } from 'lucide-react';
import type { AppTab } from './Header';
interface MobileBottomNavProps {
activeTab: AppTab;
onTabChange: (tab: AppTab) => void;
onOpenMobileDrawer: () => void;
onOpenAISettings: () => void;
activePairCount: number;
isAIConfigured: boolean;
}
export function MobileBottomNav({
activeTab,
onTabChange,
onOpenMobileDrawer,
onOpenAISettings,
activePairCount,
isAIConfigured,
}: MobileBottomNavProps) {
return (
<nav
className="md:hidden fixed bottom-0 left-0 right-0 z-40 bg-bg-card/95 backdrop-blur-md border-t border-border/80 flex items-center justify-around px-1 pt-1 pb-[max(0.35rem,env(safe-area-inset-bottom))] shadow-2xl"
aria-label="Mobile Navigation"
>
{/* 1. Live Sinyal Tab */}
<button
type="button"
onClick={() => onTabChange('signals')}
className={`flex-1 flex flex-col items-center justify-center py-1 px-0.5 rounded-xl transition-all duration-150 active:scale-95 min-h-[44px] ${
activeTab === 'signals'
? 'text-accent-blue font-semibold'
: 'text-text-muted hover:text-text-secondary'
}`}
>
<div className="relative">
<Activity size={18} className={activeTab === 'signals' ? 'animate-pulse' : ''} />
{activeTab === 'signals' && (
<span className="absolute -bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 rounded-full bg-accent-blue" />
)}
</div>
<span className="text-[10px] font-medium tracking-tight mt-0.5">
Sinyal
</span>
</button>
{/* 2. Live Chart Tab */}
<button
type="button"
onClick={() => onTabChange('chart')}
className={`flex-1 flex flex-col items-center justify-center py-1 px-0.5 rounded-xl transition-all duration-150 active:scale-95 min-h-[44px] ${
activeTab === 'chart'
? 'text-sky-400 font-semibold'
: 'text-text-muted hover:text-text-secondary'
}`}
>
<div className="relative">
<BarChart2 size={18} />
{activeTab === 'chart' && (
<span className="absolute -bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 rounded-full bg-sky-400" />
)}
</div>
<span className="text-[10px] font-medium tracking-tight mt-0.5">
Chart
</span>
</button>
{/* 3. Damian Tab */}
<button
type="button"
onClick={() => onTabChange('ai')}
className={`flex-1 flex flex-col items-center justify-center py-1 px-0.5 rounded-xl transition-all duration-150 active:scale-95 min-h-[44px] ${
activeTab === 'ai'
? 'text-purple-400 font-semibold'
: 'text-text-muted hover:text-text-secondary'
}`}
>
<div className="relative">
<Bot size={18} />
{activeTab === 'ai' && (
<span className="absolute -bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 rounded-full bg-purple-400" />
)}
</div>
<span className="text-[10px] font-medium tracking-tight mt-0.5">
Damian
</span>
</button>
{/* 4. Jurnal Trade Tab */}
<button
type="button"
onClick={() => onTabChange('journal')}
className={`flex-1 flex flex-col items-center justify-center py-1 px-0.5 rounded-xl transition-all duration-150 active:scale-95 min-h-[44px] ${
activeTab === 'journal'
? 'text-emerald-400 font-semibold'
: 'text-text-muted hover:text-text-secondary'
}`}
>
<div className="relative">
<BookOpen size={18} />
{activeTab === 'journal' && (
<span className="absolute -bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 rounded-full bg-emerald-400" />
)}
</div>
<span className="text-[10px] font-medium tracking-tight mt-0.5">
Jurnal
</span>
</button>
{/* 5. Daftar Pairs (Drawer Trigger) */}
<button
type="button"
onClick={onOpenMobileDrawer}
className="flex-1 flex flex-col items-center justify-center py-1 px-0.5 rounded-xl text-text-muted hover:text-text-primary transition-all duration-150 active:scale-95 min-h-[44px]"
>
<div className="relative">
<Layers size={18} />
{activePairCount > 0 && (
<span className="absolute -top-1 -right-2 px-1 py-0.2 bg-accent-blue/20 text-accent-blue border border-accent-blue/40 text-[9px] font-mono font-bold rounded-full leading-none">
{activePairCount}
</span>
)}
</div>
<span className="text-[10px] font-medium tracking-tight mt-0.5">
Pairs
</span>
</button>
{/* 6. Atur AI Settings Modal Trigger */}
<button
type="button"
onClick={onOpenAISettings}
className="flex-1 flex flex-col items-center justify-center py-1 px-0.5 rounded-xl text-text-muted hover:text-text-primary transition-all duration-150 active:scale-95 min-h-[44px]"
>
<div className="relative">
{isAIConfigured ? (
<Sparkles size={18} className="text-purple-400" />
) : (
<Settings size={18} className="text-amber-400 animate-pulse" />
)}
<span
className={`absolute -top-0.5 -right-1 w-1.5 h-1.5 rounded-full ${
isAIConfigured ? 'bg-signal-long' : 'bg-amber-400 animate-ping'
}`}
/>
</div>
<span className="text-[10px] font-medium tracking-tight mt-0.5">
Atur AI
</span>
</button>
</nav>
);
}