Commit graph

1095 commits

Author SHA1 Message Date
3e981d82b4 Extract getVisibleLayers to its own file
I'm doing this in preparation for an API endpoint to build outfit images by ID. It'll need the same logic to decide which layers are visible, and the same GQL fragments to load the relevant data!
2021-05-13 17:33:54 -07:00
eec73d245b Add PB badge to items in search / homepage
Oh right, labeling PB items as NP is confusing! Here, we add a "PB" case to the lil badge on the corner of the item thumbnail, in item search page & homepage Newest Items.
2021-05-13 16:24:24 -07:00
c8feb9a7e0 Fix infinite loop when searching for Markings
Oops, we did an in-place sort on the search variables we passed to Apollo! This meant that Apollo's first read of the variables wouldn't match later reads, so it would always decide the variables had changed, causing an infinite re-render loop.

Remember to copy existing arrays before sorting! 😅

Incidentally, this only happened for Markings, by coincidence: it's the only (I think) searchable zone label with multiple zone IDs, that don't sort alphabetically the same as they sort numerically. This `.sort()` sorts them alphabetically, whereas they come in numerical order in `allZones`, because that's the order the GQL server returns them in `build-cached-data.js`.
2021-05-13 00:28:06 -07:00
b521f79a13 Don't auto-select the first item search filter
There have been usability problems with this search filter UI, and I think they mostly come down to people accidentally selecting filters when they don't mean to—sometimes pressing Enter to indicate that they're done typing, but accidentally selecting something.

Here, we remove that behavior, and additionally add a new behavior to clear the suggestions on pressing Enter.
2021-05-12 23:08:54 -07:00
9ea8245208 Serve pet name as id too in GQL 2021-05-12 22:52:58 -07:00
92a4fd4808 Use Fastly to cache our PNG assets from S3
We've been serving images directly from `impress-asset-images.s3.amazonaws.com` for a long time. While they serve with long-lasting HTTP cache headers, and the app requests them with the `updated_at` timestamp in the query string; each GET request still executes a full S3 ReadObject operation to get the latest version.

In the past, this was only relevant to users on Image Mode, not Flash Mode. But now that everyone's on Image Mode, this matters a lot more!

Now, we've configured a Fastly host at `impress-asset-images.openneo.net`, to sit in front of our S3 bucket. This should dramatically reduce the GET requests to S3 itself, as our cache warms up and gains copies of the most common asset PNGs.

That said, I'm not sure how much actual cost impact this change will have. Our AWS console isn't configured to differentiate cost by bucket yet—I've started this process, but it might take a few days to propagate. All I know is that our current costs are $35/mo data transfer + $20/mo storage, and that outfit images are responsible for most of the storage cost. I hypothesize that `impress-asset-images` is responsible for most of the reads and data transfers, but I'm not sure!

In the future, I think we'll be able to bring our AWS costs to near-zero, by:
- Obsolete `impress-asset-images`, by using the official Neopets PNGs instead, after the HTML5 conversion completes.
- Obsolete `impress-outfit-images`, by using a Node endpoint to generate the images, fronted by a CDN cache. (Transfer the actual data to a long-term storage backup, and replace the S3 objects with redirects, so that old S3 URLs will still work.)

I hope this will be a big slice of the costs though! 🤞

(Note: I'll be deploying this on a bit of a delay, because I want to see the DNS propagate across the globe before flipping to a new domain!)
2021-05-12 22:49:59 -07:00
7ec4bfcf64 Announce outfit saving on homepage 2021-05-05 00:23:41 -07:00
65af7ef64c Add general error message for wardrobe crashes
Boom, pulled some stuff out into util! Now we also have error boundaries in both panels of the wardrobe page.

You can test this one by visiting `/outfits/new?send-test-error-for-sentry`, just like on the home page! Util component for fake errors owo
2021-05-05 00:22:28 -07:00
6dc6ad2578 Add general error message when page crashes
Previously, we would tear down to a blank white page. Now, for errors within most page content, we show a cute error message with a grundo programmer!

To test, visit `/?send-test-error-for-sentry`, which will trigger an intentional render error on the home page.

Note that this does _not_ cover pages that don't use PageLayout, namely the wardrobe page! I'll want to add other boundaries there…
2021-05-05 00:09:09 -07:00
aa0a66fe6d Oops, fix a crasher on item search page
Crashes on clearing the search box. I really thought I fixed this when I refactored `forceReset` to be a function, but I guess I missed it when I went back-and-forth deciding whether to actually do the refactor!
2021-05-04 18:56:00 -07:00
e63c4ea68f Stop adding extras to Your Outfits after save 2021-05-04 18:38:14 -07:00
e7ad4dc39e Avoid extra rename action logs 2021-05-04 16:32:01 -07:00
76aca48b43 Warn user of unsaved outfit changes 2021-05-04 16:31:48 -07:00
8e18262db0 Fix making changes while outfit is saving
Before this, if you made a change while the outfit was auto-saving, it would reset your changes back and forth in an infinite loop, oops!

This was because the response from the save would reset the outfit state to match, but the _debounced_ outfit state would still show the user's changes, so we'd trigger another save. And then the same thing would happen in reverse, and back and forth again!
2021-05-04 13:43:32 -07:00
3088b97ad2 Enable auto-saving while searching for items
This means hoisting `useOutfitSaving` up to the top of the page! We had it down lower for iteration convenience to start :)
2021-05-04 13:28:29 -07:00
b6274193d5 Hide outfit thumbnail in wardrobe after loading
Oops, it was possible after saving an outfit to get into a state where we would show the `<OutfitThumbnailIfCached />` behind the outfit even after it was saved, and then removing items would look weird until auto-saving caught up.

We had used the `backdrop` property because we wanted smoother partial load-ins, but for now I'm just fixing this by switching it to `placeholder`, which already has the right loading-only behavior.

This was also the only call site for `backdrop`, so I've removed it!
2021-05-04 12:33:13 -07:00
995a2b8a3a Fix infinite loop bug on initial outfit save
Oops, the sequence here was:
1) Save a new outfit
2) The debounced outfit state still contains id=null, which doesn't match the saved outfit, which triggers an auto-save
3) And now again, the debounced outfit state contains the _previous_ saved outfit ID, but the saved outfit has a _new_ ID, so we save the _previous_ outfit again

and back and forth forever.

Right, ok, simple change: if the saved outfit ID changes, reset the debounced state immediately, so it can't even be out of sync in the first place! (I also considered checking it in the condition, but I didn't really understand what the timing properties of being out of sync due to debouncing would be, and it seemed to not represent the reality I want.)
2021-05-04 12:33:13 -07:00
1d97988383 Finish outfit auto-saving!
Hope it actually work-works lol

