From 2a5ecb688a3c958d544e3349929be91f168081fc Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 11 Jul 2021 18:16:57 -0700 Subject: [PATCH] Improve homepage modeling loading state Add a skeleton stripe for the modeling data! Won't show up in most cases because we load fast, but it helps things a lot when it does. (Also, will we keep loading fast with the cache changes on this query?) --- src/app/HomePage.js | 41 ++++++++++++++++------------ src/app/components/SquareItemCard.js | 6 +++- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/src/app/HomePage.js b/src/app/HomePage.js index 43f2186..67888b9 100644 --- a/src/app/HomePage.js +++ b/src/app/HomePage.js @@ -4,6 +4,7 @@ import gql from "graphql-tag"; import { Box, Button, + Center, Flex, HStack, IconButton, @@ -13,6 +14,7 @@ import { InputRightElement, Link, ListItem, + Skeleton, Textarea, UnorderedList, useColorModeValue, @@ -406,7 +408,11 @@ function NewItemsSectionContent() { ); if (loading) { - const footer = ; + const footer = ( +
+ +
+ ); return ( @@ -456,28 +462,29 @@ function NewItemsSectionContent() { 0 ? ( - - Need {item.speciesThatNeedModels.length}1 models - - ) : ( - - Fully modeled! - - ) - } + footer={} /> ))} ); } +function ItemModelingSummary({ item }) { + if (item.speciesThatNeedModels.length > 0) { + return ( + + Need {item.speciesThatNeedModels.length}1 models + + ); + } + + return ( + + Fully modeled! + + ); +} + function ItemCardHStack({ children }) { return ( // HACK: I wanted to just have an HStack with overflow:auto and internal diff --git a/src/app/components/SquareItemCard.js b/src/app/components/SquareItemCard.js index 56aa209..dd7c586 100644 --- a/src/app/components/SquareItemCard.js +++ b/src/app/components/SquareItemCard.js @@ -126,7 +126,11 @@ function SquareItemCardLayout({ > {name} - {footer && {footer}} + {footer && ( + + {footer} + + )} )}