Waka deprecation UI, to expire on Aug 21

This commit is contained in:
Emi Matchu 2021-08-07 21:32:22 -07:00
parent f1d24d2177
commit e2e7835214

View file

@ -20,6 +20,7 @@ import {
ExternalLinkIcon, ExternalLinkIcon,
ChevronRightIcon, ChevronRightIcon,
QuestionIcon, QuestionIcon,
WarningTwoIcon,
} from "@chakra-ui/icons"; } from "@chakra-ui/icons";
import { gql, useMutation } from "@apollo/client"; import { gql, useMutation } from "@apollo/client";
@ -163,12 +164,16 @@ function ItemPageBadges({ item, isEmbedded }) {
item.wakaValueText !== undefined item.wakaValueText !== undefined
} }
> >
{item.wakaValueText && ( {shouldShowWaka() && item.wakaValueText && (
<> <>
{/* For hover-y devices, use a hover popover over the badge. */} {/* For hover-y devices, use a hover popover over the badge. */}
<Box sx={{ "@media (hover: none)": { display: "none" } }}> <Box sx={{ "@media (hover: none)": { display: "none" } }}>
<WakaPopover trigger="hover"> <WakaPopover trigger="hover">
<LinkBadge href="http://www.neopets.com/~waka"> <LinkBadge
href="http://www.neopets.com/~waka"
colorScheme="yellow"
>
<WarningTwoIcon marginRight="1" />
Waka: {item.wakaValueText} Waka: {item.wakaValueText}
</LinkBadge> </LinkBadge>
</WakaPopover> </WakaPopover>
@ -178,7 +183,11 @@ function ItemPageBadges({ item, isEmbedded }) {
sx={{ "@media (hover: hover)": { display: "none" } }} sx={{ "@media (hover: hover)": { display: "none" } }}
align="center" align="center"
> >
<LinkBadge href="http://www.neopets.com/~waka"> <LinkBadge
href="http://www.neopets.com/~waka"
colorScheme="yellow"
>
<WarningTwoIcon marginRight="1" />
Waka: {item.wakaValueText} Waka: {item.wakaValueText}
</LinkBadge> </LinkBadge>
<WakaPopover> <WakaPopover>
@ -439,15 +448,23 @@ function WakaPopover({ children, ...props }) {
<PopoverArrow /> <PopoverArrow />
<PopoverBody fontSize="sm"> <PopoverBody fontSize="sm">
<p> <p>
Waka is a community resource that tracks the approximate value of <strong>
NC items, based on real-world trades. The Waka Guide for NC trade values is closing down!
</strong>{" "}
We're sad to see them go, but excited that the team gets to move
onto the next phase in their life 💖
</p> </p>
<Box height="1em" /> <Box height="1em" />
<p> <p>
The Waka Team aims to maintain the accuracy of the guide as fully The Waka guide was last updated August 7, 2021, so this value
as possible, but please remember values are often changing and might not be accurate anymore. Consider checking in with the
with certain difficult-to-find or popular items it doesn't hurt to Neoboards!
make a value check! </p>
<Box height="1em" />
<p>
Thanks again to the Waka team for letting us experiment with
sharing their trade values here. Best wishes for everything to
come! 💜
</p> </p>
</PopoverBody> </PopoverBody>
</PopoverContent> </PopoverContent>
@ -456,4 +473,21 @@ function WakaPopover({ children, ...props }) {
); );
} }
// August 21, 2021. (The month uses 0-indexing, but nothing else does! 🙃)
const STOP_SHOWING_WAKA_AFTER = new Date(2021, 7, 21, 0, 0, 0, 0);
/**
* shouldShowWaka returns true if, according to the browser, it's not yet
* August 21, 2021. It starts returning false at midnight on Aug 21.
*
* That way, our Waka deprecation message is on an auto-timer. After Aug 21,
* it's safe to remove all Waka UI code, and the Waka API endpoint and GraphQL
* fields. (It might be kind to return a placeholder string for the GraphQL
* case!)
*/
function shouldShowWaka() {
const now = new Date();
return now < STOP_SHOWING_WAKA_AFTER;
}
export default ItemPageLayout; export default ItemPageLayout;