Skip to content

Commit

Permalink
Merge pull request #6 from NEARBuilders/fix/cleanup
Browse files Browse the repository at this point in the history
Modify Team Members logic to include the poster
  • Loading branch information
elliotBraem authored Feb 21, 2024
2 parents 4716979 + 03edb5f commit 29e3f2d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions apps/buildbox/widget/page/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ function isNearAddress(address) {

function Team({ members }) {
if (members) {
console.log("members: ", members);
// removing extra characters and splitting the string into an array
const arr = members.replace(/[\[\]\(\)@]/g, "").split(/[\s,]+/);

Expand All @@ -221,7 +220,20 @@ function Team({ members }) {
return isNearAddress(teammate);
});

return valid.map((teammate) => (
const extractNearAddress = (id) => {
const parts = id.split("/");
if (parts.length > 0) {
return parts[0];
}
return "";
};

valid.unshift(extractNearAddress(id));

// making sure the array is unique
const unique = [...new Set(valid)];

return unique.map((teammate) => (
<User accountId={teammate} variant={"mobile"} />
));
} else {
Expand Down

0 comments on commit 29e3f2d

Please sign in to comment.