-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a558249
commit a76bb78
Showing
15 changed files
with
950 additions
and
706 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
const convertSnakeToPascal = (item) => { | ||
const newItems = {}; | ||
Object.keys(item).forEach((key) => { | ||
const newItems = {}; | ||
Object.keys(item).forEach((key) => { | ||
const pascalKey = key.replace(/(_\w)/g, (m) => m[1].toUpperCase()); | ||
newItems[pascalKey] = item[key]; | ||
}); | ||
return newItems; | ||
}; | ||
const renderItem = (item, editFunction) => { | ||
const flatItem = {...item, ...item.attributes}; | ||
const flatItem = { ...item, ...item.attributes }; | ||
delete flatItem.attributes; | ||
return ( | ||
<Widget | ||
src="${REPL_AGIGUILD}/widget/Agent.AgentCard" | ||
props={{ | ||
item: convertSnakeToPascal(flatItem), | ||
editFunction, | ||
namespace: 'near', | ||
entityType: 'agent', | ||
namespace: "near", | ||
entityType: "agent", | ||
schemaFile: "${REPL_AGIGUILD}/widget/Schema.Agent", | ||
}} | ||
/> | ||
); | ||
}; | ||
return ( | ||
<Widget src="${REPL_ACCOUNT}/widget/Entities.Template.GenericEntityConfig" | ||
props={{namespace: 'near', entityType: 'agent', title: 'Agent', | ||
schemaFile: "${REPL_AGIGUILD}/widget/Schema.Agent", | ||
renderItem, | ||
}}/> | ||
) | ||
<Widget | ||
src="${REPL_ACCOUNT}/widget/Entities.Template.GenericEntityConfig" | ||
props={{ | ||
namespace: "near", | ||
entityType: "agent", | ||
title: "Agent", | ||
schemaFile: "${REPL_AGIGUILD}/widget/Schema.Agent", | ||
renderItem, | ||
}} | ||
/> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.