From 2eb1c9b7808d57630f8a697fa5df7758d3eb044b Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 31 Jul 2020 22:31:28 -0700 Subject: [PATCH] show the actual manual special color in support UI --- .../WardrobePage/support/ItemSupportDrawer.js | 30 ++++++++++++------ src/server/index.js | 14 +++++++++ src/server/query-tests/Item.test.js | 19 ++++++++++-- .../__snapshots__/Item.test.js.snap | 31 +++++++++++++++++++ 4 files changed, 82 insertions(+), 12 deletions(-) diff --git a/src/app/WardrobePage/support/ItemSupportDrawer.js b/src/app/WardrobePage/support/ItemSupportDrawer.js index eb7cab3..6c65ce2 100644 --- a/src/app/WardrobePage/support/ItemSupportDrawer.js +++ b/src/app/WardrobePage/support/ItemSupportDrawer.js @@ -71,15 +71,24 @@ function ItemSupportDrawer({ item, isOpen, onClose }) { } function SpecialColorFields({ item }) { - const { loading, error, data } = useQuery(gql` - query ItemSupportDrawer { - allColors { - id - name - isStandard + const { loading, error, data } = useQuery( + gql` + query ItemSupportDrawerSpecialColorFields($itemId: ID!) { + allColors { + id + name + isStandard + } + + item(id: $itemId) { + manualSpecialColor { + id + } + } } - } - `); + `, + { variables: { itemId: item.id } } + ); const nonStandardColors = data?.allColors?.filter((c) => !c.isStandard) || []; nonStandardColors.sort((a, b) => a.name.localeCompare(b.name)); @@ -88,8 +97,11 @@ function SpecialColorFields({ item }) { Special color