From 2a30e8a6e5e7e70cdae7df21562e38b5bdf394f8 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 15 Sep 2020 03:18:21 -0700 Subject: [PATCH] show the special colors on the modeling page --- src/app/ModelingPage.js | 106 +++++++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 22 deletions(-) diff --git a/src/app/ModelingPage.js b/src/app/ModelingPage.js index 6b11c49..1b71041 100644 --- a/src/app/ModelingPage.js +++ b/src/app/ModelingPage.js @@ -18,46 +18,76 @@ function ModelingPage() { return ( Modeling Hub - Item models we need - + ); } -function ItemModelsList() { +function ItemModelsSection() { const { loading, error, data } = useQuery(gql` query ModelingPage { - itemsThatNeedModels { - id - name - thumbnailUrl + standardItems: itemsThatNeedModels { + ...ItemFields speciesThatNeedModels { id name } } + babyItems: itemsThatNeedModels(colorId: "6") { + ...ItemFields + speciesThatNeedModels(colorId: "6") { + id + name + } + } + + maraquanItems: itemsThatNeedModels(colorId: "44") { + ...ItemFields + speciesThatNeedModels(colorId: "44") { + id + name + } + } + + mutantItems: itemsThatNeedModels(colorId: "46") { + ...ItemFields + speciesThatNeedModels(colorId: "46") { + id + name + } + } + currentUser { itemsTheyOwn { id } } } + + fragment ItemFields on Item { + id + name + thumbnailUrl + } `); if (loading) { return ( - - - - Checking all the items… + <> + Items we need modeled + + + + Checking all the items… + - + ); } @@ -65,15 +95,47 @@ function ItemModelsList() { 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 we need modeled + + + Items we need modeled on Baby pets + + + + Items we need modeled on Maraquan pets + + + Items we need modeled on Mutant pets + + + ); +} + +function ItemModelsColorSection({ items, ownedItemIds }) { + items = items + // enough MMEs are broken that I just don't want to deal right now! + // TODO: solve this with our new database omission feature instead? + .filter((item) => !item.name.includes("MME")) + .sort((a, b) => a.name.localeCompare(b.name)); + return ( {items.map((item) => (