diff --git a/src/app/ItemPage.js b/src/app/ItemPage.js index 78c78db..b848eb0 100644 --- a/src/app/ItemPage.js +++ b/src/app/ItemPage.js @@ -20,8 +20,10 @@ import { WrapItem, Flex, usePrefersReducedMotion, + Icon, } from "@chakra-ui/react"; import { + CheckCircleIcon, CheckIcon, ChevronRightIcon, EditIcon, @@ -666,7 +668,11 @@ function ItemPageOutfitPreview({ itemId }) { // If there's an appearance loaded for this item, but it's empty, then the // item is incompatible. (There should only be one item appearance: this one!) const itemAppearance = appearance?.itemAppearances?.[0]; - const isIncompatible = itemAppearance && itemAppearance.layers.length === 0; + const itemLayers = itemAppearance?.layers || []; + const isCompatible = itemLayers.length > 0; + const usesHTML5 = itemLayers.every( + (l) => l.svgUrl || l.canvasMovieLibraryUrl + ); const borderColor = useColorModeValue("green.700", "green.400"); const errorColor = useColorModeValue("red.600", "red.400"); @@ -714,10 +720,17 @@ function ItemPageOutfitPreview({ itemId }) { + display="flex" + justifyContent="center" + paddingRight="2" + > + {!appearance.loading && isCompatible && ( + + )} + - {isIncompatible && ( - - - - )} + { + // Wait for us to start _requesting_ the appearance, and _then_ + // for it to load, and _then_ check compatibility. + !loadingGQL && !appearance.loading && !isCompatible && ( + + + + ) + } @@ -863,6 +880,103 @@ function ExpandOnGroupHover({ children, ...props }) { ); } +function HTML5Badge({ usesHTML5 }) { + 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"); + + if (usesHTML5) { + return ( + + + + + {/* From Twemoji Keycap 5 */} + + + + + ); + } else { + return ( + + This item isn't converted to HTML5 yet, so it might not appear in + Neopets.com customization yet. Once it's ready, it could look a bit + different than our temporary preview here. It might even be + animated! + + } + > + + + + {/* From Twemoji Keycap 5 */} + + + {/* From Twemoji Not Allowed */} + + + + + ); + } +} + function PlayPauseButton({ isPaused, onClick }) { return (