From d41d8d65661ac6ae26c74fbe33bfc25c387801e2 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:50:54 +0200 Subject: [PATCH] feat: Enhance CategoryTabs and Marketplace components for better responsiveness and navigation --- client/src/components/Agents/CategoryTabs.tsx | 37 ++++++++++--------- client/src/components/Agents/Marketplace.tsx | 13 ++++++- client/src/components/Agents/SearchBar.tsx | 14 +++---- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/client/src/components/Agents/CategoryTabs.tsx b/client/src/components/Agents/CategoryTabs.tsx index f232c7ad0b..2dcb19ff1a 100644 --- a/client/src/components/Agents/CategoryTabs.tsx +++ b/client/src/components/Agents/CategoryTabs.tsx @@ -24,6 +24,7 @@ interface CategoryTabsProps { * Renders a tabbed navigation interface showing agent categories. * Includes loading states, empty state handling, and displays counts for each category. * Uses database-driven category labels with no hardcoded values. + * Features multi-row wrapping for better responsive behavior. */ const CategoryTabs: React.FC = ({ categories, @@ -46,14 +47,13 @@ const CategoryTabs: React.FC = ({ return category.label || category.value.charAt(0).toUpperCase() + category.value.slice(1); }; - // Loading skeleton component const loadingSkeleton = (
-
+
{[...Array(6)].map((_, i) => (
))}
@@ -67,15 +67,23 @@ const CategoryTabs: React.FC = ({ switch (e.key) { case 'ArrowLeft': - case 'ArrowUp': e.preventDefault(); newIndex = currentIndex > 0 ? currentIndex - 1 : categories.length - 1; break; case 'ArrowRight': - case 'ArrowDown': e.preventDefault(); newIndex = currentIndex < categories.length - 1 ? currentIndex + 1 : 0; break; + case 'ArrowUp': + e.preventDefault(); + // Move up a row (approximate by moving back ~4-6 items) + newIndex = Math.max(0, currentIndex - 5); + break; + case 'ArrowDown': + e.preventDefault(); + // Move down a row (approximate by moving forward ~4-6 items) + newIndex = Math.min(categories.length - 1, currentIndex + 5); + break; case 'Home': e.preventDefault(); newIndex = 0; @@ -94,7 +102,9 @@ const CategoryTabs: React.FC = ({ // Focus the new tab setTimeout(() => { const newTab = document.getElementById(`category-tab-${newCategory.value}`); - newTab?.focus(); + if (newTab) { + newTab.focus(); + } }, 0); } }; @@ -108,16 +118,12 @@ const CategoryTabs: React.FC = ({ // Main tabs content const tabsContent = ( -
+
{categories.map((category, index) => ( )}