2021-04-23 11:31:25 -07:00
|
|
|
import { gql, useQuery } from "@apollo/client";
|
2021-04-23 15:34:16 -07:00
|
|
|
import { useColorModeValue } from "@chakra-ui/color-mode";
|
2021-04-23 11:38:52 -07:00
|
|
|
import { QuestionIcon } from "@chakra-ui/icons";
|
2021-04-23 11:31:25 -07:00
|
|
|
import { Box, Flex, Wrap, WrapItem } from "@chakra-ui/layout";
|
2021-04-23 11:38:52 -07:00
|
|
|
import {
|
|
|
|
Popover,
|
|
|
|
PopoverArrow,
|
|
|
|
PopoverBody,
|
|
|
|
PopoverContent,
|
|
|
|
PopoverTrigger,
|
|
|
|
} from "@chakra-ui/popover";
|
2021-04-23 11:31:25 -07:00
|
|
|
import { Link } from "react-router-dom";
|
|
|
|
import HangerSpinner from "./components/HangerSpinner";
|
|
|
|
import { ErrorMessage, Heading1 } from "./util";
|
|
|
|
import useSupport from "./WardrobePage/support/useSupport";
|
|
|
|
|
|
|
|
function SupportPetAppearancesPage() {
|
|
|
|
const { isSupportUser } = useSupport();
|
|
|
|
|
|
|
|
if (!isSupportUser) {
|
|
|
|
return "Sorry, this page is only for Support users!";
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Heading1 marginBottom=".5em">Support: Pet appearances</Heading1>
|
|
|
|
<Box as="p" marginBottom="2">
|
2021-04-23 11:38:52 -07:00
|
|
|
These species/color combinations have some <code>UNKNOWN</code>{" "}
|
|
|
|
appearances that need labeled! Please take a look!
|
|
|
|
<Popover trigger="hover" placement="top">
|
|
|
|
<PopoverTrigger>
|
|
|
|
<QuestionIcon marginLeft="1.5" marginTop="-2px" tabIndex="0" />
|
|
|
|
</PopoverTrigger>
|
|
|
|
<PopoverContent>
|
|
|
|
<PopoverArrow />
|
|
|
|
<PopoverBody fontSize="sm" textAlign="center">
|
|
|
|
This includes species/color combinations that have at least one{" "}
|
2021-04-23 15:31:10 -07:00
|
|
|
non-glitched <code>UNKNOWN</code> pose, and still need a
|
|
|
|
non-glitched version of at least one of the standard 6
|
|
|
|
mood/gender-presentation poses.
|
2021-04-23 11:38:52 -07:00
|
|
|
</PopoverBody>
|
|
|
|
</PopoverContent>
|
|
|
|
</Popover>
|
2021-04-23 11:31:25 -07:00
|
|
|
</Box>
|
2021-04-23 15:31:10 -07:00
|
|
|
<UnlabeledPetAppearancesList />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function UnlabeledPetAppearancesList() {
|
|
|
|
const { loading, error, data } = useQuery(gql`
|
|
|
|
query SupportUnlabeledSpeciesColorPairs {
|
|
|
|
speciesColorPairsThatNeedSupportLabeling {
|
|
|
|
id
|
|
|
|
species {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
color {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
return (
|
|
|
|
<Flex justify="center">
|
|
|
|
<HangerSpinner />
|
|
|
|
</Flex>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
return <ErrorMessage>{error.message}</ErrorMessage>;
|
|
|
|
}
|
|
|
|
|
|
|
|
const speciesColorPairs = [
|
|
|
|
...data.speciesColorPairsThatNeedSupportLabeling,
|
|
|
|
].sort((a, b) =>
|
|
|
|
`${a.species.name} ${a.color.name}`.localeCompare(
|
|
|
|
`${b.species.name} ${b.color.name}`
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (speciesColorPairs.length === 0) {
|
|
|
|
return <>…never mind, they're all done! Wow, go team!! 🎉</>;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-04-23 15:37:52 -07:00
|
|
|
<Wrap align="center">
|
2021-04-23 15:31:10 -07:00
|
|
|
{speciesColorPairs.map(({ species, color }) => (
|
|
|
|
<WrapItem key={`${species.id}-${color.id}`}>
|
|
|
|
<SpeciesColorEditorLink species={species} color={color} />
|
|
|
|
</WrapItem>
|
|
|
|
))}
|
2021-04-23 15:37:52 -07:00
|
|
|
<WrapItem>
|
|
|
|
{speciesColorPairs.length >= 10 && (
|
|
|
|
<Box fontSize="xs" fontStyle="italic" marginLeft="2">
|
|
|
|
(That's {speciesColorPairs.length} total, and fewer by the minute!)
|
|
|
|
</Box>
|
|
|
|
)}
|
|
|
|
</WrapItem>
|
2021-04-23 15:31:10 -07:00
|
|
|
</Wrap>
|
2021-04-23 11:31:25 -07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function SpeciesColorEditorLink({ species, color }) {
|
2021-04-23 15:34:16 -07:00
|
|
|
const hoverBackgroundColor = useColorModeValue(
|
|
|
|
"blackAlpha.50",
|
|
|
|
"whiteAlpha.100"
|
|
|
|
);
|
|
|
|
|
2021-04-23 11:31:25 -07:00
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
as={Link}
|
2021-04-23 11:44:55 -07:00
|
|
|
to={`/outfits/new?species=${species.id}&color=${color.id}&pose=UNKNOWN`}
|
2021-04-23 11:31:25 -07:00
|
|
|
target="supportPetAppearanceEditor"
|
|
|
|
border="1px solid"
|
|
|
|
borderColor="green.600"
|
|
|
|
borderRadius="full"
|
|
|
|
paddingX="3"
|
|
|
|
paddingY="2"
|
|
|
|
fontSize="sm"
|
2021-04-23 15:34:16 -07:00
|
|
|
_hover={{ backgroundColor: hoverBackgroundColor }}
|
|
|
|
_focus={{ boxShadow: "outline", outline: "none" }}
|
2021-04-23 11:31:25 -07:00
|
|
|
>
|
|
|
|
{color.name} {species.name}
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SupportPetAppearancesPage;
|