diff --git a/src/features/communications/CommunicationsModule.tsx b/src/features/communications/CommunicationsModule.tsx index 8a7089d..cb00d71 100644 --- a/src/features/communications/CommunicationsModule.tsx +++ b/src/features/communications/CommunicationsModule.tsx @@ -24,8 +24,15 @@ export function CommunicationsModule() { const [isAddContactOpen, setIsAddContactOpen] = useState(false); const [isConnectChannelOpen, setIsConnectChannelOpen] = useState(false); const [connectMode, setConnectMode] = useState<'messenger' | 'email'>('messenger'); + const [showEmailTab, setShowEmailTab] = useState(() => localStorage.getItem('krona-show-email') === 'true'); const [showChannelsTab, setShowChannelsTab] = useState(() => localStorage.getItem('krona-show-bot-channels') === 'true'); + const updateEmailVisibility = (enabled: boolean) => { + setShowEmailTab(enabled); + localStorage.setItem('krona-show-email', String(enabled)); + if (!enabled && currentTab === 'email') handleTabChange('settings'); + }; + const updateChannelsVisibility = (enabled: boolean) => { setShowChannelsTab(enabled); localStorage.setItem('krona-show-bot-channels', String(enabled)); @@ -34,9 +41,12 @@ export function CommunicationsModule() { // Sync tab with URL search param const urlTab = searchParams.get('tab') as CommunicationTab | null; - const currentTab = urlTab && ['messengers', 'email', 'channels', 'contacts', 'settings'].includes(urlTab) - ? urlTab - : activeTab; + const requestedTab = urlTab && ['messengers', 'email', 'channels', 'contacts', 'settings'].includes(urlTab) ? urlTab : activeTab; + const currentTab = requestedTab === 'email' && !showEmailTab + ? 'messengers' + : requestedTab === 'channels' && !showChannelsTab + ? 'messengers' + : requestedTab; const handleTabChange = (tab: CommunicationTab) => { setActiveTab(tab); @@ -53,6 +63,7 @@ export function CommunicationsModule() { unreadChats={48} unreadEmails={10} unreadChannels={4} + showEmailTab={showEmailTab} showChannelsTab={showChannelsTab} /> @@ -74,7 +85,7 @@ export function CommunicationsModule() { {currentTab === 'contacts' && ( setIsAddContactOpen(true)} /> )} - {currentTab === 'settings' && } + {currentTab === 'settings' && } {/* Modals */} diff --git a/src/features/communications/components/CommunicationsHeader.tsx b/src/features/communications/components/CommunicationsHeader.tsx index 890394b..d26ed15 100644 --- a/src/features/communications/components/CommunicationsHeader.tsx +++ b/src/features/communications/components/CommunicationsHeader.tsx @@ -9,6 +9,7 @@ interface CommunicationsHeaderProps { unreadChats: number; unreadEmails: number; unreadChannels: number; + showEmailTab: boolean; showChannelsTab: boolean; } @@ -18,6 +19,7 @@ export function CommunicationsHeader({ unreadChats, unreadEmails, unreadChannels, + showEmailTab, showChannelsTab, }: CommunicationsHeaderProps) { const tabItems = [ @@ -49,7 +51,11 @@ export function CommunicationsHeader({ label: 'Настройки', icon: , }, - ].filter((item) => item.id !== 'channels' || showChannelsTab); + ].filter((item) => { + if (item.id === 'email') return showEmailTab; + if (item.id === 'channels') return showChannelsTab; + return true; + }); return (
diff --git a/src/features/communications/components/MessengersView.tsx b/src/features/communications/components/MessengersView.tsx index 1a319da..a2d7618 100644 --- a/src/features/communications/components/MessengersView.tsx +++ b/src/features/communications/components/MessengersView.tsx @@ -684,13 +684,6 @@ export function MessengersView({ onOpenConnectModal, onOpenAddContactModal }: Me > MAX - setActiveConnector('email')} - count={10} - > - Email - {/* Smooth fade-out indicator on the right edge */}
diff --git a/src/features/communications/components/SettingsView.tsx b/src/features/communications/components/SettingsView.tsx index 3508f5c..aa566f7 100644 --- a/src/features/communications/components/SettingsView.tsx +++ b/src/features/communications/components/SettingsView.tsx @@ -5,11 +5,13 @@ import { Button, Badge } from '@krona/ui'; import { useToast } from '../../../shared/ui'; interface SettingsViewProps { + showEmailTab: boolean; + onShowEmailTabChange: (enabled: boolean) => void; showChannelsTab: boolean; onShowChannelsTabChange: (enabled: boolean) => void; } -export function SettingsView({ showChannelsTab, onShowChannelsTabChange }: SettingsViewProps) { +export function SettingsView({ showEmailTab, onShowEmailTabChange, showChannelsTab, onShowChannelsTabChange }: SettingsViewProps) { const { showToast } = useToast(); const { integrations, @@ -50,9 +52,21 @@ export function SettingsView({ showChannelsTab, onShowChannelsTabChange }: Setti return (
-
+

Отображение разделов

+

Показывайте только те способы связи, которыми пользуется организация

+
+
+
+
Email
+
Почтовые ящики и переписка
+
+ +
+
-

Раздел «Каналы»

+
Каналы

Боты и публичные каналы организации

+
{/* 1. Connected Messengers & Connectors */}