diff --git a/src/app/WardrobePage/WardrobePageLayout.js b/src/app/WardrobePage/WardrobePageLayout.js index ad528a9..65523ba 100644 --- a/src/app/WardrobePage/WardrobePageLayout.js +++ b/src/app/WardrobePage/WardrobePageLayout.js @@ -1,7 +1,7 @@ import React from "react"; import { Box, Grid, useColorModeValue } from "@chakra-ui/react"; -function WardrobePageLayout({ preview, controls, itemsAndSearch }) { +function WardrobePageLayout({ previewAndControls, itemsAndSearch }) { const itemsAndSearchBackground = useColorModeValue("white", "gray.900"); return ( @@ -32,13 +32,8 @@ function WardrobePageLayout({ preview, controls, itemsAndSearch }) { height="100%" width="100%" > - - - {preview} - - - {controls} - + + {previewAndControls} {itemsAndSearch} diff --git a/src/app/WardrobePage/WardrobeOutfitPreview.js b/src/app/WardrobePage/WardrobePreviewAndControls.js similarity index 60% rename from src/app/WardrobePage/WardrobeOutfitPreview.js rename to src/app/WardrobePage/WardrobePreviewAndControls.js index 5b1b36c..c0f27da 100644 --- a/src/app/WardrobePage/WardrobeOutfitPreview.js +++ b/src/app/WardrobePage/WardrobePreviewAndControls.js @@ -1,4 +1,5 @@ import React from "react"; +import { Box, DarkMode } from "@chakra-ui/react"; import gql from "graphql-tag"; import { useQuery } from "@apollo/client"; @@ -7,26 +8,43 @@ import OutfitThumbnail, { getOutfitThumbnailRenderSize, } from "../components/OutfitThumbnail"; import OutfitPreview from "../components/OutfitPreview"; -import { DarkMode } from "@chakra-ui/react"; +import { loadable } from "../util"; -function WardrobeOutfitPreview({ +const OutfitControls = loadable(() => import("./OutfitControls")); + +function WardrobePreviewAndControls({ isLoading, outfitState, - onChangeHasAnimations, + dispatchToOutfit, }) { + // Whether the current outfit preview has animations. Determines whether we + // show the play/pause button. + const [hasAnimations, setHasAnimations] = React.useState(false); + return ( - - } - /> - + <> + + + } + /> + + + + + + ); } @@ -83,4 +101,4 @@ function OutfitThumbnailIfCached({ outfitId }) { ); } -export default WardrobeOutfitPreview; +export default WardrobePreviewAndControls; diff --git a/src/app/WardrobePage/index.js b/src/app/WardrobePage/index.js index d2ed12d..0a6f3ac 100644 --- a/src/app/WardrobePage/index.js +++ b/src/app/WardrobePage/index.js @@ -7,11 +7,8 @@ import SupportOnly from "./support/SupportOnly"; import useOutfitState, { OutfitStateContext } from "./useOutfitState"; import { usePageTitle } from "../util"; import WardrobePageLayout from "./WardrobePageLayout"; -import WardrobeOutfitPreview from "./WardrobeOutfitPreview"; +import WardrobePreviewAndControls from "./WardrobePreviewAndControls"; -const OutfitControls = loadable(() => - import(/* webpackPreload: true */ "./OutfitControls") -); const WardrobeDevHacks = loadable(() => import("./WardrobeDevHacks")); /** @@ -29,10 +26,6 @@ function WardrobePage() { const toast = useToast(); const { loading, error, outfitState, dispatchToOutfit } = useOutfitState(); - // Whether the current outfit preview has animations. Determines whether we - // show the play/pause button. - const [hasAnimations, setHasAnimations] = React.useState(false); - usePageTitle(outfitState.name || "Untitled outfit"); // TODO: I haven't found a great place for this error UI yet, and this case @@ -60,18 +53,11 @@ function WardrobePage() { - } - controls={ - } itemsAndSearch={