Did some refactors in useOutfitState to support the new reset action we do after auto-saving, in case the server tweaked things like the name.
2021-05-04 12:33:13 -07:00
217aa8dcc1 [WIP] Outfit-saving UI
The auto-saving frontend! It seems to trigger saves at the right times, but they fail, because the backend doesn't support updates yet!
2021-05-04 12:33:13 -07:00
56e1ce595c Fix misc lint errors
I ran `yarn eslint src`, and fixed everything I saw!
2021-05-03 15:06:07 -07:00
ec3aa1747d Lint against console.log
and replace `console.log` instances in the codebase with better alternatives!
2021-05-03 15:01:49 -07:00
71a6dbdad7 Oh right, stop leaving console.log lying around 2021-05-03 14:57:10 -07:00
c508d49272 Add glitch message for Faerie Uni
Note that we implemented the actual horn behavior described in the message, simply by marking the yellow horn appearance glitched for Fem, but not for Masc! Also, we don't have a yellow-horn Sick Masc model, so it's blue too.
2021-05-03 14:52:50 -07:00
f3e9df2d91 Fix PosePicker support modal
It wouldn't open, because I'd set `isLazy` on the popover, so opening the modal would close and UNMOUNT the popover, which unmounted the modal!

Now, we use the new `lazyBehavior` prop to keep it mounted _after_ the first time it opens. This is why I needed to upgrade Chakra!
2021-04-30 12:48:49 -07:00
e735b9b0f6 Disambiguate some UC conflict glitch message cases 2021-04-29 12:59:33 -07:00
cb104954af More aggressive zone filtering for UCs 2021-04-29 12:38:31 -07:00
d373a7a54f Add restricted zones to pet appearance support UI 2021-04-29 11:52:25 -07:00
cb2a5bc912 Don't add ?state until opening Support pose picker
Oops, I made a recent change to automatically add `appearanceId` to the outfit state when you open the Support pose picker, to avoid navigation issues.

But I didn't realize this happened _silently_ when you open the page as a Support user, because the Popover preloads!

Now, the Popover doesn't preload its content. This is probably better for normal users too, the PosePicker UI is a bit heavier with 6 previews than I really want!
2021-04-28 15:00:34 -07:00
f3173db7b3 Fix bug unwearing/removing search results
Oops, our "items to reconsider" feature was preventing unwearing/removing items you're already wearing!

This feature helps you try stuff in Search, without disrupting your outfit. e.g. if you try on a new Background, then change your mind and unwear it, then we reapply whatever old Background you had on the outfit before.

But this made it impossible to remove your _current_ background from the search page if you went back and searched for it again, because we would remove it and then reconsider and reapply it 😅

Now we, um, stop that!
2021-04-26 07:21:47 -07:00
6517087568 Improve search result click performance
Huh, dunno when I regressed this! Or maybe I never did it for search results, just the main items page? But we're needlessly re-rendering the entire search results list when you wear/unwear something, because `onRemove` always changes, and that breaks the `React.useMemo` on `Item`.

Now, we cache the `onRemove` callback with `React.useCallback`, so perf is much happier!
2021-04-26 07:14:29 -07:00
571b064fb5 Oops, fix crash for empty manifests!
Lol whoops I goofed up what happens when there's no manifest! Ooops
2021-04-26 06:48:33 -07:00
d98a533dce Update asset manifests after 3 days of staleness 2021-04-26 06:40:05 -07:00
6918b3cefa Fix bulk-add layers tool
Oops, we extracted Support fields out from the default `appearanceLayerFragment`!

This was causing the page to silently fail to show any changes, because `layer.remoteId` was evaluating to `undefined` rather than one of the ID numbers in the range.

Here, I've added both `remoteId` explictly because we use it directly, and also the support fields because that's what the layer support UI needs!
2021-04-26 06:07:52 -07:00
3a4e5d7e13 Whoops, fix lint 2021-04-26 05:52:43 -07:00
de27c4297d Stop reverting PosePickerSupport with cache data
Oops, making changes in PosePickerSupport would sometimes trigger a re-fetch in PosePicker.

Specifically, PosePicker needs some fields that PosePickerSupport doesn't, so changing the canonical poses causes PosePicker to ask for stuff again—which will probably serve a SWR'd cached version that doesn't reflect the Support changes!

Here, we update the PosePickerSupport query to prefetch all the fields the PosePicker _would_ want for any of these poses. That way, if we swap in a new one as the canonical appearance for a pose, there's no refetch needed, and therefore no risk of hitting a stale cache.
2021-04-23 16:05:52 -07:00
e955817acf Don't navigate away after updating a pose 2021-04-23 15:58:47 -07:00
f223424cfa Add total count to /support/petAppearances 2021-04-23 15:37:52 -07:00
61636a0067 Better focus/hover UI on /support/petAppearances 2021-04-23 15:34:16 -07:00
72e4fa0ad0 More precise data for /support/petAppearances
We move to an actual GQL query, instead of approximating with /api/validPetPoses.

Notable changes are omitting glitched states from UNKNOWN, so we don't prompt Support users to fill in missing states with bad states; and omitting glitched states from standard, so that we _do_ prompt Support users to check UNKNOWN states for new _non-glitched_ versions we can start to use.
2021-04-23 15:31:10 -07:00
a0107aaf7b Add createdAt and updatedAt to Outfit GQL
Not used in-app yet, but Dice wanted it for the Discord Neobot!
2021-04-23 13:02:18 -07:00
14ec4585d7 Oops, fix stale-while-revalidate for modeling data
Huh, I used max-age=1, which suggests to me that I _meant_ to put SWR in here too but just forgot! Oh well lol, fixed now!
2021-04-23 12:12:15 -07:00
a14bddb39e Separate modeling queries into public vs user data
This will enable better caching! Though it looks like the stale-while-revalidate isn't coming through on modeling public data, I wonder why?
2021-04-23 12:10:16 -07:00
2f7b6571f2 Fix loop in useFetch
Oops, my recent change made it so `useFetch` started re-requesting stuff in an infinite loop 😅 right, this is how effects work, lol!
2021-04-23 11:48:38 -07:00
0fe83419f7 Navigate Support directly to unknown pose 2021-04-23 11:44:55 -07:00
a16765b27e Fix lint errors 2021-04-23 11:40:49 -07:00
cc0833f7ac Add explainer info to /support/petAppearances 2021-04-23 11:38:52 -07:00
aa28ee8b39 Add /support/petAppearances page 2021-04-23 11:31:25 -07:00
8b5ba60ea8 Check for new outfit saved indicator in Cypress 2021-04-22 02:44:45 -07:00
99e0fdbf59 Add indicator for whether changes are saved
Now, when viewing a saved outfit that you own, you'll see a "Saved" indicator if it matches the version on the server, or a temporary UI of "Not saved" and a tooltip if not.

