Skip to content

Commit

Permalink
Merge pull request #48 from near/develop
Browse files Browse the repository at this point in the history
Use contentProps to pass global tag filtering
  • Loading branch information
gabehamilton authored Apr 23, 2024
2 parents 061f52e + f10e7cc commit 1347607
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 64 deletions.
2 changes: 1 addition & 1 deletion nexus/components/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# AGI Guild Resource Portal (Nexus)

A portal that showcases Open Source AI Apps and Agents from across ecosystems.
A portal that showcases Open Source AI Apps and Agents from across ecosystems.
6 changes: 4 additions & 2 deletions nexus/components/src/AI/Agent/AgentEntityConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ return (
<Widget
src="${REPL_ACCOUNT}/widget/Entities.Template.GenericEntityConfig"
props={{
namespace: "near",
namespace: props.namespace,
entityType: "agent",
title: "Agent",
schemaFile: "${REPL_ACCOUNT}/widget/AI.Schema.Agent",
renderItem,
homeLink: "${REPL_ACCOUNT}/widget/AI.Nexus",
homeLink: props.homeLink,
globalTagFilter: props.globalTagFilter,
setGlobalTagFilter: props.setGlobalTagFilter,
}}
/>
);
19 changes: 16 additions & 3 deletions nexus/components/src/AI/Nexus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ const content = {
);
},
subGroups: (groupName, group) => {
const contentProps = {
namespace: "near",
homeLink: "${REPL_ACCOUNT}/widget/AI.Nexus",
globalTagFilter,
setGlobalTagFilter: (value) => setGlobalTagFilter(value),
};
return (
<div>
<h4 style={{ textAlign: "left" }}>{group.title}</h4>
Expand All @@ -81,11 +87,13 @@ const content = {
group.defaultValue ||
group.items[0].value,
onValueChange: (value) => {
setGlobalTagFilter(null);
const newTabs = { ...activeTabs };
newTabs[groupName] = value;
setActiveTabs(newTabs);
},
items: group.items,
contentProps,
}}
/>
</div>
Expand All @@ -112,6 +120,7 @@ const renderContent = () => {
};

const handleMenuClick = (value) => {
setGlobalTagFilter(null);
setActiveGroup(value);
};

Expand Down Expand Up @@ -148,11 +157,11 @@ const handleTagClick = (tag) => {
return;
}
Storage.set("global-tag-filter", [tag.tag]);
setGlobalTagFilter([tag.tag]);
setGlobalTagFilter([tag]);
setActiveTabs((prev) => {
return { ...prev, [category]: subType };
});
handleMenuClick(category);
setActiveGroup(category);
};
return (
<div className="gateway-page-container">
Expand All @@ -167,7 +176,11 @@ return (
additionalContent: (
<Widget
src="${REPL_ACCOUNT}/widget/Entities.Template.Forms.TagCloud"
props={{ namespace: "near", onSelect: handleTagClick }}
props={{
namespace: "near",
onSelect: handleTagClick,
initialTags: globalTagFilter,
}}
/>
),
}}
Expand Down
Loading

0 comments on commit 1347607

Please sign in to comment.