From 6ebbc4af026ca7f77599e676a7c27a31dee66c31 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 13 Mar 2021 01:48:12 -0800 Subject: [PATCH] Explain Static UC conflict in a new glitch UI --- src/app/WardrobePage/OutfitControls.js | 51 +++++++++++++++++++++++++- src/app/components/HTML5Badge.js | 42 +++++++++++---------- 2 files changed, 73 insertions(+), 20 deletions(-) diff --git a/src/app/WardrobePage/OutfitControls.js b/src/app/WardrobePage/OutfitControls.js index 7da6534..3309db7 100644 --- a/src/app/WardrobePage/OutfitControls.js +++ b/src/app/WardrobePage/OutfitControls.js @@ -13,18 +13,24 @@ import { UnorderedList, useClipboard, useToast, + VStack, } from "@chakra-ui/react"; import { ArrowBackIcon, CheckIcon, DownloadIcon, LinkIcon, + WarningTwoIcon, } from "@chakra-ui/icons"; +import { FaBug } from "react-icons/fa"; import { MdPause, MdPlayArrow } from "react-icons/md"; import { Link } from "react-router-dom"; import { getBestImageUrlForLayer } from "../components/OutfitPreview"; -import HTML5Badge, { layerUsesHTML5 } from "../components/HTML5Badge"; +import HTML5Badge, { + GlitchBadgeLayout, + layerUsesHTML5, +} from "../components/HTML5Badge"; import PosePicker from "./PosePicker"; import SpeciesColorPicker from "../components/SpeciesColorPicker"; import { loadImage, useLocalStorage } from "../util"; @@ -184,6 +190,8 @@ function OutfitControls({ justify="center" > + + @@ -272,6 +280,47 @@ function OutfitHTML5Badge({ appearance }) { ); } +function OutfitKnownGlitchesBadge({ appearance }) { + const glitchMessages = []; + + const petHasStaticZone = appearance.petAppearance?.layers.some( + (l) => l.zone.id === "46" + ); + const itemHasStaticZone = appearance.itemAppearances + ?.map((a) => a.layers) + .flat() + .some((l) => l.zone.id === "46"); + if (petHasStaticZone && itemHasStaticZone) { + glitchMessages.push( + + When you apply a Static-zone item to an Unconverted pet, it hides the + pet. This is a known bug on Neopets.com, so we reproduce it here, too. + + ); + } + + if (glitchMessages.length === 0) { + return null; + } + + return ( + + + Known glitches + + {glitchMessages} + + } + > + + + + ); +} + /** * BackButton takes you back home, or to Your Outfits if this outfit is yours. */ diff --git a/src/app/components/HTML5Badge.js b/src/app/components/HTML5Badge.js index 7e9a4fb..60e838e 100644 --- a/src/app/components/HTML5Badge.js +++ b/src/app/components/HTML5Badge.js @@ -3,14 +3,6 @@ import { Tooltip, useColorModeValue, Flex, Icon } from "@chakra-ui/react"; import { CheckCircleIcon, WarningTwoIcon } from "@chakra-ui/icons"; function HTML5Badge({ usesHTML5, isLoading, tooltipLabel }) { - const greenBackground = useColorModeValue("green.100", "green.900"); - const greenBorderColor = useColorModeValue("green.600", "green.500"); - const greenTextColor = useColorModeValue("green.700", "white"); - - const yellowBackground = useColorModeValue("yellow.100", "yellow.900"); - const yellowBorderColor = useColorModeValue("yellow.600", "yellow.500"); - const yellowTextColor = useColorModeValue("yellow.700", "white"); - // `delayedUsesHTML5` stores the last known value of `usesHTML5`, when // `isLoading` was `false`. This enables us to keep showing the badge, even // when loading a new appearance - because it's unlikely the badge will @@ -25,10 +17,8 @@ function HTML5Badge({ usesHTML5, isLoading, tooltipLabel }) { if (delayedUsesHTML5 === true) { return ( - - + ); } else if (delayedUsesHTML5 === false) { return ( - - + ); } else { // If no `usesHTML5` value has been provided yet, we're empty for now! @@ -91,10 +79,23 @@ function HTML5Badge({ usesHTML5, isLoading, tooltipLabel }) { } } -function HTML5BadgeLayout({ children, tooltipLabel, ...props }) { +export function GlitchBadgeLayout({ + hasGlitches = true, + children, + tooltipLabel, + ...props +}) { const [isHovered, setIsHovered] = React.useState(false); const [isFocused, setIsFocused] = React.useState(false); + const greenBackground = useColorModeValue("green.100", "green.900"); + const greenBorderColor = useColorModeValue("green.600", "green.500"); + const greenTextColor = useColorModeValue("green.700", "white"); + + const yellowBackground = useColorModeValue("yellow.100", "yellow.900"); + const yellowBorderColor = useColorModeValue("yellow.600", "yellow.500"); + const yellowTextColor = useColorModeValue("yellow.700", "white"); + return (