Auto-save coming next!
2021-04-22 02:35:59 -07:00
dc6d5b5851 Minor variable name change 2021-04-22 01:59:49 -07:00
34b69a5e2b Oops, show the 600x600 image in pet layer support
Previously, the PNG link for a pet layer would show the 150x150 version. This was both an inconvenient size, but also not reflective of how the layer actually behaved, because we only use Neopets's official PNG for the 600x600 version!
2021-04-21 22:08:15 -07:00
b9b6667414 Add support tools for pet layers 2021-04-21 22:06:07 -07:00
e8a2b8ba28 Rename {Item -> Appearance}LayerSupportModal
In preparation for extending it to non-item layers? 👀
2021-04-21 21:29:10 -07:00
2617052da0 Oops, fix lint errors 2021-04-21 21:27:10 -07:00
c64f542829 Reload Your Outfits after saving an outfit 2021-04-20 02:26:46 -07:00
6640a2d8ca Can save outfits with items 2021-04-20 02:12:07 -07:00
f504808e12 Oops, fix crash saving untitled outfits 2021-04-20 01:53:30 -07:00
5ac758cc72 Oops, don't allow saving existing outfits
Ah, oops, the `id` field from `useOutfitState` went missing and I didn't notice, so `useOutfitSaving` didn't correctly detect that this was an existing outfit!

This made saves on existing outfits create new copies, which isn't a bad behavior exactly, but I don't want to go there; saving a copy is just gonna pollute people's outfit lists rn, worse than no option imo.
2021-04-20 01:50:42 -07:00
f9b07dad24 Can save new outfits w/o items
Just a basic e2e starting point! Simple logic, with simple gates to prevent saving outfits we're not ready for. Safe to ship, despite being very incomplete!
2021-04-19 03:56:51 -07:00
531ca3c22f Create Cypress command to log in
I'll use this to test outfit saving!
2021-04-19 02:22:45 -07:00
9f2629ae61 Fix crash when editing saved outfit
Oops, something I didn't test in the recent refactor! Right, these need to be Sets.
2021-04-16 23:49:10 -07:00
71215fe599 LRU caches to speed up outfit layer preload
The layer preloader already takes advantage of, and primes, the HTTP cache.

But we still do duplicate work, on every OutfitPreview render, to re-execute movie clip libraries, and create a movie clip to test for animations. The former is nontrivial cost, and the latter is often large cost. This can make even basic outfit changes slow, when there's no change to the movie clip layers and the player is paused!

Here, we add an LRU cache for movie clip libraries, and for the question of "is it animated?". This should speed up a number of places where we would reload the movie (including between toggling the item), and various changes that were triggering full movie clip rebuilds unnecessarily.

We _aren't_ solving here for the fact that toggling an animated item requires rebuilding the movie clip, which could conceivably be cached—but with some state management trickiness, because ideally it should be a separate clip for each context where it's being shown. Imo not yet worth the effort! (esp because I think users understand that toggling an animated item can be slow, whereas this was affecting _other_ actions way too much)
2021-04-16 20:16:56 -07:00
6f03a13516 Serve null outfit names for anon outfits
Oopsie!
2021-04-16 19:26:07 -07:00
e3ac9d06e5 Handle non-existant outfits better
Gotta remember to check the validity of IDs earlier than that lol!
2021-04-16 19:18:28 -07:00
9e2f9eab16 Better support for colorId=0
This is a glitchy state that pets can get into! `spankaroonie` is an example, at time of writing.

Before, we would crash on loading downstream fields for the pet's color. Now, we don't! We also fix an oversight in the pet's `petAppearance` field, to trigger the "not yet modeled" error when the pet type doesn't exist.
2021-04-16 18:47:21 -07:00
ddd224c8d1 Handle null outfit creator, oops! 2021-04-16 18:41:26 -07:00
fd931c064e Merge branch 'outfit-saving' into main 2021-04-16 04:32:45 -07:00
405e35a546 Basic outfit state Cypress tests 2021-04-16 04:27:19 -07:00
e1f9f87695 Add ?loadPet param to support custom search engine 2021-04-16 03:15:24 -07:00
8d18bc06b7 Refactor outfit state selection
Here, we consolidate useOutfitState to get its base `outfitState` from a few different places: parsing the URL, and processing the saved outfit data, return an object of the same shape as the state stored in the reducer.

This enables us to just pick one of the three, instead of our kinda awkward individual-field fallbacks.

This will also help us with some upcoming work to make Back/Forward navigation work better.
2021-04-15 17:17:53 -07:00
4bc4e98a0a DISPLAYS_INCORRECTLY_BUT_CAUSE_UNKNOWN pet layers
Now we show a message for pet layers with the DISPLAYS_INCORRECTLY_BUT_CAUSE_UNKNOWN glitch applied! Previously, there would just be no message, because we only had UI logic for when it was applied to an _item_ layer.
2021-04-13 17:17:42 -07:00
3e3188786c Add glitch OFFICIAL_MOVIE_IS_INCORRECT
Some of the "MiniMME11-S1: Approaching Eventide Skirt" visuals are pretty clearly glitched on TNT's end, like the Jubjub, which just has a single flat version of the dress floating in the corner of the screen.

This is a message to make that case even clearer!
2021-04-12 19:51:19 -07:00
1e4063f0d9 Add glitch DISPLAYS_INCORRECTLY_BUT_CAUSE_UNKNOWN
I'm applying this to the "MiniMME11-S1: Approaching Eventide Skirt" on the Acara, which seems to load all 1000 images from the manifest, but then show no animation and no errors. Not sure what's up, and not inclined to deep-debug until we have a check on whether it works on-site!
2021-04-12 19:36:08 -07:00
5212375c34 Handle very large asset manifests
Huh, so apparently the "MiniMME11-S1: Approaching Eventide Skirt" on the Acara has 1000 layer images lol.

This caused the manifest string to overflow the MySQL `TEXT` field, and fail to parse as valid JSON when loading it back for the client.

I've updated the database to use `MEDIUMTEXT` instead, and added a warning message & skip behavior when the manifest size would exceed the database limit, and added graceful error handling for the invalid JSON scenario. Now, we don't crash, and the data self-repairs, and keeps in a better state in the first place!

