import React from 'react'; import { useAppStore } from '../../store'; import { useI18n } from '../../i18n'; import './ActivityBar.css'; // Simple SVG icons const PostsIcon = () => ( ); const PagesIcon = () => ( ); const MediaIcon = () => ( ); const SettingsIcon = () => ( ); const TagsIcon = () => ( ); const ChatIcon = () => ( ); const ImportIcon = () => ( ); const GitIcon = () => ( ); export const ActivityBar: React.FC = () => { const { t } = useI18n(); const { activeView, setActiveView, sidebarVisible, toggleSidebar, openTab, tabs, activeTabId } = useAppStore(); // Check if settings tab is currently active const isSettingsTabActive = tabs.some(t => t.type === 'settings' && t.id === activeTabId); // Check if settings view is active (either tab or sidebar) const isSettingsActive = (activeView === 'settings' && sidebarVisible) || isSettingsTabActive; // Check if tags sidebar is active const isTagsActive = activeView === 'tags' && sidebarVisible; // Check if chat sidebar is active (activeView === 'chat' and sidebar is visible) const isChatActive = activeView === 'chat' && sidebarVisible; // Check if import sidebar is active const isImportActive = activeView === 'import' && sidebarVisible; const isGitActive = activeView === 'git' && sidebarVisible; // Handle view click - toggle sidebar if clicking on active view, otherwise switch view const handleViewClick = (view: 'posts' | 'pages' | 'media' | 'chat' | 'git') => { if (activeView === view && sidebarVisible) { // Clicking on active view toggles sidebar off toggleSidebar(); } else if (activeView === view && !sidebarVisible) { // Clicking on active view when hidden shows it toggleSidebar(); } else { // Switching to a different view - ensure sidebar is visible if (!sidebarVisible) { toggleSidebar(); } setActiveView(view); } }; const handleSettingsClick = () => { // Toggle sidebar if settings is already active, otherwise switch to settings if (activeView === 'settings' && sidebarVisible) { toggleSidebar(); } else { // Open settings tab and show settings sidebar openTab({ type: 'settings', id: 'settings', isTransient: false }); setActiveView('settings'); if (!sidebarVisible) { toggleSidebar(); } } }; const handleTagsClick = () => { // Toggle sidebar if tags is already active, otherwise switch to tags if (activeView === 'tags' && sidebarVisible) { toggleSidebar(); } else { openTab({ type: 'tags', id: 'tags', isTransient: false }); setActiveView('tags'); if (!sidebarVisible) { toggleSidebar(); } } }; const handleImportClick = () => { if (activeView === 'import' && sidebarVisible) { toggleSidebar(); } else { setActiveView('import'); if (!sidebarVisible) { toggleSidebar(); } } }; return (
); };