Skip to content

Commit e2827f5

Browse files
committed
fix(web): pull description and details straight form offchain metadata
1 parent 39e4e2f commit e2827f5

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

web/src/pages/Auction/Auction.component.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ function AuctionComponent(props: AuctionProps) {
4747
const allbids = props.allBids.slice(0).reverse();
4848
const [bidError, setBidError] = useState<string>("");
4949
const [image, setImage] = useState<string>('');
50+
const [description, setDescription] = useState<string>('');
51+
const [attributes, setAttributes] = useState<any[]>([]);
5052

5153
const yourBids = allbids
5254
.filter(
@@ -311,10 +313,22 @@ function AuctionComponent(props: AuctionProps) {
311313
} else {
312314
setImage(tokenData!?.uri)
313315
}
316+
if (val.data.description) {
317+
setDescription(val.data.description)
318+
} else {
319+
setDescription(tokenData!?.description)
320+
}
321+
if (val.data.attributes) {
322+
setAttributes(val.data.attributes)
323+
} else {
324+
setAttributes(nftProperties)
325+
}
314326
})
315327
.catch(_ => {
316328
setImage(tokenData!?.uri)
317329
});
330+
331+
318332

319333
}, [tokenData]);
320334

@@ -355,7 +369,7 @@ function AuctionComponent(props: AuctionProps) {
355369
Description
356370
</h3>
357371
<p className="w-full text-paragraph font-medium leading-4 mt-3">
358-
{tokenData?.description}
372+
{description}
359373
</p>
360374
</div>
361375
<div className="hidden md:block mt-[4.3rem] w-full max-w-[421px] border-solid border-[1px] rounded-lg border-outline bg-white pb-14">
@@ -367,9 +381,9 @@ function AuctionComponent(props: AuctionProps) {
367381
<div className="flex justify-between px-6">
368382
<div className="flex justify-between w-full">
369383
<div className="flex flex-col w-full mt-6 gap-4">
370-
{nftProperties.map(({ label, value }) => (
384+
{attributes.map(({ label, trait_type, value }) => (
371385
<div className="flex justify-between" key={value}>
372-
<p className="font-medium text-black text-md">{label}</p>
386+
<p className="font-medium text-black text-md">{label || trait_type}</p>
373387
<p className="font-bold text-black text-end text-md max-w-[10ch] truncate">
374388
{value}
375389
</p>

0 commit comments

Comments
 (0)