But I'm also worried about this asset, it doesn't play correctly anyway, and I'm not sure if that's an overload on our end, or just a flat problem in the JS. (There's no error message on the client, it just… loads all the layers, then shows no play button, seemingly self-satisfied.)
2021-04-12 18:58:28 -07:00
020ac572e4 Use asset IDs when looking up pet's PetAppearance
This was causing a bug where unlabeled poses would cause pet lookups to fail!

Now, we return the actual pet appearance for the pet, if we have it, by matching against asset IDs first.
2021-04-12 18:30:41 -07:00
4cb47f3c7c Don't crash if auth0 credentials are missing
I'm setting up the app in a fresh box, and I noticed that the Auth0 credentials are an immediate crasher if not present. That doesn't seem ideal to me for something only used in support actions! I'd rather just have that support mutation crash, if we happen to call it.
2021-04-12 18:05:00 -07:00
b80149440d Merge branch 'waka-ui' into main 2021-04-08 18:32:46 -07:00
b92b5696b4 Remove unused import 2021-04-07 22:12:03 -07:00
089654e092 Use VERCEL_URL for waka loader if given
Oh right, our preview deploy was loading the prod allWakaValues data! Now it uses the VERCEL_URL env variable to request from the current deployment instead.
2021-04-07 22:02:10 -07:00
a32bc34171 Tweak Waka tooltip copy 2021-04-07 21:46:03 -07:00
ce57f9a67a Fix crash on pressing Escape in item search 2021-04-07 20:24:45 -07:00
2b93e5cca7 Waka tooltip copy edits 2021-04-07 17:37:38 -07:00
be816d89c9 Waka item page UI! 2021-04-07 16:48:41 -07:00
d918162a2f Minor bugfix in wakaValueText
This is the same user-facing behavior, but stops logging errors for items that are _expected_ to not have Waka data
2021-04-03 14:32:12 -07:00
a73427af1e Add 1-hour caching to wakaValueText
One day is too long! I'd prefer 1min for just the value itself, but I don't want to bog down all the other metadata with it, it's not _essential_ for it to be faster.
2021-04-03 14:29:37 -07:00
df71a16354 Add wakaValueText GQL field to items
Again, I think I'm getting a bit ahead of myself :p Mostly I wanted to see if this architecture would work out!
2021-04-03 14:26:41 -07:00
5cd6fac052 Apr 1 "New Updates" 2021-04-01 20:10:06 -07:00
6f6fc264af Add NC/NP tags to homepage & search result items 2021-04-01 20:08:35 -07:00
e0c7a4d82c Add OFFICIAL_BODY_ID_IS_INCORRECT glitch
Applied to
- Colourful Female Kiko Dancer Tambourine
- Magma Usul Bow
- Stealthy Elephante Mask
- Wocky Gadgeteer Air Balloon
2021-03-30 22:27:34 -07:00
8487d9674a Only show Save if logged in 2021-03-29 19:50:34 -07:00
06ec0b0b52 Add disabled save UI 2021-03-29 19:46:21 -07:00
7a7c166148 Move Rename into outfit menu
More stuff will be there later, mostly I'm just creating the new home, and making room for the new save UI
2021-03-29 19:25:00 -07:00
9f5b8a7e6e Remove stray import 2021-03-28 16:24:12 -07:00
bfd2d78d76 Fix extra horn bug for Wraith Unis 2021-03-23 18:59:06 -07:00
7c9f4828f9 Add toggle to show/hide older trades 2021-03-23 18:52:01 -07:00
3984f9c9ba Filter trade counts to the last 6 months 2021-03-23 18:32:22 -07:00
62952b80dd Can edit closet list text, incl as Support
I wanted the ability to clear out closet list text for Support users, and figured I should just build the UI for end users too, and grant Support users the same access!
2021-03-23 17:48:11 -07:00
790c231b5d Add "Send email" button for Support users 2021-03-23 16:50:09 -07:00
0e8e50b054 Simpler, faster modeling query
I narrowed down the problem to the fact that we were joining in pet types against assets, and *then* running GROUP and DISTINCT and everything. Assets x compatible species/color pairs is a LOT of rows!

Here, we instead get all the relevant body IDs first, and *then* match them against pet types—which we fetch in one batch to match body to canonical species/color.

I'm also trashing the weird caching mechanism we did here, because in practice it doesn't seem reliable anyway. If anything, I'd want to look at stronger CDN caching. (I made a small improvement to the caching annotation, but ultimately it still doesn't matter, because this query uses logged-in stuff and always comes out max-age=0 anyway.)
2021-03-18 13:02:06 -07:00
1f103989a3 Add blanket warning for invisible pets 2021-03-18 09:02:40 -07:00
85c17a177c add comment about pet appearance glitch message 2021-03-18 08:58:40 -07:00
0b16278703 Add message for glitched pet appearance
Seeing this right now with a lot of Invisibles, who have faces but we don't have the correct faceless ones in the db yet
2021-03-18 08:31:12 -07:00
a848533c7c Add OFFICIAL_SWF_IS_BROKEN glitch
Snug Hissi and Old School Draik outfits are gonna be labeled with this!
2021-03-18 06:59:21 -07:00
6638ff409e Extract OutfitKnownGlitchesBadge to new file 2021-03-18 06:40:52 -07:00
db8e7848d7 Glitch info for pets w/ OFFICIAL_SVG_IS_INCORRECT 2021-03-17 05:54:34 -07:00
a66fa02f15 HomePage updates Mar 16 2021-03-16 09:10:02 -07:00
17d75ee97f Add color and step-value support for bulk add
This is enough to start fixing items like Baby in a Pumpkin! Hooray! 😁
2021-03-15 13:28:16 -07:00
92db11b995 Add REQUIRES_OTHER_BODY_SPECIFIC_ASSETS glitch
This helps with items like "Living in Watermelon Foreground and Background", which has a species-specific foreground and bodyId=0 background.

With this flag set on the background, it won't appear for pets that don't _also_ have something else that fits. In this case, it hides it from Standard Vandas, and all non-standard colors.

There's some hacky limitations here: the item page still highlights the Vanda, even though clicking gives nothing; and the zone info for it is messy too, with the Background claiming to fit all species, and the LFI claiming to fit 54 specific species. But those don't seem important enough to code for!
2021-03-15 12:44:40 -07:00
4e9805af60 Bulk-add tool actually saves stuff!
I fixed Dug Up Dirt foreground, hooray! Hope it sticks
2021-03-15 09:13:25 -07:00
5f32d80022 Oops, fix backend syntax error
Right, I keep forgetting that my local env isn't picky about this, but prod is
2021-03-15 08:29:26 -07:00
1dce12e792 Oops, fix item previews with bodyId=0!
The other day, I deleted what was apparently a load-bearing glitch row, lol 😂

We had a row in pet_types that somehow had `body_id = 0`. And I guess that was causing this query to return some species, even though that body has no species.

Here, I'm adding support for the special `representsAllBodies` body's species to be null. The client seems chill with it, we weren't using that property in that situation anyway!
2021-03-15 08:22:17 -07:00
c0e70b4c62 Preview + save UI for bulk-add tool
still not wired up tho!
2021-03-15 08:11:10 -07:00
67245d6f70 Add support for no-Vanda items to bulk-add tool 2021-03-15 07:58:44 -07:00
e4c8031c3b Show previews for bulk-add layer tool 2021-03-15 07:50:13 -07:00
9eb0906a69 Copy tweak for item support drawer 2021-03-14 08:13:17 -07:00
b1ca7c6bab Tweak zone labels in support UI
I like making these more concise and consistent across the dropdown and the cards, I'm still not 100% sold on the design but it seems ok for now!

