From 68e6e9e24307b7baa238bd3980ce08e909805d97 Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 9 Nov 2020 06:26:29 -0800 Subject: [PATCH] add real offering/seeking counts to item page --- src/app/ItemPage.js | 52 ++++++++++++++++++++++++++++++++-------- src/server/loaders.js | 51 +++++++++++++++++++++++++++++++++++++++ src/server/types/Item.js | 19 +++++++++++++++ 3 files changed, 112 insertions(+), 10 deletions(-) diff --git a/src/app/ItemPage.js b/src/app/ItemPage.js index e664f2f..49ab29e 100644 --- a/src/app/ItemPage.js +++ b/src/app/ItemPage.js @@ -552,22 +552,54 @@ function ItemPageWantButton({ itemId, isChecked }) { } function ItemPageTradeLinks({ itemId }) { + const { data, loading, error } = useQuery( + gql` + query ItemPageTradeLinks($itemId: ID!) { + item(id: $itemId) { + id + numUsersOfferingThis + numUsersSeekingThis + } + } + `, + { variables: { itemId } } + ); + + if (error) { + return {error.message}; + } + return ( - - - - Trading: - - - - - + + + Trading: + + + + + + + + ); } -function ItemPageTradeLink({ count, label, colorScheme }) { +function ItemPageTradeLink({ itemId, count, label, colorScheme }) { return (