load special colors into support UI

This commit is contained in:
Emi Matchu 2020-07-31 22:11:32 -07:00
parent b310f2334d
commit f747bfb004
9 changed files with 560 additions and 258 deletions

View file

@ -57,7 +57,7 @@ export function Item({ item, itemNameId, outfitState, dispatchToOutfit }) {
<SupportOnly> <SupportOnly>
<ItemActionButton <ItemActionButton
icon={<EditIcon />} icon={<EditIcon />}
label="Edit" label="Support"
onClick={() => setSupportDrawerIsOpen(true)} onClick={() => setSupportDrawerIsOpen(true)}
/> />
</SupportOnly> </SupportOnly>

View file

@ -1,4 +1,6 @@
import * as React from "react"; import * as React from "react";
import gql from "graphql-tag";
import { useQuery } from "@apollo/react-hooks";
import { import {
Badge, Badge,
Box, Box,
@ -9,10 +11,13 @@ import {
DrawerHeader, DrawerHeader,
DrawerOverlay, DrawerOverlay,
FormControl, FormControl,
FormErrorMessage,
FormHelperText, FormHelperText,
FormLabel, FormLabel,
Link, Link,
Select, Select,
Spinner,
useBreakpointValue,
} from "@chakra-ui/core"; } from "@chakra-ui/core";
import { ExternalLinkIcon } from "@chakra-ui/icons"; import { ExternalLinkIcon } from "@chakra-ui/icons";
@ -23,9 +28,22 @@ import { ExternalLinkIcon } from "@chakra-ui/icons";
* from another lazy-loaded component! * from another lazy-loaded component!
*/ */
function ItemSupportDrawer({ item, isOpen, onClose }) { function ItemSupportDrawer({ item, isOpen, onClose }) {
const placement = useBreakpointValue({
base: "bottom",
lg: "right",
// TODO: There's a bug in the Chakra RC that doesn't read the breakpoint
// specification correctly - we need these extra keys until it's fixed!
// https://github.com/chakra-ui/chakra-ui/issues/1444
0: "bottom",
1: "bottom",
2: "right",
3: "right",
});
return ( return (
<Drawer <Drawer
placement="bottom" placement={placement}
isOpen={isOpen} isOpen={isOpen}
onClose={onClose} onClose={onClose}
// blockScrollOnMount doesn't matter on our fullscreen UI, but the // blockScrollOnMount doesn't matter on our fullscreen UI, but the
@ -37,7 +55,7 @@ function ItemSupportDrawer({ item, isOpen, onClose }) {
<DrawerCloseButton /> <DrawerCloseButton />
<DrawerHeader> <DrawerHeader>
{item.name} {item.name}
<Badge colorScheme="purple" marginLeft="3"> <Badge colorScheme="pink" marginLeft="3">
Support <span aria-hidden="true">💖</span> Support <span aria-hidden="true">💖</span>
</Badge> </Badge>
</DrawerHeader> </DrawerHeader>
@ -53,13 +71,34 @@ function ItemSupportDrawer({ item, isOpen, onClose }) {
} }
function SpecialColorFields({ item }) { function SpecialColorFields({ item }) {
const { loading, error, data } = useQuery(gql`
query ItemSupportDrawer {
allColors {
id
name
isStandard
}
}
`);
const nonStandardColors = data?.allColors?.filter((c) => !c.isStandard) || [];
nonStandardColors.sort((a, b) => a.name.localeCompare(b.name));
return ( return (
<FormControl> <FormControl isInvalid={error ? true : false}>
<FormLabel>Special color</FormLabel> <FormLabel>Special color</FormLabel>
<Select placeholder="Default: Auto-detect from item description"> <Select
<option>Mutant</option> placeholder="Default: Auto-detect from item description"
<option>Maraquan</option> icon={loading ? <Spinner /> : undefined}
>
{nonStandardColors.map((color) => (
<option key={color.id} value={color.id}>
{color.name}
</option>
))}
</Select> </Select>
{error && <FormErrorMessage>{error.message}</FormErrorMessage>}
{!error && (
<FormHelperText> <FormHelperText>
This controls which previews we show on the{" "} This controls which previews we show on the{" "}
<Link <Link
@ -73,6 +112,7 @@ function SpecialColorFields({ item }) {
</Link> </Link>
. .
</FormHelperText> </FormHelperText>
)}
</FormControl> </FormControl>
); );
} }

View file

@ -29,6 +29,7 @@ function SpeciesColorPicker({
allColors { allColors {
id id
name name
isStandard # Not used here, but helpful for caching!
} }
} }
`); `);

View file

@ -116,6 +116,7 @@ const typeDefs = gql`
type Color @cacheControl(maxAge: 604800) { type Color @cacheControl(maxAge: 604800) {
id: ID! id: ID!
name: String! name: String!
isStandard: Boolean!
} }
# Cache for 1 week (unlikely to change) # Cache for 1 week (unlikely to change)
@ -330,6 +331,10 @@ const resolvers = {
const colorTranslation = await colorTranslationLoader.load(id); const colorTranslation = await colorTranslationLoader.load(id);
return capitalize(colorTranslation.name); return capitalize(colorTranslation.name);
}, },
isStandard: async ({ id }, _, { colorLoader }) => {
const color = await colorLoader.load(id);
return color.standard ? true : false;
},
}, },
Species: { Species: {
name: async ({ id }, _, { speciesTranslationLoader }) => { name: async ({ id }, _, { speciesTranslationLoader }) => {
@ -360,8 +365,8 @@ const resolvers = {
}, },
}, },
Query: { Query: {
allColors: async (_, { ids }, { loadAllColors }) => { allColors: async (_, { ids }, { colorLoader }) => {
const allColors = await loadAllColors(); const allColors = await colorLoader.loadAll();
return allColors; return allColors;
}, },
allSpecies: async (_, { ids }, { loadAllSpecies }) => { allSpecies: async (_, { ids }, { loadAllSpecies }) => {
@ -430,6 +435,7 @@ const resolvers = {
colorId, colorId,
}); });
const petStates = await petStatesForPetTypeLoader.load(petType.id); const petStates = await petStatesForPetTypeLoader.load(petType.id);
petStates.sort((a, b) => a.id - b.id);
return petStates.map((petState) => ({ petStateId: petState.id })); return petStates.map((petState) => ({ petStateId: petState.id }));
}, },
outfit: (_, { id }) => ({ id }), outfit: (_, { id }) => ({ id }),

View file

@ -1,12 +1,38 @@
const DataLoader = require("dataloader"); const DataLoader = require("dataloader");
const { normalizeRow } = require("./util"); const { normalizeRow } = require("./util");
const loadAllColors = (db) => async () => { const buildColorLoader = (db) => {
const colorLoader = new DataLoader(async (colorIds) => {
const qs = colorIds.map((_) => "?").join(",");
const [rows, _] = await db.execute(
`SELECT * FROM colors WHERE id IN (${qs}) AND prank = 0`,
colorIds
);
const entities = rows.map(normalizeRow);
const entitiesByColorId = new Map(entities.map((e) => [e.id, e]));
return colorIds.map(
(colorId) =>
entitiesByColorId.get(String(colorId)) ||
new Error(`could not find color ${colorId}`)
);
});
colorLoader.loadAll = async () => {
const [rows, _] = await db.execute(`SELECT * FROM colors WHERE prank = 0`); const [rows, _] = await db.execute(`SELECT * FROM colors WHERE prank = 0`);
const entities = rows.map(normalizeRow); const entities = rows.map(normalizeRow);
for (const color of entities) {
colorLoader.prime(color.id, color);
}
return entities; return entities;
}; };
return colorLoader;
};
const buildColorTranslationLoader = (db) => const buildColorTranslationLoader = (db) =>
new DataLoader(async (colorIds) => { new DataLoader(async (colorIds) => {
const qs = colorIds.map((_) => "?").join(","); const qs = colorIds.map((_) => "?").join(",");
@ -22,7 +48,7 @@ const buildColorTranslationLoader = (db) =>
return colorIds.map( return colorIds.map(
(colorId) => (colorId) =>
entitiesByColorId.get(String(colorId)) || entitiesByColorId.get(String(colorId)) ||
new Error(`could not find translation for species ${colorId}`) new Error(`could not find translation for color ${colorId}`)
); );
}); });
@ -72,7 +98,8 @@ const buildItemLoader = (db) =>
return ids.map( return ids.map(
(id) => (id) =>
entitiesById.get(String(id)) || new Error(`could not find item with ID: ${id}`) entitiesById.get(String(id)) ||
new Error(`could not find item with ID: ${id}`)
); );
}); });
@ -347,10 +374,10 @@ const buildZoneTranslationLoader = (db) =>
function buildLoaders(db) { function buildLoaders(db) {
const loaders = {}; const loaders = {};
loaders.loadAllColors = loadAllColors(db);
loaders.loadAllSpecies = loadAllSpecies(db); loaders.loadAllSpecies = loadAllSpecies(db);
loaders.loadAllPetTypes = loadAllPetTypes(db); loaders.loadAllPetTypes = loadAllPetTypes(db);
loaders.colorLoader = buildColorLoader(db);
loaders.colorTranslationLoader = buildColorTranslationLoader(db); loaders.colorTranslationLoader = buildColorTranslationLoader(db);
loaders.itemLoader = buildItemLoader(db); loaders.itemLoader = buildItemLoader(db);
loaders.itemTranslationLoader = buildItemTranslationLoader(db); loaders.itemTranslationLoader = buildItemTranslationLoader(db);

View file

@ -9,6 +9,7 @@ describe("Color", () => {
allColors { allColors {
id id
name name
isStandard
} }
} }
`, `,

View file

@ -17,6 +17,7 @@ describe("PetAppearance", () => {
color { color {
id id
name name
isStandard
} }
layers { layers {
@ -43,14 +44,6 @@ describe("PetAppearance", () => {
"75", "75",
], ],
], ],
Array [
"SELECT * FROM pet_states
WHERE pet_type_id IN (?) AND glitched = 0
ORDER BY (mood_id = 1) DESC",
Array [
"2",
],
],
Array [ Array [
"SELECT sa.*, rel.parent_id FROM swf_assets sa "SELECT sa.*, rel.parent_id FROM swf_assets sa
INNER JOIN parents_swf_assets rel ON INNER JOIN parents_swf_assets rel ON
@ -75,6 +68,12 @@ describe("PetAppearance", () => {
"75", "75",
], ],
], ],
Array [
"SELECT * FROM colors WHERE id IN (?) AND prank = 0",
Array [
"75",
],
],
Array [ Array [
"SELECT * FROM zones WHERE id IN (?,?,?,?,?,?)", "SELECT * FROM zones WHERE id IN (?,?,?,?,?,?)",
Array [ Array [
@ -86,6 +85,14 @@ describe("PetAppearance", () => {
"34", "34",
], ],
], ],
Array [
"SELECT * FROM pet_states
WHERE pet_type_id IN (?) AND glitched = 0
ORDER BY (mood_id = 1) DESC",
Array [
"2",
],
],
] ]
`); `);
}); });
@ -133,6 +140,47 @@ describe("PetAppearance", () => {
"75", "75",
], ],
], ],
Array [
"SELECT sa.*, rel.parent_id FROM swf_assets sa
INNER JOIN parents_swf_assets rel ON
rel.parent_type = \\"PetState\\" AND
rel.swf_asset_id = sa.id
WHERE rel.parent_id IN (?)",
Array [
"17723",
],
],
Array [
"SELECT * FROM species_translations
WHERE species_id IN (?) AND locale = \\"en\\"",
Array [
"54",
],
],
Array [
"SELECT * FROM color_translations
WHERE color_id IN (?) AND locale = \\"en\\"",
Array [
"75",
],
],
Array [
"SELECT * FROM colors WHERE id IN (?) AND prank = 0",
Array [
"75",
],
],
Array [
"SELECT * FROM zones WHERE id IN (?,?,?,?,?,?)",
Array [
"15",
"5",
"37",
"30",
"33",
"34",
],
],
Array [ Array [
"SELECT * FROM pet_states "SELECT * FROM pet_states
WHERE pet_type_id IN (?) AND glitched = 0 WHERE pet_type_id IN (?) AND glitched = 0
@ -148,14 +196,14 @@ describe("PetAppearance", () => {
rel.swf_asset_id = sa.id rel.swf_asset_id = sa.id
WHERE rel.parent_id IN (?,?,?,?,?,?,?,?)", WHERE rel.parent_id IN (?,?,?,?,?,?,?,?)",
Array [ Array [
"17723", "2",
"17742", "436",
"4751",
"5991",
"10014", "10014",
"11089", "11089",
"5991", "17723",
"436", "17742",
"2",
"4751",
], ],
], ],
Array [ Array [

View file

@ -5,450 +5,562 @@ Object {
"allColors": Array [ "allColors": Array [
Object { Object {
"id": "1", "id": "1",
"isStandard": true,
"name": "Alien", "name": "Alien",
}, },
Object { Object {
"id": "2", "id": "2",
"isStandard": false,
"name": "Apple", "name": "Apple",
}, },
Object { Object {
"id": "3", "id": "3",
"isStandard": false,
"name": "Asparagus", "name": "Asparagus",
}, },
Object { Object {
"id": "4", "id": "4",
"isStandard": false,
"name": "Aubergine", "name": "Aubergine",
}, },
Object { Object {
"id": "5", "id": "5",
"isStandard": false,
"name": "Avocado", "name": "Avocado",
}, },
Object { Object {
"id": "6", "id": "6",
"isStandard": false,
"name": "Baby", "name": "Baby",
}, },
Object { Object {
"id": "7", "id": "7",
"isStandard": true,
"name": "Biscuit", "name": "Biscuit",
}, },
Object { Object {
"id": "8", "id": "8",
"isStandard": true,
"name": "Blue", "name": "Blue",
}, },
Object { Object {
"id": "9", "id": "9",
"isStandard": false,
"name": "Blueberry", "name": "Blueberry",
}, },
Object { Object {
"id": "10", "id": "10",
"isStandard": true,
"name": "Brown", "name": "Brown",
}, },
Object { Object {
"id": "11", "id": "11",
"isStandard": true,
"name": "Camouflage", "name": "Camouflage",
}, },
Object { Object {
"id": "12", "id": "12",
"isStandard": false,
"name": "Carrot", "name": "Carrot",
}, },
Object { Object {
"id": "13", "id": "13",
"isStandard": true,
"name": "Checkered", "name": "Checkered",
}, },
Object { Object {
"id": "14", "id": "14",
"isStandard": true,
"name": "Chocolate", "name": "Chocolate",
}, },
Object { Object {
"id": "15", "id": "15",
"isStandard": false,
"name": "Chokato", "name": "Chokato",
}, },
Object { Object {
"id": "16", "id": "16",
"isStandard": true,
"name": "Christmas", "name": "Christmas",
}, },
Object { Object {
"id": "17", "id": "17",
"isStandard": true,
"name": "Clay", "name": "Clay",
}, },
Object { Object {
"id": "18", "id": "18",
"isStandard": true,
"name": "Cloud", "name": "Cloud",
}, },
Object { Object {
"id": "19", "id": "19",
"isStandard": true,
"name": "Coconut", "name": "Coconut",
}, },
Object { Object {
"id": "20", "id": "20",
"isStandard": true,
"name": "Custard", "name": "Custard",
}, },
Object { Object {
"id": "21", "id": "21",
"isStandard": true,
"name": "Darigan", "name": "Darigan",
}, },
Object { Object {
"id": "22", "id": "22",
"isStandard": true,
"name": "Desert", "name": "Desert",
}, },
Object { Object {
"id": "23", "id": "23",
"isStandard": true,
"name": "Disco", "name": "Disco",
}, },
Object { Object {
"id": "24", "id": "24",
"isStandard": false,
"name": "Durian", "name": "Durian",
}, },
Object { Object {
"id": "25", "id": "25",
"isStandard": true,
"name": "Electric", "name": "Electric",
}, },
Object { Object {
"id": "26", "id": "26",
"isStandard": true,
"name": "Faerie", "name": "Faerie",
}, },
Object { Object {
"id": "27", "id": "27",
"isStandard": true,
"name": "Fire", "name": "Fire",
}, },
Object { Object {
"id": "28", "id": "28",
"isStandard": true,
"name": "Garlic", "name": "Garlic",
}, },
Object { Object {
"id": "29", "id": "29",
"isStandard": true,
"name": "Ghost", "name": "Ghost",
}, },
Object { Object {
"id": "30", "id": "30",
"isStandard": true,
"name": "Glowing", "name": "Glowing",
}, },
Object { Object {
"id": "31", "id": "31",
"isStandard": true,
"name": "Gold", "name": "Gold",
}, },
Object { Object {
"id": "32", "id": "32",
"isStandard": false,
"name": "Gooseberry", "name": "Gooseberry",
}, },
Object { Object {
"id": "33", "id": "33",
"isStandard": false,
"name": "Grape", "name": "Grape",
}, },
Object { Object {
"id": "34", "id": "34",
"isStandard": true,
"name": "Green", "name": "Green",
}, },
Object { Object {
"id": "35", "id": "35",
"isStandard": true,
"name": "Grey", "name": "Grey",
}, },
Object { Object {
"id": "36", "id": "36",
"isStandard": true,
"name": "Halloween", "name": "Halloween",
}, },
Object { Object {
"id": "37", "id": "37",
"isStandard": true,
"name": "Ice", "name": "Ice",
}, },
Object { Object {
"id": "38", "id": "38",
"isStandard": true,
"name": "Invisible", "name": "Invisible",
}, },
Object { Object {
"id": "39", "id": "39",
"isStandard": true,
"name": "Island", "name": "Island",
}, },
Object { Object {
"id": "40", "id": "40",
"isStandard": true,
"name": "Jelly", "name": "Jelly",
}, },
Object { Object {
"id": "41", "id": "41",
"isStandard": false,
"name": "Lemon", "name": "Lemon",
}, },
Object { Object {
"id": "42", "id": "42",
"isStandard": false,
"name": "Lime", "name": "Lime",
}, },
Object { Object {
"id": "43", "id": "43",
"isStandard": true,
"name": "Mallow", "name": "Mallow",
}, },
Object { Object {
"id": "44", "id": "44",
"isStandard": false,
"name": "Maraquan", "name": "Maraquan",
}, },
Object { Object {
"id": "45", "id": "45",
"isStandard": true,
"name": "Msp", "name": "Msp",
}, },
Object { Object {
"id": "46", "id": "46",
"isStandard": false,
"name": "Mutant", "name": "Mutant",
}, },
Object { Object {
"id": "47", "id": "47",
"isStandard": false,
"name": "Orange", "name": "Orange",
}, },
Object { Object {
"id": "48", "id": "48",
"isStandard": false,
"name": "Pea", "name": "Pea",
}, },
Object { Object {
"id": "49", "id": "49",
"isStandard": false,
"name": "Peach", "name": "Peach",
}, },
Object { Object {
"id": "50", "id": "50",
"isStandard": false,
"name": "Pear", "name": "Pear",
}, },
Object { Object {
"id": "51", "id": "51",
"isStandard": false,
"name": "Pepper", "name": "Pepper",
}, },
Object { Object {
"id": "52", "id": "52",
"isStandard": false,
"name": "Pineapple", "name": "Pineapple",
}, },
Object { Object {
"id": "53", "id": "53",
"isStandard": true,
"name": "Pink", "name": "Pink",
}, },
Object { Object {
"id": "54", "id": "54",
"isStandard": true,
"name": "Pirate", "name": "Pirate",
}, },
Object { Object {
"id": "55", "id": "55",
"isStandard": false,
"name": "Plum", "name": "Plum",
}, },
Object { Object {
"id": "56", "id": "56",
"isStandard": true,
"name": "Plushie", "name": "Plushie",
}, },
Object { Object {
"id": "57", "id": "57",
"isStandard": true,
"name": "Purple", "name": "Purple",
}, },
Object { Object {
"id": "58", "id": "58",
"isStandard": true,
"name": "Quigukiboy", "name": "Quigukiboy",
}, },
Object { Object {
"id": "59", "id": "59",
"isStandard": true,
"name": "Quigukigirl", "name": "Quigukigirl",
}, },
Object { Object {
"id": "60", "id": "60",
"isStandard": true,
"name": "Rainbow", "name": "Rainbow",
}, },
Object { Object {
"id": "61", "id": "61",
"isStandard": true,
"name": "Red", "name": "Red",
}, },
Object { Object {
"id": "62", "id": "62",
"isStandard": true,
"name": "Robot", "name": "Robot",
}, },
Object { Object {
"id": "63", "id": "63",
"isStandard": true,
"name": "Royalboy", "name": "Royalboy",
}, },
Object { Object {
"id": "64", "id": "64",
"isStandard": true,
"name": "Royalgirl", "name": "Royalgirl",
}, },
Object { Object {
"id": "65", "id": "65",
"isStandard": true,
"name": "Shadow", "name": "Shadow",
}, },
Object { Object {
"id": "66", "id": "66",
"isStandard": true,
"name": "Silver", "name": "Silver",
}, },
Object { Object {
"id": "67", "id": "67",
"isStandard": true,
"name": "Sketch", "name": "Sketch",
}, },
Object { Object {
"id": "68", "id": "68",
"isStandard": true,
"name": "Skunk", "name": "Skunk",
}, },
Object { Object {
"id": "69", "id": "69",
"isStandard": true,
"name": "Snot", "name": "Snot",
}, },
Object { Object {
"id": "70", "id": "70",
"isStandard": true,
"name": "Snow", "name": "Snow",
}, },
Object { Object {
"id": "71", "id": "71",
"isStandard": true,
"name": "Speckled", "name": "Speckled",
}, },
Object { Object {
"id": "72", "id": "72",
"isStandard": true,
"name": "Split", "name": "Split",
}, },
Object { Object {
"id": "73", "id": "73",
"isStandard": true,
"name": "Sponge", "name": "Sponge",
}, },
Object { Object {
"id": "74", "id": "74",
"isStandard": true,
"name": "Spotted", "name": "Spotted",
}, },
Object { Object {
"id": "75", "id": "75",
"isStandard": true,
"name": "Starry", "name": "Starry",
}, },
Object { Object {
"id": "76", "id": "76",
"isStandard": true,
"name": "Strawberry", "name": "Strawberry",
}, },
Object { Object {
"id": "77", "id": "77",
"isStandard": true,
"name": "Striped", "name": "Striped",
}, },
Object { Object {
"id": "78", "id": "78",
"isStandard": false,
"name": "Thornberry", "name": "Thornberry",
}, },
Object { Object {
"id": "79", "id": "79",
"isStandard": false,
"name": "Tomato", "name": "Tomato",
}, },
Object { Object {
"id": "80", "id": "80",
"isStandard": true,
"name": "Tyrannian", "name": "Tyrannian",
}, },
Object { Object {
"id": "81", "id": "81",
"isStandard": true,
"name": "Usuki boy", "name": "Usuki boy",
}, },
Object { Object {
"id": "82", "id": "82",
"isStandard": true,
"name": "Usuki girl", "name": "Usuki girl",
}, },
Object { Object {
"id": "83", "id": "83",
"isStandard": true,
"name": "White", "name": "White",
}, },
Object { Object {
"id": "84", "id": "84",
"isStandard": true,
"name": "Yellow", "name": "Yellow",
}, },
Object { Object {
"id": "85", "id": "85",
"isStandard": true,
"name": "Zombie", "name": "Zombie",
}, },
Object { Object {
"id": "86", "id": "86",
"isStandard": false,
"name": "Onion", "name": "Onion",
}, },
Object { Object {
"id": "87", "id": "87",
"isStandard": true,
"name": "Magma", "name": "Magma",
}, },
Object { Object {
"id": "88", "id": "88",
"isStandard": true,
"name": "Relic", "name": "Relic",
}, },
Object { Object {
"id": "89", "id": "89",
"isStandard": true,
"name": "Woodland", "name": "Woodland",
}, },
Object { Object {
"id": "90", "id": "90",
"isStandard": true,
"name": "Transparent", "name": "Transparent",
}, },
Object { Object {
"id": "91", "id": "91",
"isStandard": true,
"name": "Maractite", "name": "Maractite",
}, },
Object { Object {
"id": "92", "id": "92",
"isStandard": false,
"name": "8-bit", "name": "8-bit",
}, },
Object { Object {
"id": "93", "id": "93",
"isStandard": true,
"name": "Swamp gas", "name": "Swamp gas",
}, },
Object { Object {
"id": "94", "id": "94",
"isStandard": true,
"name": "Water", "name": "Water",
}, },
Object { Object {
"id": "95", "id": "95",
"isStandard": true,
"name": "Wraith", "name": "Wraith",
}, },
Object { Object {
"id": "96", "id": "96",
"isStandard": true,
"name": "Eventide", "name": "Eventide",
}, },
Object { Object {
"id": "97", "id": "97",
"isStandard": true,
"name": "Elderlyboy", "name": "Elderlyboy",
}, },
Object { Object {
"id": "98", "id": "98",
"isStandard": true,
"name": "Elderlygirl", "name": "Elderlygirl",
}, },
Object { Object {
"id": "99", "id": "99",
"isStandard": true,
"name": "Stealthy", "name": "Stealthy",
}, },
Object { Object {
"id": "100", "id": "100",
"isStandard": true,
"name": "Dimensional", "name": "Dimensional",
}, },
Object { Object {
"id": "101", "id": "101",
"isStandard": false,
"name": "Agueena", "name": "Agueena",
}, },
Object { Object {
"id": "102", "id": "102",
"isStandard": true,
"name": "Pastel", "name": "Pastel",
}, },
Object { Object {
"id": "103", "id": "103",
"isStandard": true,
"name": "Ummagine", "name": "Ummagine",
}, },
Object { Object {
"id": "104", "id": "104",
"isStandard": true,
"name": "Polka Dot", "name": "Polka Dot",
}, },
Object { Object {
"id": "105", "id": "105",
"isStandard": true,
"name": "Candy", "name": "Candy",
}, },
Object { Object {
"id": "106", "id": "106",
"isStandard": true,
"name": "Marble", "name": "Marble",
}, },
Object { Object {
"id": "107", "id": "107",
"isStandard": true,
"name": "Steampunk", "name": "Steampunk",
}, },
Object { Object {
"id": "108", "id": "108",
"isStandard": true,
"name": "Toy", "name": "Toy",
}, },
Object { Object {
"id": "109", "id": "109",
"isStandard": true,
"name": "Origami", "name": "Origami",
}, },
Object { Object {
"id": "110", "id": "110",
"isStandard": true,
"name": "Oil Paint", "name": "Oil Paint",
}, },
Object { Object {
"id": "111", "id": "111",
"isStandard": true,
"name": "Mosaic", "name": "Mosaic",
}, },
Object { Object {
"id": "112", "id": "112",
"isStandard": true,
"name": "Burlap", "name": "Burlap",
}, },
], ],

View file

@ -68,11 +68,10 @@ Object {
exports[`PetAppearance loads multiple for species and color 1`] = ` exports[`PetAppearance loads multiple for species and color 1`] = `
Object { Object {
"petAppearances": Array [ "petAppearance": Object {
Object {
"bodyId": "180",
"color": Object { "color": Object {
"id": "75", "id": "75",
"isStandard": true,
"name": "Starry", "name": "Starry",
}, },
"id": "54-75-HAPPY_FEM", "id": "54-75-HAPPY_FEM",
@ -80,6 +79,7 @@ Object {
Object { Object {
"id": "5995", "id": "5995",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7941/600x600.png?v2-0", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7941/600x600.png?v2-0",
"svgUrl": "http://images.neopets.com/cp/bio/data/000/000/007/7941_2c4cc4b846/7941.svg",
"zone": Object { "zone": Object {
"depth": 18, "depth": 18,
}, },
@ -87,6 +87,7 @@ Object {
Object { Object {
"id": "5996", "id": "5996",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7942/600x600.png?v2-0", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7942/600x600.png?v2-0",
"svgUrl": "http://images.neopets.com/cp/bio/data/000/000/007/7942_2eab06fd7b/7942.svg",
"zone": Object { "zone": Object {
"depth": 7, "depth": 7,
}, },
@ -94,6 +95,7 @@ Object {
Object { Object {
"id": "6000", "id": "6000",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7946/600x600.png?v2-0", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7946/600x600.png?v2-0",
"svgUrl": "http://images.neopets.com/cp/bio/data/000/000/007/7946_0348dad587/7946.svg",
"zone": Object { "zone": Object {
"depth": 40, "depth": 40,
}, },
@ -101,6 +103,7 @@ Object {
Object { Object {
"id": "16467", "id": "16467",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0",
"svgUrl": "http://images.neopets.com/cp/bio/data/000/000/024/24008_a05fe9876a/24008.svg",
"zone": Object { "zone": Object {
"depth": 34, "depth": 34,
}, },
@ -108,6 +111,7 @@ Object {
Object { Object {
"id": "19784", "id": "19784",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28892/600x600.png?v2-1313418652000", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28892/600x600.png?v2-1313418652000",
"svgUrl": "http://images.neopets.com/cp/bio/data/000/000/028/28892_a8e3a8b430/28892.svg",
"zone": Object { "zone": Object {
"depth": 37, "depth": 37,
}, },
@ -115,25 +119,30 @@ Object {
Object { Object {
"id": "178150", "id": "178150",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/036/36887/600x600.png?v2-1354240708000", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/036/36887/600x600.png?v2-1354240708000",
"svgUrl": "http://images.neopets.com/cp/bio/data/000/000/036/36887_a335fbba09/36887.svg",
"zone": Object { "zone": Object {
"depth": 38, "depth": 38,
}, },
}, },
], ],
"petStateId": "17723",
"pose": "HAPPY_FEM",
"species": Object { "species": Object {
"id": "54", "id": "54",
"name": "Zafara", "name": "Zafara",
}, },
}, },
}
`;
exports[`PetAppearance loads multiple for species and color 3`] = `
Object {
"petAppearances": Array [
Object { Object {
"bodyId": "180", "bodyId": "180",
"color": Object { "color": Object {
"id": "75", "id": "75",
"name": "Starry", "name": "Starry",
}, },
"id": "54-75-HAPPY_MASC", "id": "54-75-UNKNOWN",
"layers": Array [ "layers": Array [
Object { Object {
"id": "5995", "id": "5995",
@ -171,15 +180,203 @@ Object {
}, },
}, },
Object { Object {
"id": "178150", "id": "19550",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/036/36887/600x600.png?v2-1354240708000", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-0",
"zone": Object {
"depth": 38,
},
},
Object {
"id": "163528",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-1326455337000",
"zone": Object { "zone": Object {
"depth": 38, "depth": 38,
}, },
}, },
], ],
"petStateId": "17742", "petStateId": "2",
"pose": "HAPPY_MASC", "pose": "UNKNOWN",
"species": Object {
"id": "54",
"name": "Zafara",
},
},
Object {
"bodyId": "180",
"color": Object {
"id": "75",
"name": "Starry",
},
"id": "54-75-SAD_MASC",
"layers": Array [
Object {
"id": "5995",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7941/600x600.png?v2-0",
"zone": Object {
"depth": 18,
},
},
Object {
"id": "5996",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7942/600x600.png?v2-0",
"zone": Object {
"depth": 7,
},
},
Object {
"id": "6000",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7946/600x600.png?v2-0",
"zone": Object {
"depth": 40,
},
},
Object {
"id": "14790",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/021/21057/600x600.png?v2-0",
"zone": Object {
"depth": 38,
},
},
Object {
"id": "14792",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/021/21060/600x600.png?v2-0",
"zone": Object {
"depth": 37,
},
},
Object {
"id": "16467",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0",
"zone": Object {
"depth": 34,
},
},
],
"petStateId": "436",
"pose": "SAD_MASC",
"species": Object {
"id": "54",
"name": "Zafara",
},
},
Object {
"bodyId": "180",
"color": Object {
"id": "75",
"name": "Starry",
},
"id": "54-75-UNKNOWN",
"layers": Array [
Object {
"id": "5995",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7941/600x600.png?v2-0",
"zone": Object {
"depth": 18,
},
},
Object {
"id": "5996",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7942/600x600.png?v2-0",
"zone": Object {
"depth": 7,
},
},
Object {
"id": "6000",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7946/600x600.png?v2-0",
"zone": Object {
"depth": 40,
},
},
Object {
"id": "16467",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0",
"zone": Object {
"depth": 34,
},
},
Object {
"id": "19550",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-0",
"zone": Object {
"depth": 38,
},
},
Object {
"id": "19784",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28892/600x600.png?v2-1313418652000",
"zone": Object {
"depth": 37,
},
},
Object {
"id": "163528",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-1326455337000",
"zone": Object {
"depth": 38,
},
},
],
"petStateId": "4751",
"pose": "UNKNOWN",
"species": Object {
"id": "54",
"name": "Zafara",
},
},
Object {
"bodyId": "180",
"color": Object {
"id": "75",
"name": "Starry",
},
"id": "54-75-SAD_FEM",
"layers": Array [
Object {
"id": "5995",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7941/600x600.png?v2-0",
"zone": Object {
"depth": 18,
},
},
Object {
"id": "5996",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7942/600x600.png?v2-0",
"zone": Object {
"depth": 7,
},
},
Object {
"id": "6000",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7946/600x600.png?v2-0",
"zone": Object {
"depth": 40,
},
},
Object {
"id": "14790",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/021/21057/600x600.png?v2-0",
"zone": Object {
"depth": 38,
},
},
Object {
"id": "14793",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/021/21061/600x600.png?v2-0",
"zone": Object {
"depth": 37,
},
},
Object {
"id": "16467",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0",
"zone": Object {
"depth": 34,
},
},
],
"petStateId": "5991",
"pose": "SAD_FEM",
"species": Object { "species": Object {
"id": "54", "id": "54",
"name": "Zafara", "name": "Zafara",
@ -307,7 +504,7 @@ Object {
"id": "75", "id": "75",
"name": "Starry", "name": "Starry",
}, },
"id": "54-75-SAD_FEM", "id": "54-75-HAPPY_FEM",
"layers": Array [ "layers": Array [
Object { Object {
"id": "5995", "id": "5995",
@ -330,20 +527,6 @@ Object {
"depth": 40, "depth": 40,
}, },
}, },
Object {
"id": "14790",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/021/21057/600x600.png?v2-0",
"zone": Object {
"depth": 38,
},
},
Object {
"id": "14793",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/021/21061/600x600.png?v2-0",
"zone": Object {
"depth": 37,
},
},
Object { Object {
"id": "16467", "id": "16467",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0",
@ -351,9 +534,23 @@ Object {
"depth": 34, "depth": 34,
}, },
}, },
Object {
"id": "19784",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28892/600x600.png?v2-1313418652000",
"zone": Object {
"depth": 37,
},
},
Object {
"id": "178150",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/036/36887/600x600.png?v2-1354240708000",
"zone": Object {
"depth": 38,
},
},
], ],
"petStateId": "5991", "petStateId": "17723",
"pose": "SAD_FEM", "pose": "HAPPY_FEM",
"species": Object { "species": Object {
"id": "54", "id": "54",
"name": "Zafara", "name": "Zafara",
@ -365,65 +562,7 @@ Object {
"id": "75", "id": "75",
"name": "Starry", "name": "Starry",
}, },
"id": "54-75-SAD_MASC", "id": "54-75-HAPPY_MASC",
"layers": Array [
Object {
"id": "5995",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7941/600x600.png?v2-0",
"zone": Object {
"depth": 18,
},
},
Object {
"id": "5996",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7942/600x600.png?v2-0",
"zone": Object {
"depth": 7,
},
},
Object {
"id": "6000",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7946/600x600.png?v2-0",
"zone": Object {
"depth": 40,
},
},
Object {
"id": "14790",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/021/21057/600x600.png?v2-0",
"zone": Object {
"depth": 38,
},
},
Object {
"id": "14792",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/021/21060/600x600.png?v2-0",
"zone": Object {
"depth": 37,
},
},
Object {
"id": "16467",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0",
"zone": Object {
"depth": 34,
},
},
],
"petStateId": "436",
"pose": "SAD_MASC",
"species": Object {
"id": "54",
"name": "Zafara",
},
},
Object {
"bodyId": "180",
"color": Object {
"id": "75",
"name": "Starry",
},
"id": "54-75-UNKNOWN",
"layers": Array [ "layers": Array [
Object { Object {
"id": "5995", "id": "5995",
@ -461,87 +600,15 @@ Object {
}, },
}, },
Object { Object {
"id": "19550", "id": "178150",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-0", "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/036/36887/600x600.png?v2-1354240708000",
"zone": Object {
"depth": 38,
},
},
Object {
"id": "163528",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-1326455337000",
"zone": Object { "zone": Object {
"depth": 38, "depth": 38,
}, },
}, },
], ],
"petStateId": "2", "petStateId": "17742",
"pose": "UNKNOWN", "pose": "HAPPY_MASC",
"species": Object {
"id": "54",
"name": "Zafara",
},
},
Object {
"bodyId": "180",
"color": Object {
"id": "75",
"name": "Starry",
},
"id": "54-75-UNKNOWN",
"layers": Array [
Object {
"id": "5995",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7941/600x600.png?v2-0",
"zone": Object {
"depth": 18,
},
},
Object {
"id": "5996",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7942/600x600.png?v2-0",
"zone": Object {
"depth": 7,
},
},
Object {
"id": "6000",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/007/7946/600x600.png?v2-0",
"zone": Object {
"depth": 40,
},
},
Object {
"id": "16467",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/024/24008/600x600.png?v2-0",
"zone": Object {
"depth": 34,
},
},
Object {
"id": "19550",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-0",
"zone": Object {
"depth": 38,
},
},
Object {
"id": "19784",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28892/600x600.png?v2-1313418652000",
"zone": Object {
"depth": 37,
},
},
Object {
"id": "163528",
"imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-1326455337000",
"zone": Object {
"depth": 38,
},
},
],
"petStateId": "4751",
"pose": "UNKNOWN",
"species": Object { "species": Object {
"id": "54", "id": "54",
"name": "Zafara", "name": "Zafara",