At first I had it in the dropdown as "Background (3)", but realized that conflicts with the usual pattern of like, saying how many items match a certain filter…
2021-03-14 08:07:41 -07:00
f3f8f6748f [WIP] A better TODO message for the bulk add tool 2021-03-14 07:57:56 -07:00
d2eb941c24 [WIP] Add bulk-add form to "Layers on all pets"
It doesn't work yet though! Just form UI!
2021-03-14 07:50:21 -07:00
2dcfc7524a Add Neopets ID to support layer UI
Using this to get an at-a-glance check on how Neopets IDs are typically assigned for body-specific items… looks like it's increasing, and alphabetical by species? (not by species ID?)
2021-03-14 07:18:36 -07:00
7c5e7ab21a Add Support view for all appearances of an item
I think this will be generally useful to minimize switching around for common operations, but also I'm thinking of building a bulk assign tool for things with broken body IDs, and this will be the place for it to live, I think
2021-03-14 07:16:01 -07:00
535abec228 Oops, fix manually NC condition!
Oops, we weren't doing a good job encapsulating the different conditions in item search. The `OR` in the NC condition was causing a precedence problem!

Now, we wrap all the conditions in parens at the interpolation site, to make it really clear that they all need to be made safe like that!

Now, there's not a bunch of "??????" entries in NC search, oops 😅
2021-03-14 05:28:57 -07:00
927401fc92 The NEW UC rule is that non-body-specific is okay! 2021-03-13 07:21:40 -08:00
36b0cb75e5 Add Twitter link to homepage updates 2021-03-13 03:18:32 -08:00
df225dc1ae Add Twitter button to footer 2021-03-13 03:14:35 -08:00
841c96d56a Fix crash when knownGlitches is undefined
Not sure exactly when in the flow this happens! But spooky! Don't crash!
2021-03-13 02:21:32 -08:00
1f7ef43e8b Add glitch message for unconverted Dyeworks items 2021-03-13 02:18:44 -08:00
65f74897da Fix alignment for outfit badges
Woof, I haven't done a big screen in a while, centering them is yikes!
2021-03-13 02:06:34 -08:00
99e887105c Copy tweak for OutfitKnownGlitchesBadge 2021-03-13 02:02:34 -08:00
da2b8813c2 Oops, fix HTML5 badge for Flying in an Airplane
Oops, the HTML5Badge was using the presence of an `svgUrl` to decide if the item is converted!

Here, we add an extra condition that if the OFFICIAL_SVG_IS_INCORRECT glitch is applied, then *that* indicates HTML5 conversion, too.
2021-03-13 02:00:32 -08:00
5a74b9df8f Add glitch message for OFFICIAL_SVG_IS_INCORRECT 2021-03-13 01:58:06 -08:00
6ebbc4af02 Explain Static UC conflict in a new glitch UI 2021-03-13 01:48:12 -08:00
d7fe05c42c Refactor: Extract OutfitHTML5Badge
I'm gonna add glitch stuff too, and I want all this better encapsulated!
2021-03-13 01:33:00 -08:00
d44315de2c Oops, actually Static hides UCs! 2021-03-13 01:08:48 -08:00
56dd2bbdd7 Hide Static zone for UCs, just like restricteds 2021-03-13 00:51:13 -08:00
e423affa6d Homepage updates Mar 12 2021-03-12 07:58:33 -08:00
56e9df719a Stop encoding punctuation in item search bar
Typing "foo:bar" would re-encode to "foo%3Abar"!
2021-03-12 07:44:59 -08:00
bdc4cdf46b Use official PNG when available, instead of ours
This was one more bit that needed fixing for "Flying in an Airplane": it wasn't just the official SVG that was incorrect, but also the official SWF. So our converted PNG was also incorrect!

Here, we now try to use the official Neopets PNG when the manifest provides it, instead of our own.
2021-03-12 04:28:57 -08:00
0aaf1adb29 Add Support tool for OFFICIAL_SVG_IS_INCORRECT
Inspired by the "Flying in an Airplane" bug (item 82287), where the official SVG (and I think SWF) were visually glitched and included both zones in the image, but the official PNG was correct.

This flag lets us use the PNG, like the official player does—but only for this item, while still keeping SVGs for everyone else!
2021-03-12 04:01:35 -08:00
15d4a27657 Link to both new and old manifests in item support 2021-03-11 08:52:46 -08:00
78354a35d0 Support ?v= for SVG URLs, too 2021-03-11 08:46:08 -08:00
f6f8d3200a Handle ?v= at the end of canvas library URL 2021-03-11 06:38:03 -08:00
dc3008a675 Okay, not _everything_ is on the new manifest URLs
Gonna have to start guessing stuff now!
2021-03-11 02:57:44 -08:00
e220b4e5e1 Whoops, biology still uses old manifest URLs
Huh. Okay! 🤷‍♀️
2021-03-11 02:35:13 -08:00
46066807ad Update to the new manifest URL format
I guess they dropped the hashes! Well, we're very behind on conversion now lol!
2021-03-11 02:16:42 -08:00
d5336cafc4 Add manifest & movie buttons to item support modal
Helpful for debugging HTML5 conversion and making sure we're up to date!
2021-03-11 02:04:04 -08:00
9f61250f05 Ignore unknown body IDs in item compatibility data 2021-02-22 20:00:38 -08:00
7ca548bae0 Wire up the NC support tool for real! 2021-02-22 19:37:24 -08:00
9b16cb8f91 [WIP] Add PB field to NC support tool
Just for clarity!
2021-02-22 19:24:33 -08:00
0ae26a6633 [WIP] UI for isManuallyNc support tool 2021-02-22 19:11:03 -08:00
281fdccb89 Upgrade Chakra, remove tooltip flicker workaround 2021-02-22 19:00:47 -08:00
c539471afa Add is_manually_nc flag
for items that are NC, but aren't marked with r500 on Neopets.com!
2021-02-22 18:05:44 -08:00
614dc0795a Switch to bottom tooltips for zone/html5 info
I've decided that covering up the species faces with other species info is too weird! It feels like it's removing some ability to cross-reference.

A cool UI affordance would be to have this and the faces interact with each other, like you can hover to highlight the relevant species faces, or even vice-versa, to show the relevant zones for this species. But that's probably way overkill for this relatively niche feature.
2021-02-12 18:35:16 -08:00
b276714fc1 Oops, fix layout bug in restricted zones
Too much nowrap! Looked very bad on "Ceremonial Shenkuu Warrior Armour", lol
2021-02-12 18:33:14 -08:00
8e806d178d Visually de-emphasize species counts for zones 2021-02-12 18:31:12 -08:00
09cc2e6a2b Don't allow line breaks in zone list items
Some looked really bad in the new design, like Jewelled Staff, which was breaking between the words "2 species", making a real bad tooltip target too.

