Keep outfit thumbnail while individual layers load
This commit is contained in:
parent
9ae1704908
commit
62579dc671
2 changed files with 23 additions and 3 deletions
|
@ -22,7 +22,7 @@ function WardrobeOutfitPreview({
|
||||||
appearanceId={outfitState.appearanceId}
|
appearanceId={outfitState.appearanceId}
|
||||||
wornItemIds={outfitState.wornItemIds}
|
wornItemIds={outfitState.wornItemIds}
|
||||||
onChangeHasAnimations={onChangeHasAnimations}
|
onChangeHasAnimations={onChangeHasAnimations}
|
||||||
placeholder={<OutfitThumbnailIfCached outfitId={outfitState.id} />}
|
backdrop={<OutfitThumbnailIfCached outfitId={outfitState.id} />}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,11 @@ function WardrobeOutfitPreview({
|
||||||
* outfit thumbnail instantly while everything else loads. But on direct
|
* outfit thumbnail instantly while everything else loads. But on direct
|
||||||
* navigation, this does nothing, and we just wait for the preview to load in
|
* navigation, this does nothing, and we just wait for the preview to load in
|
||||||
* like usual!
|
* like usual!
|
||||||
|
*
|
||||||
|
* We even use it as our "backdrop", so the thumbnail actually _always_ renders
|
||||||
|
* if possible. This makes loading look even smoother, by letting individual
|
||||||
|
* layers load in on top of the thumbnail.
|
||||||
|
* TODO: Can this become a perf problem on WIP outfits?
|
||||||
*/
|
*/
|
||||||
function OutfitThumbnailIfCached({ outfitId }) {
|
function OutfitThumbnailIfCached({ outfitId }) {
|
||||||
const { data } = useQuery(
|
const { data } = useQuery(
|
||||||
|
|
|
@ -35,7 +35,8 @@ function OutfitPreview({
|
||||||
wornItemIds,
|
wornItemIds,
|
||||||
appearanceId = null,
|
appearanceId = null,
|
||||||
isLoading = false,
|
isLoading = false,
|
||||||
placeholder,
|
placeholder = null,
|
||||||
|
backdrop = null,
|
||||||
loadingDelayMs,
|
loadingDelayMs,
|
||||||
spinnerVariant,
|
spinnerVariant,
|
||||||
onChangeHasAnimations = null,
|
onChangeHasAnimations = null,
|
||||||
|
@ -80,6 +81,7 @@ function OutfitPreview({
|
||||||
loading={isLoading || loading || loading2}
|
loading={isLoading || loading || loading2}
|
||||||
visibleLayers={loadedLayers}
|
visibleLayers={loadedLayers}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
|
backdrop={backdrop}
|
||||||
loadingDelayMs={loadingDelayMs}
|
loadingDelayMs={loadingDelayMs}
|
||||||
spinnerVariant={spinnerVariant}
|
spinnerVariant={spinnerVariant}
|
||||||
onChangeHasAnimations={onChangeHasAnimations}
|
onChangeHasAnimations={onChangeHasAnimations}
|
||||||
|
@ -96,7 +98,8 @@ function OutfitPreview({
|
||||||
export function OutfitLayers({
|
export function OutfitLayers({
|
||||||
loading,
|
loading,
|
||||||
visibleLayers,
|
visibleLayers,
|
||||||
placeholder,
|
placeholder = null,
|
||||||
|
backdrop = null,
|
||||||
loadingDelayMs = 500,
|
loadingDelayMs = 500,
|
||||||
spinnerVariant = "overlay",
|
spinnerVariant = "overlay",
|
||||||
doTransitions = false,
|
doTransitions = false,
|
||||||
|
@ -158,6 +161,18 @@ export function OutfitLayers({
|
||||||
zIndex="0"
|
zIndex="0"
|
||||||
ref={containerRef}
|
ref={containerRef}
|
||||||
>
|
>
|
||||||
|
{backdrop && (
|
||||||
|
<FullScreenCenter>
|
||||||
|
<Box
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
maxWidth="600px"
|
||||||
|
maxHeight="600px"
|
||||||
|
>
|
||||||
|
{backdrop}
|
||||||
|
</Box>
|
||||||
|
</FullScreenCenter>
|
||||||
|
)}
|
||||||
{placeholder && (
|
{placeholder && (
|
||||||
<FullScreenCenter>
|
<FullScreenCenter>
|
||||||
<Box
|
<Box
|
||||||
|
|
Loading…
Reference in a new issue