From 048fb29c144c383f9b3e78abf2af58131d2f1718 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 12 Feb 2021 14:35:14 -0800 Subject: [PATCH] Refactor item page preview to grid layout because I wanna add zones to the area below the faces! --- src/app/ItemPage.js | 238 ++++++++++++++++++++++++-------------------- 1 file changed, 132 insertions(+), 106 deletions(-) diff --git a/src/app/ItemPage.js b/src/app/ItemPage.js index ac41dfb..7205d13 100644 --- a/src/app/ItemPage.js +++ b/src/app/ItemPage.js @@ -20,6 +20,7 @@ import { WrapItem, Flex, usePrefersReducedMotion, + Grid, } from "@chakra-ui/react"; import { CheckIcon, @@ -681,108 +682,130 @@ function ItemPageOutfitPreview({ itemId }) { } return ( - - - - - {petState.isValid && preview} - - {hasAnimations && ( - setIsPaused(!isPaused)} - /> - )} - - - - - - - + + {petState.isValid && preview} + { - setPetStateFromUserAction({ - speciesId: species.id, - colorId: color.id, - pose: closestPose, - isValid, - appearanceId: null, - }); - }} - speciesIsDisabled={isProbablySpeciesSpecific} - size="sm" - showPlaceholders + itemId={itemId} + isDisabled={!petState.isValid} /> - - { - // Wait for us to start _requesting_ the appearance, and _then_ - // for it to load, and _then_ check compatibility. - !loadingGQL && - !appearance.loading && - petState.isValid && - !isCompatible && ( - - - - ) - } - + {hasAnimations && ( + setIsPaused(!isPaused)} + /> + )} - - + + + + + + { + setPetStateFromUserAction({ + speciesId: species.id, + colorId: color.id, + pose: closestPose, + isValid, + appearanceId: null, + }); + }} + speciesIsDisabled={isProbablySpeciesSpecific} + size="sm" + showPlaceholders + /> + + { + // Wait for us to start _requesting_ the appearance, and _then_ + // for it to load, and _then_ check compatibility. + !loadingGQL && + !appearance.loading && + petState.isValid && + !isCompatible && ( + + + + ) + } + + + - + + + + ); } @@ -983,15 +1009,7 @@ function SpeciesFacesPicker({ return ( - + {allSpeciesFaces.map((speciesFace) => ( + {/* TODO */} + + ); +} + /** * CrossFadeImage is like , but listens for successful load events, and * fades from the previous image to the new image once it loads.