From e4c8031c3bfde19a242ecc52f55fbde5048e2b6b Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 15 Mar 2021 07:50:13 -0700 Subject: [PATCH] Show previews for bulk-add layer tool --- .../support/AllItemLayersSupportModal.js | 220 +++++++++++++----- src/app/components/useOutfitAppearance.js | 31 ++- src/server/types/AppearanceLayer.js | 15 ++ src/server/types/PetAppearance.js | 38 +++ 4 files changed, 241 insertions(+), 63 deletions(-) diff --git a/src/app/WardrobePage/support/AllItemLayersSupportModal.js b/src/app/WardrobePage/support/AllItemLayersSupportModal.js index 38ce452..bfd7500 100644 --- a/src/app/WardrobePage/support/AllItemLayersSupportModal.js +++ b/src/app/WardrobePage/support/AllItemLayersSupportModal.js @@ -11,13 +11,13 @@ import { ModalContent, ModalHeader, ModalOverlay, - Select, Tooltip, Wrap, WrapItem, } from "@chakra-ui/react"; import { gql, useQuery } from "@apollo/client"; import { + appearanceLayerFragment, itemAppearanceFragment, petAppearanceFragment, } from "../../components/useOutfitAppearance"; @@ -25,7 +25,6 @@ import HangerSpinner from "../../components/HangerSpinner"; import { ErrorMessage, useCommonStyles } from "../../util"; import ItemSupportAppearanceLayer from "./ItemSupportAppearanceLayer"; import { EditIcon } from "@chakra-ui/icons"; -import cachedZones from "../../cached-data/zones.json"; function AllItemLayersSupportModal({ item, isOpen, onClose }) { const [bulkAddProposal, setBulkAddProposal] = React.useState(null); @@ -46,19 +45,15 @@ function AllItemLayersSupportModal({ item, isOpen, onClose }) { - + - {bulkAddProposal ? ( - <> - TODO: Show assets {bulkAddProposal.minAssetId}– - {Number(bulkAddProposal.minAssetId) + 53}, tenatively applied to - zone {bulkAddProposal.zoneId} - - ) : ( - "" - )} - - + @@ -66,14 +61,11 @@ function AllItemLayersSupportModal({ item, isOpen, onClose }) { ); } -function BulkAddBodySpecificAssetsForm({ onSubmit }) { - const zones = [...cachedZones].sort((a, b) => - `${a.label}-${a.id}`.localeCompare(`${b.label}-${b.id}`) +function BulkAddBodySpecificAssetsForm({ bulkAddProposal, onSubmit }) { + const [minAssetId, setMinAssetId] = React.useState( + bulkAddProposal?.minAssetId ); - const [minAssetId, setMinAssetId] = React.useState(null); - const [zoneId, setZoneId] = React.useState(zones[0].id); - return ( { e.preventDefault(); - onSubmit({ minAssetId, zoneId }); + onSubmit({ minAssetId }); }} > - setMinAssetId(e.target.value ? Number(e.target.value) - 53 : null) + setMinAssetId(e.target.value ? Number(e.target.value) - 54 : null) } /> - - , assigned to - -