import React from 'react'; import { useAppStore } from '../../store'; import './ActivityBar.css'; // Simple SVG icons const PostsIcon = () => ( ); const MediaIcon = () => ( ); const SettingsIcon = () => ( ); const TagsIcon = () => ( ); const ChatIcon = () => ( ); const SyncIcon = () => ( ); export const ActivityBar: React.FC = () => { const { activeView, setActiveView, sidebarVisible, toggleSidebar, syncStatus, pendingChanges, openTab, tabs, activeTabId } = useAppStore(); const totalPending = pendingChanges.posts + pendingChanges.media; // 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 tab is currently active const isTagsTabActive = tabs.some(t => t.type === 'tags' && t.id === activeTabId); // Check if chat sidebar is active (activeView === 'chat' and sidebar is visible) const isChatActive = activeView === 'chat' && sidebarVisible; // Handle view click - toggle sidebar if clicking on active view, otherwise switch view const handleViewClick = (view: 'posts' | 'media' | 'chat') => { 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 = () => { // Open tags as a dedicated (non-transient) tab openTab({ type: 'tags', id: 'tags', isTransient: false }); }; return (