Now, there's no line breaks allowed inside a list item at all! We force it to break between items, instead. (Could have also maybe implemented this with flex wrapping? This seemed like a straighter path, but…)
2021-02-12 18:25:08 -08:00
7183f0725c Add zone restrict to item page, too
I knew I was forgetting something! lol
2021-02-12 18:15:45 -08:00
7421f41e58 Move HTML5Badge to zones area 2021-02-12 17:46:33 -08:00
2d58627bdd Fix species faces container sizes 2021-02-12 17:33:34 -08:00
e0e85b2add Mention zone info on home page updates section 2021-02-12 16:11:30 -08:00
614bad72d2 Show real zone data on item page
And some Cypress specs to test the basic cases!
2021-02-12 16:09:11 -08:00
20f9573e50 [wip] Zone info UI for item page, with fake data 2021-02-12 15:18:54 -08:00
048fb29c14 Refactor item page preview to grid layout
because I wanna add zones to the area below the faces!
2021-02-12 14:35:14 -08:00
67784bd5e3 Add prev/next pagination to item search page 2021-02-10 14:23:25 -08:00
86de09b285 Add pet status to wardrobe page HTML5Badge 2021-02-10 14:02:18 -08:00
ab21f3a8a5 Remove unused imports 2021-02-10 13:52:20 -08:00
d2c672667d Fix performance problem with defaulting to [] 2021-02-10 13:51:59 -08:00
bbb752fa65 Extract out layerUsesHTML5 function 2021-02-10 13:50:42 -08:00
10e47115bd List non-HTML5 items in wardrobe page 2021-02-10 13:47:02 -08:00
0c80491f99 Add HTML5Badge to outfit page 2021-02-10 13:35:34 -08:00
bf85cef922 Fix HTML5Badge tooltip on mobile 2021-02-10 13:20:21 -08:00
2403bd813a Refactor into WardrobePreviewAndControls component
I'm moving the preview and controls stuff closer together in the code, to clear the way to change `OutfitPreview` into a `useOutfitPreview` hook here!
2021-02-10 12:52:00 -08:00
d2240cc5c5 Increase item preview loading UI delay back to 500ms
I don't remember why we set it to 200ms before, but it feels too aggressive now. Idk!
2021-02-09 23:10:22 -08:00
a03ae98468 Keyboard accessibility for "item needs models" warning 2021-02-09 22:58:00 -08:00
27f441df36 Don't show "item needs models" for invalid pets 2021-02-09 22:56:31 -08:00
4aade5782f Don't flicker the HTML5 badge while loading 2021-02-09 22:55:19 -08:00
f11fbbb831 Don't show error pet preview for invalid pet state
We could also afford to figure out how to not request appearance data in this situation… but not showing the error message is a good first step lol!
2021-02-09 22:38:40 -08:00
9e49b6ae3e Fix text color for OutfitPreview
Oops, I never actually saw the practically invisible text in light mode! Let's make it actually dark in light mode item pages, and still dark in all wardrobe pages!
2021-02-09 22:36:50 -08:00
b0eeb84d63 Disable "Customize more" for invalid pet
Oops, before disabling, we'd build a link with `pose=null`, and that would cause downstream issues on the wardrobe page.
2021-02-09 22:31:50 -08:00
1eb00ba6ca Fix crash when choosing invalid appearance
Oops, I messed up in my `useOutfitPreview` refactor just now! Fixing fixing!
2021-02-09 22:27:22 -08:00
c0e1c78d75 Fix SpeciesFacePicker desktop alignment
Oops, I fixed mobile alignment by centering this, but didn't realize I broke desktop alignment! Now we do different alignment on different sizes 😅
2021-02-09 21:48:18 -08:00
f29a269b94 Use prettier focus outline for HTML5Badge 2021-02-09 21:47:12 -08:00
828fb65cf4 Refactor HTML5Badge
let's de-dupe that stuff, baby!
2021-02-09 21:45:29 -08:00
3599c78a85 Add to home page updates section 2021-02-09 21:41:08 -08:00
b8744037d1 Add HTML5 indicator to item preview page 2021-02-09 21:39:29 -08:00
193273f00f Share appearance data via useOutfitPreview
Here, we offer a second syntax for `<OutfitPreview />`: a hook that offers the same UI as `preview`, but _also_ shares the `appearance` data.

This makes it easier to have UI that depends on the outfit appearance, without having to commit to all the `useOutfitAppearance` stuff in the parent. Same easy syntax! :3

I've refactored the item page to use this for compatibility testing, instead of using the Apollo cache (which was also cute and same perf impact, but more overhead!)
2021-02-09 20:28:03 -08:00
8694729b38 Fix placeholder URLs in safeImageUrl
Oops, I got distracted partway through typing the domain, lol! They point to a real place now, lol! (not a very helpful place, but at least the real one I intended! :p)
2021-02-09 16:16:46 -08:00
10aa4f9905 Also log the non-HTTPS URL case in safeImageUrl
When I added this new error case in the last change, I made it log to Sentry, because I don't think this should be possible under our data set, so if it happens I want to hear about it. Same is true for this error case, so let's log it too!
2021-02-09 16:13:18 -08:00
330e4ee12e Fix URL parsing for Jetsam Lunch Lady items
A crasher, fixed! :) I made Jetsam Lunch Lady Gloves no longer crash the page, lol - its thumbnail URL is "/items/clo_jetsam_lunchladygloves.gif", with no host specified. The shoes are the same!

I also added a fallback, to return a placeholder error URL instead of just letting the URL through as-is—and I updated the other error case to behave the same. I'd rather have a specific isolated feature get crashy, than have the mixed content warning pop up, or let through some mystery unparseable URL that, idk, might be part of an attack?? Seems better to fail hard-but-small than easy-but-potentially-leakily.
2021-02-09 16:11:32 -08:00
fe5eab5763 Fix stray null error in SearchToolbar
Oops, we don't provide this in the item search page, so check for that!
2021-02-09 16:05:21 -08:00
e6200df49d Speed up dev server by skipping persisted queries 2021-02-07 00:18:01 -08:00
2115bd64a7 Add ?offset parameter to item search page
No links to it yet, but it's respected as a way to request other pages!
2021-02-06 22:02:32 -08:00
2d0601cfeb Add total item count to search results
This will help us set up pagination!
2021-02-06 21:50:52 -08:00
6738f07e64 Add expand-on-hover effect to "Customize more" 2021-02-06 15:52:47 -08:00
7620d3f315 Fix alignment bug on ItemPage 2021-02-06 15:21:57 -08:00
922e150020 Extend itemSearch, deprecate itemSearchToFit
I'm gonna extend `itemSearch` to also look up the total number of results, and the fragmentation between `itemSearch` and `itemSearchToFit` finally caught up with me :p

I've deprecated `itemSearchToFit`, and moved the fit parameters into a new optional `fitsPet` parameter for `itemSearch`.

