You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor collection item rendering in Collection tab
Extracted repeated artifact and mineral rendering logic into a reusable createCollectionItem function for improved readability and maintainability. Also updated useEffect dependency to run only once on mount.
`You haven't delivered ${item.name} to the museum` :
38
+
`You haven't found ${item.name} yet`
39
+
}
40
+
/>
41
+
</a>
42
+
);
43
+
};
44
+
27
45
useEffect(()=>{
28
46
getTotalFound();
29
-
},[museumCollection]);
47
+
},[]);
30
48
31
49
return(
32
50
<divclassName="progress-container">
33
-
<spanclassName="a-title"><h1>{`You've found ${totalFound} objects and delivered ${totalDelivered} / ${total} to the museum`}</h1></span>
51
+
<spanclassName="a-title">
52
+
<h1>{`You've found ${totalFound} objects and delivered ${totalDelivered} / ${total} to the museum`}</h1>
53
+
</span>
34
54
<br/>
35
55
<br/>
36
56
<h2>Museum Achievements</h2>
37
57
<ulclassName="a-List">
38
-
<li>A Complete Collection: {(total===totalDelivered) ? <spanclassName="completed">You have this achievement</span> : <spanclassName="pending">You need to deliver {total-totalDelivered} more items to get this achievement.</span>}</li>
0 commit comments