diff --git a/src/core/modules/registry.ts b/src/core/modules/registry.ts index 4142155..fc1177a 100644 --- a/src/core/modules/registry.ts +++ b/src/core/modules/registry.ts @@ -115,11 +115,10 @@ export const SYSTEM_MODULES: ModuleDefinition[] = [ requiredCapability: 'communications', badge: '3', sections: [ - { id: 'inbox', label: 'Единый Inbox', route: '/communications' }, - { id: 'telegram', label: 'Telegram Bot & Чат', route: '/communications?channel=telegram' }, - { id: 'whatsapp', label: 'WhatsApp', route: '/communications?channel=whatsapp' }, - { id: 'team', label: 'Командный чат', route: '/communications?channel=team' }, - { id: 'channels', label: 'Подключенные каналы', route: '/communications/channels' }, + { id: 'messengers', label: 'Мессенджеры', route: '/communications?section=messengers' }, + { id: 'email', label: 'Почта', route: '/communications?section=email' }, + { id: 'channels', label: 'Каналы', route: '/communications?section=channels' }, + { id: 'settings', label: 'Настройки', route: '/communications?section=settings' }, ], }, { diff --git a/src/features/communications/CommunicationsModule.tsx b/src/features/communications/CommunicationsModule.tsx index d7a1a0c..b1d6bd9 100644 --- a/src/features/communications/CommunicationsModule.tsx +++ b/src/features/communications/CommunicationsModule.tsx @@ -4,6 +4,7 @@ import { Mail, MessageCircleMore, Paperclip, Plus, Search, Send, Settings2, ShieldCheck, UsersRound, } from 'lucide-react'; import { Button, useToast } from '../../shared/ui'; +import { useSearchParams } from 'react-router-dom'; type Section = 'messengers' | 'email' | 'channels' | 'settings'; type Message = { id: string; mine?: boolean; text: string; time: string }; @@ -112,6 +113,11 @@ function Settings() { } export const CommunicationsModule: React.FC = () => { - const [section, setSection] = useState
('messengers'); + const [searchParams, setSearchParams] = useSearchParams(); + const requestedSection = searchParams.get('section'); + const section: Section = requestedSection && sections.some((item) => item.id === requestedSection) + ? requestedSection as Section + : 'messengers'; + const setSection = (nextSection: Section) => setSearchParams({ section: nextSection }); return

Коммуникации

Личные мессенджеры, почта и рабочие каналы в одном окне

Подключено
{section === 'messengers' && }{section === 'email' && }{section === 'channels' && }{section === 'settings' && }
; };