Add restricted zones to pet appearance support UI

This commit is contained in:
Emi Matchu 2021-04-29 11:52:25 -07:00
parent cb2a5bc912
commit d373a7a54f
2 changed files with 30 additions and 7 deletions

View file

@ -5,7 +5,7 @@ import { Box } from "@chakra-ui/react";
* Metadata is a UI component for showing metadata about something, as labels * Metadata is a UI component for showing metadata about something, as labels
* and their values. * and their values.
*/ */
function Metadata({ children, ...otherProps }) { function Metadata({ children, ...props }) {
return ( return (
<Box <Box
as="dl" as="dl"
@ -13,24 +13,24 @@ function Metadata({ children, ...otherProps }) {
gridTemplateColumns="max-content auto" gridTemplateColumns="max-content auto"
gridRowGap="1" gridRowGap="1"
gridColumnGap="2" gridColumnGap="2"
{...otherProps} {...props}
> >
{children} {children}
</Box> </Box>
); );
} }
function MetadataLabel({ children }) { function MetadataLabel({ children, ...props }) {
return ( return (
<Box as="dt" gridColumn="1" fontWeight="bold"> <Box as="dt" gridColumn="1" fontWeight="bold" {...props}>
{children} {children}
</Box> </Box>
); );
} }
function MetadataValue({ children }) { function MetadataValue({ children, ...props }) {
return ( return (
<Box as="dd" gridColumn="2"> <Box as="dd" gridColumn="2" {...props}>
{children} {children}
</Box> </Box>
); );

View file

@ -11,6 +11,8 @@ import {
Wrap, Wrap,
WrapItem, WrapItem,
useDisclosure, useDisclosure,
UnorderedList,
ListItem,
} from "@chakra-ui/react"; } from "@chakra-ui/react";
import { import {
ArrowBackIcon, ArrowBackIcon,
@ -55,6 +57,10 @@ function PosePickerSupport({
imageUrl(size: SIZE_600) imageUrl(size: SIZE_600)
canvasMovieLibraryUrl canvasMovieLibraryUrl
} }
restrictedZones {
id
label @client
}
# For AppearanceLayerSupportModal to know the name # For AppearanceLayerSupportModal to know the name
species { species {
@ -185,7 +191,7 @@ function PosePickerSupport({
.map((layer) => [`${layer.zone.label} (${layer.zone.id})`, layer]) .map((layer) => [`${layer.zone.label} (${layer.zone.id})`, layer])
.sort((a, b) => a[0].localeCompare(b[0])) .sort((a, b) => a[0].localeCompare(b[0]))
.map(([text, layer]) => ( .map(([text, layer]) => (
<WrapItem> <WrapItem key={layer.id}>
<PetLayerSupportLink <PetLayerSupportLink
outfitState={{ speciesId, colorId, pose }} outfitState={{ speciesId, colorId, pose }}
petAppearance={currentPetAppearance} petAppearance={currentPetAppearance}
@ -198,6 +204,23 @@ function PosePickerSupport({
))} ))}
</Wrap> </Wrap>
</MetadataValue> </MetadataValue>
<MetadataLabel>Restricts:</MetadataLabel>
<MetadataValue maxHeight="64" overflowY="auto">
{currentPetAppearance.restrictedZones.length > 1 ? (
<UnorderedList>
{currentPetAppearance.restrictedZones
.map((zone) => `${zone.label} (${zone.id})`)
.sort((a, b) => a[0].localeCompare(b[0]))
.map((zoneText) => (
<ListItem>{zoneText}</ListItem>
))}
</UnorderedList>
) : (
<Box fontStyle="italic" opacity="0.8">
None
</Box>
)}
</MetadataValue>
</Metadata> </Metadata>
</Box> </Box>
); );