Fix:Adding Indexing to the Catalog Tabs

This commit is contained in:
duckietm 2024-03-19 09:39:01 +01:00
parent 304e945c13
commit e4658143fa

View File

@ -72,17 +72,21 @@ export const CatalogView: FC<{}> = props =>
<NitroCardView uniqueKey="catalog" className="nitro-catalog" style={ GetConfiguration('catalog.headers') ? { width: 710 } : {} }>
<NitroCardHeaderView headerText={ LocalizeText('catalog.title') } onCloseClick={ event => setIsVisible(false) } />
<NitroCardTabsView>
{ rootNode && (rootNode.children.length > 0) && rootNode.children.map(child =>
{
{rootNode &&
rootNode.children.length > 0 &&
rootNode.children.map((child, index) => {
if (!child.isVisible) return null;
// Generate a unique key using the index of the map function
const uniqueKey = `${child.pageId}-${index}`;
return (
<NitroCardTabsItemView key={ child.pageId } isActive={ child.isActive } onClick={ event =>
{
<NitroCardTabsItemView
key={uniqueKey}
isActive={child.isActive}
onClick={(event) => {
if (searchResult) setSearchResult(null);
activateNode(child);
} } >
}}
>
<Flex gap={GetConfiguration('catalog.tab.icons') ? 1 : 0} alignItems="center">
{GetConfiguration('catalog.tab.icons') && <CatalogIconView icon={child.iconId} />}
{child.localization}