Analytics Insights and Tools Modal

This commit is contained in:
ajaysi
2025-09-07 08:42:37 +05:30
parent 7ac72c5382
commit 5ba19c097a
9 changed files with 367 additions and 90 deletions

View File

@@ -171,7 +171,9 @@ const DashboardHeader: React.FC<DashboardHeaderProps> = ({
width: '100%',
height: '100%',
background: 'linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent)',
animation: 'shimmer 2.5s infinite',
animation: workflowControls.completedTasks === workflowControls.totalTasks
? 'none'
: 'shimmer 2.5s infinite',
zIndex: 1,
},
'&::after': {

View File

@@ -24,7 +24,8 @@ const SearchFilter: React.FC<SearchFilterProps> = ({
selectedSubCategory,
onSubCategoryChange,
toolCategories,
theme
theme,
onCategoryClick
}) => {
// Helper function to get tool count from a category
const getToolCount = (category: any): number => {
@@ -103,7 +104,7 @@ const SearchFilter: React.FC<SearchFilterProps> = ({
<Box sx={{ display: 'flex', gap: 1, flexWrap: 'wrap', alignItems: 'center' }}>
<CategoryChip
label="All Tools"
onClick={() => onCategoryChange(null)}
onClick={() => onCategoryClick ? onCategoryClick(null, toolCategories) : onCategoryChange(null)}
active={selectedCategory === null}
theme={theme}
toolCount={Object.values(toolCategories).reduce((total, category) => total + getToolCount(category), 0)}
@@ -122,7 +123,7 @@ const SearchFilter: React.FC<SearchFilterProps> = ({
>
<CategoryChip
label={category}
onClick={() => onCategoryChange(category)}
onClick={() => onCategoryClick ? onCategoryClick(category, cat) : onCategoryChange(category)}
active={selectedCategory === category}
theme={theme}
toolCount={getToolCount(cat)}

View File

@@ -73,6 +73,7 @@ export interface SearchFilterProps {
onSubCategoryChange: (subCategory: string | null) => void;
toolCategories: ToolCategories;
theme: any;
onCategoryClick?: (category: string | null, categoryData?: any) => void;
}
export interface DashboardHeaderProps {

View File

@@ -1,19 +1,26 @@
import { Category, Tool, ToolCategories } from './types';
// Utility functions for dashboard components
export const getToolsForCategory = (category: Category, selectedSubCategory: string | null): Tool[] => {
export const getToolsForCategory = (category: Category | null, selectedSubCategory: string | null): Tool[] => {
if (!category) {
return [];
}
if ('subCategories' in category) {
if (selectedSubCategory && category.subCategories[selectedSubCategory]) {
return category.subCategories[selectedSubCategory].tools;
const subCategory = category.subCategories[selectedSubCategory];
return subCategory && subCategory.tools ? subCategory.tools : [];
}
// When no subcategory is selected, return all tools from all subcategories
const allTools: Tool[] = [];
Object.values(category.subCategories).forEach(subCategory => {
allTools.push(...subCategory.tools);
if (subCategory && subCategory.tools && Array.isArray(subCategory.tools)) {
allTools.push(...subCategory.tools);
}
});
return allTools;
}
return category.tools;
return category.tools && Array.isArray(category.tools) ? category.tools : [];
};
export const getFilteredCategories = (