Skip to content

Commit

Permalink
Added special color borders for tokens and collections
Browse files Browse the repository at this point in the history
  • Loading branch information
macterra committed Oct 19, 2023
1 parent 1168f93 commit a67d937
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion frontend/src/CollectionCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const CollectionCard = ({ collection }) => {
justifyContent: 'center',
overflow: 'hidden',
position: 'relative',
border: collection.published ? '1px solid #0f0' : '1px solid #ccc', // Green border if collection contains tokens
border: collection.sold ? '1px solid #0ff' : collection.published ? '1px solid #0f0' : '1px solid #ccc',
borderRadius: '4px',
padding: '8px',
};
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/ImageCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const ImageCard = ({ metadata }) => {
justifyContent: 'center',
overflow: 'hidden',
position: 'relative',
border: metadata.token ? '1px solid #0f0' : '1px solid #ccc', // Conditionally set the border color
borderRadius: '4px', // Add a border radius
padding: '8px', // Add padding
border: metadata.sold ? '1px solid #0ff' : metadata.token ? '1px solid #0f0' : '1px solid #ccc',
borderRadius: '4px',
padding: '8px',
};

const imgContainerStyle = {
Expand Down
23 changes: 22 additions & 1 deletion xidb.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,10 @@ const getAgentAndCollections = (profileId, userId) => {

if (assetData.token) {
collections[assetData.asset.collection].published = true;

if (assetData.sold) {
collections[assetData.asset.collection].sold = true;
}
}
} else {
deleted.push(assetData);
Expand All @@ -729,6 +733,10 @@ const getAgentAndCollections = (profileId, userId) => {
if (assetData.asset.collection in collections) {
collections[assetData.asset.collection].collection.assets.push(assetData);
collections[assetData.asset.collection].published = true;

if (assetData.sold) {
collections[assetData.asset.collection].sold = true;
}
}
}
}
Expand Down Expand Up @@ -946,7 +954,20 @@ const getAsset = (xid) => {
const metadataPath = path.join(config.assets, xid, 'meta.json');
const metadataContent = fs.readFileSync(metadataPath, 'utf-8');
metadata = JSON.parse(metadataContent);
metadata.history = getHistory(xid);

if (metadata.token) {
metadata.history = getHistory(xid);

const owners = new Set([metadata.asset.owner]);

for (const nftId of metadata.token.nfts) {
const nft = getAsset(nftId);
owners.add(nft.asset.owner);
}

metadata.owners = owners.size;
metadata.sold = owners.size > 1;
}
} catch (error) {
}

Expand Down

0 comments on commit a67d937

Please sign in to comment.