I'm going to keep `itemSearchToFit` around for now, because old JS builds still use it, and I'd like to avoid disrupting folks. But I'm not going to add the new total results field to the results object it returns, and that's gonna be okay!
2021-02-04 23:34:43 -08:00
b9aac7d8d2 Add "Search all items" placeholder to item search
I was starting to write a Cypress test, and noticed there was no placeholder to use for searching, and I don't know how that escaped my notice for so long! I guess I commented it out for some reason, but I forget why, and this seems fine now! (Looks like we removed it when we added zone suggestions? Idk!)
2021-02-04 22:23:34 -08:00
927d783a96 Delete GQL query tests
I haven't been keeping these up to date, so at this point they're more overhead than they're worth.

Helpful in the early days when we were iterating fast and making more mistakes, but now we're more solid (and I learned how to just resend queries from devtools :p)
2021-02-04 21:24:53 -08:00
580fd79b8c Fix loading state after each species face click 2021-02-03 16:14:08 -08:00
c3cb923b58 Increase preview size on item page 2021-02-03 16:08:02 -08:00
f3e19158d0 Fix crash when using old tab to load item page
Oops, the new `canonicalAppearance` arguments couldn't handle being omitted rather than being null, due to a low-level SQL call site that cares about the difference.

This meant that loading an item page in an old tab, with an old copy of our JS, could cause a crash.

Now, the backend will be okay with queries from old pages, and respond the same as before!

This isn't a huge deal, because once everyone is on the new JS we won't send queries without this parameter anyway… but I like my optional arguments to actually BE optional, without surprises lurking >.>
2021-02-03 15:51:49 -08:00
8970b6af26 Remove stray console lines 2021-02-03 15:45:19 -08:00
958d9c16b8 Change "Not modeled yet" -> "Item needs models" 2021-02-03 15:44:53 -08:00
be151ab400 Save user's preferred color for item previews 2021-02-03 15:33:23 -08:00
787dc7da87 Save user's preferred species for item previews 2021-02-03 14:27:02 -08:00
13a5a0a7aa Update "New updates" section on home page 2021-02-03 02:20:03 -08:00
75fccf1adf Load best available pose in SpeciesFacesPicker
Oh right, I left in a hack to just always pick HAPPY_MASC or HAPPY_FEM, back when it was just the basic colors. Now that we're all the colors, we need to be able to handle fallbacks for missing or unlabeled poses, too!!
2021-02-03 02:10:52 -08:00
082af11b5b Don't say "(Can't be this color)" while loading 2021-02-03 01:53:09 -08:00
4431c43663 Enable free color/species input on ItemPage
Previously, I kept this constrained to valid species/color pairs only, because we didn't have a great error state. But at this point, it feels worse to throw people out of the color they're looking at, and to make it harder for them to pick the color in the first place!
2021-02-03 01:51:51 -08:00
6a4be0390a Show a fallback face for valid face options
Sometimes we just don't have the image! Don't let that stop people from clicking it tho!
2021-02-03 01:47:39 -08:00
a293dc56b5 Disable faces that can't be the chosen color 2021-02-03 01:41:03 -08:00
8de85fbc63 Pulse effect while SpeciesFacesPicker is loading
like the Skeleton elements!
2021-02-03 01:27:16 -08:00
27d4bed172 Cross-fade images in SpeciesFacesPicker
Wowie, this was hard to get right, but I'm very pleased with where it ended up!! React `key` stuff was a total brainwave, and even though it depends on kinda obscure knowledge, it made this whole thing WAAAY easier, omg
2021-02-03 01:24:13 -08:00
a42e696955 Show selected color faces for SpeciesFacesPicker 2021-02-02 23:29:06 -08:00
19482be2b8 Use ES module syntax in backend instead of require
Ok cool, so apparently another win we get from using `ts-node` is that I can finally easily use some non-native-Node features like ES module import syntax, for consistency with what I'm doing in the main app source! That was getting on my nerves tbh. Ooh I bet I can finally use `?.` too, I've had to rewrite that a bunch…
2021-02-02 22:26:55 -08:00
4483df2040 Run Prettier on my TS file
VS Code wasn't running it automatically; now we've got it set up!
2021-02-02 21:40:43 -08:00
b58db4a629 Finally finish TS setup, build works!
`yarn build` was crashing on my `build-cached-data` script, because we were trying to run the Typescript file uncompiled!

Now, we run it with `ts-node`, which transparently compiles Typescript files before execution. Phew!

`react-scripts build` made some automated changes to `tsconfig.json` for compatibility with `create-react-app`, and I also added a `ts-node` section to override one of them so we can compile to CommonJS for `ts-node` script execution!
2021-02-02 21:38:57 -08:00
d7028bc2cc One more TS fix, adding a tsconfig.json 2021-02-02 19:29:58 -08:00
cb87fd8a9a more TS fixes 2021-02-02 19:22:47 -08:00
cee5e128cb fix TypeScript build errors
That's what I get for forking a TS file, not knowing TS, and ignoring the errors lol :p
2021-02-02 19:20:02 -08:00
d3b9f72e67 Add stale-while-revalidate cache headers
Oh yay, I'm pleased with this! I hope it works out well!

stale-while-revalidate is an HTTP caching feature that gives us the ability to still serve relatively static content like item pages ASAP, while also making sure users generally see updates quickly.

The trick is that we declare a period of time where, you can still serve the data from the cache, but you should _then_ go re-fetch the latest data in the background for next time. This works on end users and on the CDN!

I've scanned the basic wardrobe and homepage stuff and brought them up-to-date, and gave particular attention to the item page, which I hope can be very very snappy now! :3

Note to self: Vercel says we can manually clear out a stale-while-revalidate resource by requesting it with `Pragma: no-cache`. I'm not sure it will listen to us for _fresh_ resources, though, so I'm not sure we can actually use that to flush things out in the way I had been hoping until writing this sentence lol :p
2021-02-02 19:07:48 -08:00
c00df62bdc More cache hint tags for Item etc
Trying to get that Item page fast!

I don't really want to ship this as-is, because I'd really like to get stale-while-revalidate working before shipping a 1-week cache timer… will be tricky though!
2021-02-02 17:51:54 -08:00
f0b3047112 Defer tooltip renders in SpeciesFacesPicker 2021-02-02 17:08:39 -08:00
bccb36dda2 Improve SpeciesFacesPicker render performance
The Tooltip elements seem to still be taking a bit, I don't really know a great workaround for that… could maybe split it out into a separate box and defer the rendering on it, so it doesn't block the first pageload?
2021-02-02 16:56:26 -08:00
6549bba756 Remove stray console.log 2021-02-02 16:48:08 -08:00
6d05fb8680 Fix bug in SpeciesColorPicker loading state
Oops, I made a fix to the color picker, but not the species picker! Updated them both to match.
2021-02-02 16:46:07 -08:00
f699d867e5 Disable species picker for species-specific items 2021-02-02 16:45:28 -08:00
6c84baca03 Hide alt text while species faces are loading
and some nicer typography when it fails!
2021-02-02 16:35:54 -08:00
adecb4167b Remove extra focus outline for SpeciesFacesPicker
Before the tooltips, I thought the focus state wasn't clear enough at a glance, so I added an extra focus outline to the species faces picker area. Now, I think it's clear enough with the species name tooltip popping up!
2021-02-02 16:31:55 -08:00
e788040315 Guess when item is species-specific, for UI hints 2021-02-02 16:29:20 -08:00
6f19ef8c88 Fade out incompatible pets, too 2021-02-02 16:06:33 -08:00
382c1c9da3 Fix tooltip hover flicker in SpeciesFacesPicker 2021-02-02 16:01:46 -08:00
28f457e21f Always show species face tooltip in keyboard nav 2021-02-02 15:43:36 -08:00
cdff51dfef Hook up compatibility data for SpeciesFacesPicker
It looks really nice!! :3
2021-02-02 15:22:08 -08:00
93c00c5e79 [WIP] Species face compatibility UI
Now, when a species isn't compatible with an item, we gray out and sadden the pet, like on Classic DTI!

