From fce51875d939034e0d4d405a17d18a96f7cc99b2 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 1 Aug 2020 22:54:30 -0700 Subject: [PATCH] add SWF to layer assets in Support tools --- .../WardrobePage/support/ItemLayerSupportModal.js | 11 ++++++++++- src/app/components/useOutfitAppearance.js | 1 + src/server/index.js | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/app/WardrobePage/support/ItemLayerSupportModal.js b/src/app/WardrobePage/support/ItemLayerSupportModal.js index b635985..15021e2 100644 --- a/src/app/WardrobePage/support/ItemLayerSupportModal.js +++ b/src/app/WardrobePage/support/ItemLayerSupportModal.js @@ -21,7 +21,7 @@ import { Spinner, useToast, } from "@chakra-ui/core"; -import { ExternalLinkIcon } from "@chakra-ui/icons"; +import { ChevronRightIcon, ExternalLinkIcon } from "@chakra-ui/icons"; import { OutfitLayers } from "../../components/OutfitPreview"; import SpeciesColorPicker from "../../components/SpeciesColorPicker"; @@ -166,6 +166,15 @@ function ItemLayerSupportModal({ No PNG )} + diff --git a/src/app/components/useOutfitAppearance.js b/src/app/components/useOutfitAppearance.js index 1cbf1e7..723566a 100644 --- a/src/app/components/useOutfitAppearance.js +++ b/src/app/components/useOutfitAppearance.js @@ -120,6 +120,7 @@ export const itemAppearanceFragment = gql` id svgUrl imageUrl(size: SIZE_600) + swfUrl # HACK: This is for Support tools, but other views don't need it bodyId zone { id diff --git a/src/server/index.js b/src/server/index.js index 8c859e2..7862ba4 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -105,6 +105,15 @@ const typeDefs = gql` """ svgUrl: String + """ + This layer as a single SWF, if available. + + At time of writing, all layers have SWFs. But I've marked this nullable + because I'm not sure this will continue to be true after the HTML5 + migration, and I'd like clients to guard against it. + """ + swfUrl: String + """ This layer can fit on PetAppearances with the same bodyId. "0" is a special body ID that indicates it fits all PetAppearances. @@ -308,6 +317,10 @@ const resolvers = { const zone = await zoneLoader.load(layer.zoneId); return zone; }, + swfUrl: async ({ id }, _, { swfAssetLoader }) => { + const layer = await swfAssetLoader.load(id); + return layer.url; + }, imageUrl: async ({ id }, { size }, { swfAssetLoader }) => { const layer = await swfAssetLoader.load(id);