Skip to content

Commit b6b33d9

Browse files
improve the code after rebase
Signed-off-by: Philip Colares Carneiro <philip.colares@gmail.com>
1 parent dfad851 commit b6b33d9

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

clients/ui/frontend/src/app/pages/mcpCatalog/screens/McpCatalog.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const McpCatalog: React.FC = () => {
3030
const filtersApplied = hasMcpFiltersApplied(filters, searchQuery);
3131
const isAllServersView = selectedSourceLabel === undefined && !filtersApplied;
3232

33-
const { isSingleCategory, hasNoCategories } = useEffectiveCategories(
33+
const { effectiveActiveCategories, isSingleCategory, hasNoCategories } = useEffectiveCategories(
3434
catalogSources,
3535
catalogLabels,
3636
emptyCategoryLabels,
@@ -92,6 +92,9 @@ const McpCatalog: React.FC = () => {
9292
<McpCatalogGalleryView
9393
handleFilterReset={handleResetAllFilters}
9494
isSingleCategory={isSingleCategory}
95+
singleCategoryLabel={
96+
isSingleCategory ? effectiveActiveCategories[0] : undefined
97+
}
9598
/>
9699
)}
97100
</PageSection>

clients/ui/frontend/src/app/pages/mcpCatalog/screens/McpCatalogGalleryView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ const PAGE_SIZE = 10;
3232
type McpCatalogGalleryViewProps = {
3333
handleFilterReset: () => void;
3434
isSingleCategory?: boolean;
35+
singleCategoryLabel?: string;
3536
};
3637

3738
const McpCatalogGalleryView: React.FC<McpCatalogGalleryViewProps> = ({
3839
handleFilterReset,
3940
isSingleCategory = false,
41+
singleCategoryLabel,
4042
}) => {
4143
const {
4244
mcpApiState,
@@ -98,16 +100,17 @@ const McpCatalogGalleryView: React.FC<McpCatalogGalleryViewProps> = ({
98100
);
99101
}
100102

103+
const effectiveCategoryLabel = singleCategoryLabel || selectedSourceLabel || '';
101104
const categoryTitle = isSingleCategory
102105
? getLabelDisplayName(
103-
selectedSourceLabel || '',
106+
effectiveCategoryLabel,
104107
catalogLabels,
105108
OTHER_MCP_SERVERS_DISPLAY_NAME,
106109
'servers',
107110
)
108111
: undefined;
109112
const categoryDescription = isSingleCategory
110-
? getLabelDescription(selectedSourceLabel || '', catalogLabels)
113+
? getLabelDescription(effectiveCategoryLabel, catalogLabels)
111114
: undefined;
112115

113116
return (

clients/ui/frontend/src/app/pages/modelCatalog/screens/ModelCatalog.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const ModelCatalog: React.FC = () => {
2626
} = React.useContext(ModelCatalogContext);
2727
const filtersApplied = useHasVisibleFiltersApplied();
2828

29-
const { isSingleCategory, hasNoCategories } = useEffectiveCategories(
29+
const { effectiveActiveCategories, isSingleCategory, hasNoCategories } = useEffectiveCategories(
3030
catalogSources,
3131
catalogLabels,
3232
emptyCategoryLabels,
@@ -88,7 +88,9 @@ const ModelCatalog: React.FC = () => {
8888
searchTerm={searchTerm}
8989
handleFilterReset={handleFilterReset}
9090
isSingleCategory={isSingleCategory}
91-
singleCategoryLabel={isSingleCategory ? activeCategories[0] : undefined}
91+
singleCategoryLabel={
92+
isSingleCategory ? effectiveActiveCategories[0] : undefined
93+
}
9294
/>
9395
)}
9496
</PageSection>

0 commit comments

Comments
 (0)