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";
import HangerSpinner from "./components/HangerSpinner";
import { Heading1, Heading2 } from "./util";
import ItemSummary, { ItemSummaryBadgeList } from "./components/ItemSummary";
function ModelingPage() {
return (
Modeling Hub
Item models we need
);
}
function ItemModelsList() {
const { loading, error, data } = useQuery(gql`
query ModelingPage {
itemsThatNeedModels {
id
name
thumbnailUrl
speciesThatNeedModels {
id
name
}
}
currentUser {
itemsTheyOwn {
id
}
}
}
`);
if (loading) {
return (
);
}
if (error) {
return {error.message};
}
const items = data.itemsThatNeedModels
// enough MMEs are broken that I just don't want to deal right now!
.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, currentUserOwnsItem, ...props }) {
return (
}
/>
);
}
function ItemModelBadges({ item, currentUserOwnsItem }) {
return (
{currentUserOwnsItem && (
You own this!
)}
{item.speciesThatNeedModels.map((species) => (
{species.name}
))}
);
}
export default ModelingPage;