import { useState, useEffect } from 'react' import { Link } from 'react-router-dom' import { modulesApi } from '../api/client' import { useAuth } from '../contexts/AuthContext' import { Package, ExternalLink } from 'lucide-react' export default function Dashboard() { const { user } = useAuth() const [modules, setModules] = useState([]) useEffect(() => { modulesApi.list().then(res => setModules(res.data.filter((m: any) => m.is_active))).catch(() => {}) }, []) return (

Добро пожаловать, {user?.first_name}!

Выберите модуль для работы

{modules.length === 0 ? (

Нет доступных модулей

Обратитесь к администратору для подключения модулей

) : (
{modules.map(mod => { const userRoles = user?.module_roles?.[mod.slug] || [] return (

{mod.name}

{mod.description || 'Без описания'}

{userRoles.length > 0 && (
{userRoles.map((r: string) => ( {r} ))}
)} {userRoles.length === 0 && ( Нет ролей в модуле )} ) })}
)}
) }