import React from 'react'; import { Link, useLocation } from 'react-router-dom'; import { Home, FileText, Rss, Settings as SettingsIcon, LogOut, Menu, X } from 'lucide-react'; import { apiClient } from '../lib/api'; interface LayoutProps { children: React.ReactNode; } const Layout: React.FC = ({ children }) => { const [sidebarOpen, setSidebarOpen] = React.useState(false); const location = useLocation(); const user = apiClient.getUser(); const navigation = [ { name: 'Dashboard', href: '/dashboard', icon: Home }, { name: 'Articles', href: '/articles', icon: FileText }, { name: 'Feeds', href: '/feeds', icon: Rss }, { name: 'Settings', href: '/settings', icon: SettingsIcon }, ]; const handleLogout = async () => { try { await apiClient.logout(); window.location.reload(); } catch (error) { console.error('Logout failed:', error); // Force logout even if API call fails apiClient.clearAuth(); window.location.reload(); } }; return (
{/* Mobile sidebar overlay */} {sidebarOpen && (
setSidebarOpen(false)} /> )} {/* Sidebar */}
FFR FFR
{/* User section */}
{user?.name?.charAt(0)?.toUpperCase()}

{user?.name}

{user?.email}

{/* Main content */}
{/* Top header for mobile */}
FFR FFR
{/* Spacer for centering */}
{/* Page content */}
{children}
); }; export default Layout;