diff --git a/src/app/ModelingPage.js b/src/app/ModelingPage.js index 10d09d1..710c329 100644 --- a/src/app/ModelingPage.js +++ b/src/app/ModelingPage.js @@ -1,5 +1,6 @@ import React from "react"; import { Badge, Box, SimpleGrid } from "@chakra-ui/core"; +import { StarIcon } from "@chakra-ui/icons"; import gql from "graphql-tag"; import { useQuery } from "@apollo/client"; @@ -29,6 +30,12 @@ function ItemModelsList() { name } } + + currentUser { + itemsTheyOwn { + id + } + } } `); @@ -49,16 +56,24 @@ function ItemModelsList() { .filter((item) => !item.name.includes("MME")) .sort((a, b) => a.name.localeCompare(b.name)); + const ownedItemIds = new Set( + data.currentUser?.itemsTheyOwn?.map((item) => item.id) + ); + return ( {items.map((item) => ( - + ))} ); } -function ItemModelCard({ item, ...props }) { +function ItemModelCard({ item, currentUserOwnsItem, ...props }) { return ( - } /> + + } + /> ); } -function ItemModelBadges({ item }) { +function ItemModelBadges({ item, currentUserOwnsItem }) { return ( + {currentUserOwnsItem && ( + + + You own this! + + )} {item.speciesThatNeedModels.map((species) => ( {species.name} ))}