fix: cleanup of tag icon in action bar

This commit is contained in:
2026-02-21 16:07:43 +01:00
parent cdf064b6a1
commit 69007ef393
3 changed files with 121 additions and 7 deletions

View File

@@ -66,8 +66,8 @@ export const ActivityBar: React.FC = () => {
// 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 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;
@@ -108,8 +108,16 @@ export const ActivityBar: React.FC = () => {
};
const handleTagsClick = () => {
// Open tags as a dedicated (non-transient) tab
openTab({ type: 'tags', id: 'tags', isTransient: false });
// 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 = () => {
@@ -148,9 +156,9 @@ export const ActivityBar: React.FC = () => {
<MediaIcon />
</button>
<button
className={`activity-bar-item ${isTagsTabActive ? 'active' : ''}`}
className={`activity-bar-item ${isTagsActive ? 'active' : ''}`}
onClick={handleTagsClick}
title={t('activity.tags')}
title={`${t('activity.tags')} ${t('activity.toggleHint')}`}
>
<TagsIcon />
</button>

View File

@@ -1223,11 +1223,19 @@ import { scrollToTagsSection, TagsCategory } from '../TagsView';
const TagsNav: React.FC = () => {
const { t } = useI18n();
const { tabs, activeTabId, openTab } = useAppStore();
const [activeSection, setActiveSection] = useState<TagsCategory | null>(null);
const isTagsTabActive = tabs.some(t => t.type === 'tags' && t.id === activeTabId);
const handleNavClick = (category: TagsCategory) => {
if (!isTagsTabActive) {
openTab({ type: 'tags', id: 'tags', isTransient: false });
}
setActiveSection(category);
scrollToTagsSection(category);
setTimeout(() => {
scrollToTagsSection(category);
}, isTagsTabActive ? 0 : 100);
};
return (