For now, I've hardcoded only the Zafara body ID to match. Let's do server connection next!
2021-02-02 14:47:17 -08:00
b0a8b41c80 Add focus state to species faces picker 2021-02-02 14:19:11 -08:00
d16bfd9781 Use higher-res pet faces on higher-res devices
Didn't realize there was a convenient 150x150 face thumbnail we could use, so hey! Nice!

At one point I was considering generating our own thumbnails, but this is making me increasingly interested in just scraping the Rainbow Pool or something :p
2021-02-02 13:15:42 -08:00
33353e5328 Fix uncaught promise error in search results
Sentry issue IMPRESS-2020-20 doesn't have a clear backtrace, but it looks like the usual thing where we trigger an Apollo query directly, and forget to catch a potential error in the returned promise. I noticed that the last thing the user did was type in the search bar, and got a _caught_ error for the initial search!

Scanning the SearchPanel file, I think it's likely that this was a failure in `fetchMore` for the infinite pagination.

I'm a bit worried as to _why_ we were doing infinite scrolling stuff when there were no results? I wasn't able to repro a scroll event on the empty results list, but it's plausible that it could happen. I've added a gate to not send this request when there's an error!
2021-02-01 19:08:20 -08:00
05282f4b7b Handle memory issues in OutfitMovieLayer
I think what's happening in Sentry error IMPRESS-2020-1F is that mobile devices are running out of memory, so `canvas.getContext("2d")` returns null.

Now, we have a UI affordance to let you know when this is probably what's happening!

Also, when researching this, I learned about a Safari bug where you need to manually garbage-collect your own canvas data. It's possible that Safari users have been having particular trouble with memory leaks over long sessions? I'm not sure, but it seems like a good idea to add this small garbage-collection code!
2021-02-01 18:55:05 -08:00
5d827bc78d Disable species/color picker while item page loads
Ok I think I've finally narrowed this bug down! We had one more loading case: the items page needs time to figure out which species/color to default the fields to, and passes null into the component while this loads. Now, we wait for that!
2021-02-01 18:05:29 -08:00
be7401d62a Recover from missing pose data
Previously, if you typed a pet name on the homepage, but its pose wasn't labeled in our database, you'd get a black empty screen. Now, we redirect to the UNKNOWN pose, or whatever exists for us to use!
2021-01-28 10:37:04 -08:00
71ec5ddc58 Group poses by emotion first, in PosePickerSupport
I think it's confusing that the poses in the dropdown start with the emotion word, but are grouped by the gender presentation word! It's also different than the precedence order! I've reordered them.
2021-01-28 10:34:09 -08:00
0d14fde318 Add "Customize more" button to item page preview 2021-01-26 15:09:41 -08:00
10e09e266c Add debug logging for species/color picker bug
We're occasionally getting errors on the homepage, of the new message I added: `Error loading valid poses for species=, color=108: byteOffset cannot be negative`.

So ok, now we know it's a species undefined bug, coming from `onChangeSpecies`! That suggests we're not finding by ID correctly?

So I'm adding some new logging to help me understand the sequence of actions leading up to this point, and the species data state when the error itself happens!
2021-01-26 14:08:09 -08:00
f74fc05112 Fix remaining chunk error noise
I've been getting more Sentry errors about JS chunk errors after deploys, and finally looked into it!

Turns out that, our try/catch handling was working great, and the page was reloading correctly for users as expected. But in these scenarios we would _also_ throw and log two uncaught errors!

The first is that, because we're a single-page app, unrecognized routes fall back to the index.html by default (to power our custom client-side routes, like /outfits/123 etc). So this meant that missing JS files, which _should_ be returning a 404, were instead returning 200 OK and an HTML file, which failed to parse. (And running the script isn't included in the catchable part of the `import` promise!)

Now, in our `vercel.json` config, we catch those paths specifically and 404 them. (The exact choice of path is important: on dev, all these routes run _before_ the dev server, which is responsible for serving the static files - but dev doesn't include hashes in the JS file names, so this 404 route only matches built prod JS files, not local dev JS files.)

The second is that we failed to return anything to `@loadable/component` in the error case, so it would try to render `undefined` as if it were a component class. Now, we return a trivial component class that returns null!
2021-01-26 11:43:27 -08:00
03a3f7ede4 oops, remove unused import 2021-01-25 10:59:10 -08:00
f50de9b11e Add species-face picker to item page previews
Note that it doesn't do any compatibility checking, graying out, hiding unneeded faces, etc. They just exist now is all!
2021-01-25 10:24:39 -08:00
7092d86b76 Better error logging for movie clip errors
I'm getting some vague errors in Sentry about `canvas.getContext` returning null? Weird. (IMPRESS-2020-1F)

I'm not sure what that's about, so I don't want to stop sending it to Sentry. But I do want to make sure we handle this kind of error gracefully! (I'm thinking about how, while I don't think this one was, in the future this _could_ be caused by errors in Neopets movie clip JS, and I don't want our app to start messing up because of it!)

Here, we make sure to log the error to the console with more detail (the library URL), and show feedback to the user, and only log the error once per clip (so that animated ones don't like, send a bunch).
2021-01-23 12:43:17 -08:00
7ac9571ce4 Add error wrapper for potential title bug source 2021-01-22 14:47:18 -08:00
8f8c60d91b Fix crash when user items page not found
Huh, I'm not sure why Apollo is returning `data: undefined`, when the server is definitely returning the correct no-user-found data in the shape I expect... suspicious :/ well, let's at least stop crashing!
2021-01-22 14:38:37 -08:00
38969e8658 Use loading state while loading /api/validPetPoses
Oops, we were getting errors when people tried to change the species/color picker before the valid pose data was ready!

This was only happening on the homepage and item page, because on the wardrobe page we wait for the valids to load before showing the picker at all (`showPlaceholders` is false).

To fix this, we add the valid poses loading state to our existing `isLoading` state on the selects, which disables the element and adds a loading spinner cursor. This prevents interactions we're not ready for!
2021-01-22 14:27:23 -08:00