Commit graph

315 commits

Author SHA1 Message Date
ce2482735c lol oops, fix labeling Sick poses 2020-08-31 00:59:07 -07:00
1c8eba4698 Support tools can set appearance glitched state!
this is also very good! :3
2020-08-31 00:48:54 -07:00
2929c3373e serve glitched appearances, only if no others
Previously, I was filtering out glitched appearances from the canonical ones.

But now, I'm thinking it's better to serve glitched ones than no data for a pose at all.

I'm inspired by the case of the Candy Acara, which has _only_ glitched appearances in our db, and I'd like to mark them for reference—but then the site would treat it as no data at all.
2020-08-31 00:37:12 -07:00
1ef05adce4 Support can label pet poses!
it's good shit, y'all
2020-08-31 00:32:17 -07:00
45ab35216f Add arrow buttons to PosePickerSupport
Easier to move between appearances quickly! I'm adding this in anticipation of a use case of rapidly labeling Unknown appearances—I want it to be easy to label one and go to the next!
2020-08-30 23:27:43 -07:00
5ce5356825 migrate to new useSupport hook
Just smoothing out the API for cases where you want to know `isSupportUser`, but not the secret!
2020-08-29 14:54:02 -07:00
4e923746ce Show empty PosePicker for Support users
For most users, I want to hide the pose picker if there's not actually anything to pick from.

But I want Support users to be able to open it and use Support mode, to inspect and label Unknown poses!

In this change, I add new UI to show a question mark pose picker button, and a note explaining the empty picker; but only show them for Support users.

I also made a new `useSupport` hook, to replace `useSupportSecret`, now that I have a use case for "is support user?" that doesn't require the secret. Will migrate the rest!
2020-08-29 14:49:37 -07:00
5f3b627187 sort Unknown appearances to the bottom of support 2020-08-29 14:33:00 -07:00
d41f80518a fix bug to resize PosePicker when it changes
Previously, toggling between the two PosePicker modes could dramatically disrupt the layout, because Popover didn't know to re-measure itself.

In this change, we add a hacky workaround to simulate a window resize event in moments when we know the content is changing. (The realistic ideal solution would still have these manual triggers, but would use an official API in Chakra to notify the Popper instance directly.)
2020-08-29 14:19:43 -07:00
05e5c5ad3e add petAppearanceById client caching
If we already got this PetAppearance, now `petAppearanceById` knows how to serve it from the client cache instead making a network request!
2020-08-29 13:23:41 -07:00
1e30e7c8b0 add Support mode to PosePicker
Still just read-only stuff, but now you can look at all the different poses we have for a species/color!

Soon I'll make the pose/glitched stuff editable :3

Some sizable refactors here to add the ability to specify appearance ID as well as pose… most of the app still doesn't use it, it's mostly just lil extra logic to make it win if it's available!

(The rationale for making it an override, rather than always tracking appearance ID, is that it gets really inconvenient in practice to //wait// on looking up the appearance ID in order to start loading various queries. Species/color/pose is a more intuitive key, and works better and faster when the canonical appearance is what you want!)
2020-08-28 22:58:59 -07:00
7954c11c74 update support to use petStateId -> id 2020-08-28 21:06:33 -07:00
10a6eff299 WIP pose picker support 2020-08-28 21:06:33 -07:00
5334801aba add zone restrict hack tools
similar to the layer zoning tools I just rolled out!

not thrilled about the outfit state hacks here bc of how we cache restrict on the appearance rather than the item, but oh well! this escape hatch is pretty easy and solid, and it's a cleanup for another day

Also did a code split here, now that this file is getting larger, to only load this for support users. I don't actually care about restricting console stuff to support users (I'd honestly rather not), but saving the bytes is worth it I think, since support mode is pretty easy to enter when we need to
2020-08-28 00:12:41 -07:00
17fa9d06b9 add id to ItemAppearance (+ refactor)
This is in support of a caching issue in a hack tool coming next! Without this, the change to ItemAppearance restricted zones would make other ItemAppearance fields go missing (bc our hack tool didn't also specify them), so the query would re-execute over the network to find the missing fields we overwrote with nothingness—which would undo the local hack change.
2020-08-28 00:10:00 -07:00
a58db2dcd1 add restricted zones to item support UI
Honestly kinda embarrased I forgot this!
2020-08-27 23:09:53 -07:00
4a6a48ccd1 fix typos in item/layer support tools
Oops, I goofed up a fix to "Item ID" and "DTI ID" one time, and was labeling layer IDs as item IDs! Fixed!
2020-08-27 22:33:32 -07:00
136df9d2a2 add DTIHackLayerZone fn to console
A dev tool to preview what an item would look like in a different zone!

To use, open the browser console, and type `DTIHackLayerZone(layerId, zoneIdOrName)`, but replace `layerId` with the layer's DTI ID, and `zoneIdOrName` with either the zone ID or its name in quotes.
2020-08-27 22:32:28 -07:00
b3aa82cc66 enable Apollo dev tools in production
I'm doing this to see if I can give Chips a cute way to hack into local data :p
2020-08-27 21:44:54 -07:00
59ffc86481 update PetAppearance id to match petStateId
Previously, we were using a custom-y `id` field to help Apollo cross-reference `petAppearance` queries with the results from bulk `petAppearances` queries. Now, instead, we deprecate `petStateId`, and start using `id` to have the same stable value!

This is in anticipation of pet appearance support tools: a stable ID will make it easier to edit them, esp changing their pose (which would otherwise have changed the ID!)
2020-08-27 21:32:22 -07:00
bf21716db0 simplify PetAppearance client-side caching
Previously, we would load all `petAppearances` in `PosePicker`, and use cache keys to instantly find it again as a single `petAppearance` in `OutfitPreview` after switching poses.

In this change, we instead have `PosePicker` explicitly load all 6 poses as separate `petAppearance` queries. This simplifies cache sharing between the two components' queries: Apollo can do it automatically, because they were queried the same way in the first place.

I'm doing this in preparation for changing the `id` field of `PetAppearance`, to become `petStateId`. This will help me build pet appearance support tools, by giving the appearances stable identifiers that won't be affected by editing which pose an appearance is!
2020-08-27 21:26:24 -07:00
67e8d6a1f3 fix support logging body names to not be 8-bit
Huh, some 8-bit species are broken and use the standard body ID!

This was causing our body name query to prioritize 8-bit for standard assets, as the alphabetically-first compatible color; but 8-bit isn't marked standard, so the function kept it labeled 8-bit.

This should fix it and show "Standard Draik" when deleting an asset off the standard draik body!
2020-08-21 16:25:04 -07:00
9f3fe820c2 add snapshot tests for loadBodyName
this is setup for the next change, where we'll get to see how the query change affects the body name!
2020-08-21 16:22:16 -07:00
7b1d2d67f0 add body name to support log for removed layer
In practice I saw that this doesn't actually tell you what you _really_ want to know about where the change happened! You want to know it was broken on the Acara or w/e.
2020-08-20 23:23:33 -07:00
10cea2ff92 log support actions to Discord
aaa these came out so nice!!
2020-08-20 23:16:59 -07:00
4fa07de299 support logs for manual color changes
it writes to our discord server, owo!
2020-08-20 22:25:41 -07:00
3f2b4df8f3 remove stray unused outfitState prop
right, we get this value from context now; that's why this STOPSHIP was here but not actually breaking anything!
2020-08-20 21:46:32 -07:00
6821c2b734 Support tool: Remove layer from item
Heck yeah, let's clean these fuckers up!
2020-08-20 21:40:05 -07:00
c94e94538e remove stray console.log 2020-08-19 19:12:56 -07:00
700073df8a fix bug where image load errors would keep loading
Dice reported this, thank you!

My mistake here was that `loadImage` _does_ reject when the image fails to load… but it ends up throwing `undefined`, since I forgot to pass the error along from `onerror` to `reject`!

So we would cancel stuff, but then store `undefined` as our error in state, which our component interprets as no-error.

I tested this by using Firefox DevTools request blocking!
2020-08-19 19:11:49 -07:00
f8e625afd2 hide invalid colors in wardrobe page dropdown
On the homepage, I want to keep the ability to enter invalid species/color pairs, so that you can say "Alien, Aisha" instead of having to pick the Aisha first.

But on the wardrobe page, we were rejecting invalid state changes anyway, so I decided to remove invalid color options from the list. And I added an ability to still switch to any species, and potentially resetting to a basic color automatically to match.
2020-08-19 19:05:44 -07:00
81065fda6a fix bug where search error states are hidden
Oops, our loading state logic was eating the error case! I'm not sure exactly where the gap was happening, but I've rewritten the states to be a bit more foolproof, since that first condition was confusing I think.
2020-08-19 18:11:40 -07:00
f6c228b17e lol fix cached zone names
Ahaha I fucked up a bit! I was indexing into the array of cached zones, instead of looking up by ID. This meant that all zone names were wrong, and some search results weren't loading bc there was no zone data!

I made a fix here, and also added some fallback values, so that if there's an issue in the future we can at least fall back more gracefully than the infinite-spinner case we had here.
2020-08-19 18:01:20 -07:00
47d22ad25c Build cached zones, stop querying on server
In this change, we cache the zones table as part of the JS build process. This keeps the database as our source of truth, while aggressively caching the data at deploy time.

See the new README for some rationale!

I tested this by pulling up dev Honeycomb, and observing that we no longer run db queries to `zones` in the new traces for the wardrobe page. (It's a good thing we did it this way, because I noticed some code in the server that was still loading the zone anyway, and fixed it here!)
2020-08-19 17:50:05 -07:00
7a3a7eeaf9 update test snapshots 2020-08-17 18:49:54 -07:00
4977f1ee54 Revert "cache zone data"
This reverts commit 0f7ab9d10e.

The Production Vercel deploys don't seem to like how I did this build trick, even though the Preview deploys seem fine with it 🤔 Reverting for now, sent a message to Vercel support.
2020-08-17 18:49:37 -07:00
a3423cd6d6 cache asset manifests in the db
Here's just some simple caching: we try to load the asset manifest from the db with the rest of the asset. If it's not present, we load it via HTTP, and write it to the database.

I might try to do a bulk write of manifests at some point, too.

This is because I noticed that one of the main bottlenecks in most of the endpoints now (and definitely the highest-variance) was loading from images.neopets.com.

Another approach I considered was HTTP/2 to load the manifests, because it kinda looks like the server is refusing to open all these sockets at once and effectively does the requests in waves? But images.neopets.com doesn't support HTTP/2 right now anyway, so oh well! (And that would have probably cut us down to ~250ms of HTTP time still, instead of ~600–700. Also, why is network out of Vercel so slow? :p)
2020-08-17 17:50:01 -07:00
0f7ab9d10e cache zone data
I noticed that, while looking up zone data from the db is near instant when you're on the same box, it's like 300ms here!

In this change, we start downloading zone data into the build process. That way, we can have a very fast and practically-up-to-date cache (I'm not sure I've changed it in many years), while being confident that it's in sync with the database source of truth (for things like join queries).
2020-08-17 15:28:05 -07:00
b300718b4a itemSearchLoaders should prime item loader cache
Another perf issue I noticed in Honeycomb for the SearchPanel operation! We re-load the items again by ID, even though we already got them by name. Let's stop that!
https://ui.honeycomb.io/openneo/datasets/dress-to-impress--2020-/trace/aMuhsTjQFZY
2020-08-17 01:41:38 -07:00
d621b4c1a7 fix caching for petTypeLoader
Oops, of course, we weren't actually taking proper advantage of the dataloader here! The queries got over-complicated, but more importantly, subsequent requests to the same loader would re-submit the query!

I noticed it in the SearchPanel operation, in this Honeycomb trace:
https://ui.honeycomb.io/openneo/datasets/dress-to-impress--2020-/trace/aMuhsTjQFZY
2020-08-17 01:33:34 -07:00
6fc508589a don't do Honeycomb in test env 2020-08-17 01:27:05 -07:00
f7997b4dc9 some Honeycomb fixes
We got bit by the "can't run anything after the response finishes" thing

so I'm just forcing the response to wait for Honeycomb submit to finish

I hope this isn't like, just awful for perf lol. but puts to honeycomb seem fast?
2020-08-17 01:16:35 -07:00
ce028e4956 add Honeycomb logging
This will let me see traces for stuff!
2020-08-16 23:28:41 -07:00
362093dfa2 rename item "DTI ID" to "Item ID"
I realized that DTI ID is a bit misleading in this case, where the ID is both ours and Neopets's, if I recall!
2020-08-14 22:11:04 -07:00
281df33278 update snapshots 2020-08-14 22:10:07 -07:00
aa6ce12bbe add Neopets ID to layer support modal 2020-08-14 22:09:52 -07:00
380cbf543b add mutation to set item explicitly body specific
now that Support feature works!
2020-08-14 22:01:27 -07:00
b23f64ad53 show DTI ID in item support drawer
helps make looking stuff up easier!
2020-08-14 22:01:04 -07:00
a2f5dcd498 use real query for item support pet compatibility rule
mutation isn't hooked up yet though! it exists but the sever doesn't recognize it
2020-08-14 21:52:02 -07:00
02c959a837 add explicitlyBodySpecific to Item GQL
for the upcoming Support feature!
2020-08-14 21:12:13 -07:00
3e012ec2c0 Draft UI for pet compatibility rule fields
not wired up to a mutation yet, but it looks pretty!
2020-08-14 21:05:28 -07:00
7a58546700 bug fix for light/dark mode toggle
this will keep it always in the corner of the screen, instead of weirdness when the container is not very tall
2020-08-14 18:21:40 -07:00
500068b41b improve a11y for dark/light mode button
add an aria-label, and move it to a better tab position at the end of the page, to match the visual placement
2020-08-12 10:59:27 -07:00
2aa4d2b2c0 add "more colorful" swf conflict mode
An even better resolution mode for "Dyeworks Pink: Peaceful Tree Garland", which doesn't leave any big chunks or holes, and instead takes all the leaves and gives them chunky outlines 😅
2020-08-12 10:53:35 -07:00
927e26385c make light/dark mode transition smoother 2020-08-12 01:46:27 -07:00
0f97693500 add conflict resolution mode for SWF screenshots
The "Dyeworks Pink: Peaceful Tree Garland" was a tricky case, with animated falling leaves…

we decided that having transparency in the main pet area, and some incorrect transparent holes in the trees, was a better conflict resolution for this one

Probably would be good to manually upload a Totally Good version, but like, this flag is probably good to have
2020-08-12 01:32:25 -07:00
71e1112b63 fix bad dark mode color in item support drawer 2020-08-12 00:43:26 -07:00
086cf8b335 dark mode first draft!
Hey wow this was not so hard, just set some global styles, removed some hardcoded colors, and walked through the remaining hardcoded colors to pick a dark mode variant :) neat!!
2020-08-12 00:37:31 -07:00
12bd9f6b17 fix PosePicker style bug
oops another thing I missed in the refactor! I wasn't providing the selected pose to the hook, so it wasn't styling any of the poses as selected. Now it does again!
2020-08-12 00:35:11 -07:00
ca92af0cf3 fix bug in pose picker a11y labels
Oops, I removed some fields from the pose object, so the aria-label for the options were coming out as "undefined and undefined"!

Now they come out correct!
2020-08-12 00:32:10 -07:00
edce0a9a76 add 1px of padding around Flash preview area
I tried to get the alignment juuust right in Chrome and Firefox, but Dice's computer was still including a 1px sliver of border.

In this change, I'm adding 1px of extra padding between the border and the Flash area. I figure that, if the screenshots are incorrectly aligned by 1px, that's no big deal and I'm okay accepting that slightly-incorrect upload rather than having folks not be able to use the tool!
2020-08-11 22:52:40 -07:00
07f182a78e minor SWF uploader fixes
fixed some warnings, and added window resize as an event trigger for updating the red/green border color
2020-08-11 22:46:14 -07:00
947d35fbfb update test snapshots
I skipped this in the past runs because I had a hard time getting consistency from the results… but they seem to be behaving now?

It really seemed like there were some races on certain query orders… maybe there still is, but my more-reliable connection today is making them resolve in a more consistent order?

Anyway if I see goofs again, I'll consider adding a snapshot matcher that isn't picky about query order 🤔
2020-08-09 23:03:53 -07:00
b520d1095c show new PNG in the app ~immediately
I had a hard time getting this to work the ideal way, but this way is Good Enough! a few seconds delay, oh well
2020-08-05 14:00:53 -07:00
1a9b495558 add detection for whether the entire SWF is visible 2020-08-05 13:25:20 -07:00
10be4c4ea1 use asset proxy for SWF upload tool
Oops, I forgot that in prod the HTTPS wouldn't be happy about loading SWFs over HTTP! Use the asset proxy instead.
2020-08-05 13:08:18 -07:00
d283884781 show % match, not warnings, in SWF upload tool
I think this will be much clearer about whether the warnings are a good or bad amount!
2020-08-05 13:05:17 -07:00
cc61d33d58 oops, fix bad comment to work around compiler bug
This happened in an earlier change too, I forget where, but there's some compiler bug that causes comments placed in this kind of spot to yield this error in production, but not in dev:
https://reactjs.org/docs/error-decoder.html/?invariant=152&args

Oh well, moved the comment!
2020-08-05 01:23:26 -07:00
90b4fc8da4 click to toggle outfit controls on mobile
On mobile, it was pretty annoying that you had to show the controls by tapping the preview area to simulate a hover—because it could also click the underlying elements, and do bad stuff!

Here, I add a click capture to prevent the clicks from going down if the controls aren't visible. And I add a toggle, so that you can dismiss the controls, like how YouTube feels :)
2020-08-05 01:06:05 -07:00
1efc1c0d42 fix item remove button in item search
Huh, weird how we seem to need preventDefault for buttons, but stopPropagation for links? idk, in any case, the Remove button was doing that thing where it clicks Remove but also bubbles up to the container and clicks it too :p
2020-08-05 00:33:14 -07:00
8c653ce879 memoize Item, clicks on mobile are fast now!
This was a surprisingly big win! Item is heavier than it looks, because it has like 6 Chakra components, which aren't expensive but aren't _cheap_ in a re-rendered list that needs to be fast, you know?

And it's even more important on search, where there's a lot of items on the page. (we should virtualize it too but that's a thing for another day)
2020-08-05 00:25:25 -07:00
bf76065faf Perf: memoize some OutfitControls components
I noticed that item wear/unwear is slow on mobile, because we re-render the whole app tree, and my laptop handles that super fine, but my few-years-old fun takes ~300ms, which is very noticeable.

There's some hacks we could do to get faster feedback, but first I'm diving into the render tree to find the unnecessary renders and stop 'em! That should help build perf across the board, rather than in just one spot, and hopefully be less of a weird sore spot :)
2020-08-04 23:58:52 -07:00
0e09510c54 refresh layer support icon, always show on mobile 2020-08-04 23:00:31 -07:00
7bddb7f67e never wrap item action buttons on mobile
The button section was capable of flex-shrinking, and having those wrap pretty much always looks bad imo. Here, we get more precise about the areas and their flex rules, including only letting the name area grow/shrink. (If the screen is too small for the name to wrap further, the panel area container gains a horizontal scrollbar, which feels like a really good compromise imo)
2020-08-04 22:48:17 -07:00
f18ddc1385 always show item action buttons on mobile 2020-08-04 22:44:32 -07:00
a56ca20f69 Finish support tool to upload manual PNGs
Great for fixing those ones that the auto converters can't do!
2020-08-04 18:39:31 -07:00
b3d12d0966 UI to generate transparent PNG!
There's an Upload button but it doesn't go anywhere yet
2020-08-04 17:05:04 -07:00
fce51875d9 add SWF to layer assets in Support tools 2020-08-01 22:54:30 -07:00
d7d7a345a0 rename to ItemLayerSupportModal
the old name was clunky! this is better!
2020-08-01 22:41:03 -07:00
fb51eeec5b switch radio away from all pets after using picker
I think it's more helpful to auto-switch: if you're using the species/color picker for pet compatibility, that's probably what you want! And it's all buffered behind the Save Changes button anyway, so nbd to play a bit fast and loose!
2020-08-01 15:43:50 -07:00
8fdc986ee9 can submit the actual body ID Support mutation!
it seems to actually be changing the things correctly aaaa
2020-08-01 15:30:26 -07:00
e8917936d6 can actually see body ID in pet compatibility form 2020-08-01 14:30:10 -07:00
213f30b2f2 sketched out the pet compatibility chooser
can't actually set things properly yet, but you can scroll through options and see how it fits!
2020-08-01 14:12:57 -07:00
488299353a add appearance layer support modal
Just some metadata for now, want to add body modification next!
2020-08-01 12:50:01 -07:00
05fe511bda stop connection pooling
oof, got "too many connections" from mysql, this is probably gonna be a scaling issue in time… for now, stop requesting a pool of 5, even on dev lolol, and just go with a single connection per instance
2020-08-01 01:42:58 -07:00
63b865ef7c start adding appearance layers support tool
right now it just shows stuff. next step is to make them clickable to open tools for managing the layer!
2020-08-01 01:35:27 -07:00
0cdb6d0da1 stop showing duplicate support secret toasts 2020-08-01 00:42:36 -07:00
3c54653646 UX fixes for item support drawer
One fix was that `position: absolute` stuff was appearing over the drawer, including the item search clear button, oof!

Another fix was for a weird bug(?) in Apollo Client, see comments
2020-08-01 00:35:48 -07:00
0a9d736957 special color mutation actually working!
Note that there's a bug when switching back to the null case… when I look in the Apollo dev tools, it's definitely getting set in the cache correctly at the right time… but the query isn't updating for some reason? I'm hoping it's an Apollo bug that will fix itself someday with an upgrade!
2020-08-01 00:10:12 -07:00
a1d5669ac6 split item query & colors query in Support UI
My hope is that this can help with perf! The colors are very likely to be cached, and we don't need to re-request them from the server here!
2020-07-31 23:40:05 -07:00
cae2f1a977 Set up the special color mutation on the client?
Optimistic UI seems to just be like, not working… I'm seeing some Google results suggesting maybe just get to v3, which is a bit of upgrade work but might be worth it
2020-07-31 23:34:15 -07:00
2eb1c9b780 show the actual manual special color in support UI 2020-07-31 23:33:12 -07:00
f747bfb004 load special colors into support UI 2020-07-31 23:33:12 -07:00
b310f2334d draft UI for item support drawer
Special color is mocked out, but not backed by real data or actually changeable!
2020-07-31 23:33:12 -07:00
4aece9d703 fix PosePicker portal for Chakra UI Next
Oh oops, Chakra UI Next deprecates usePortal for the popover, so it wasn't escaping properly! Add a Portal component to let it escape the top area again!
2020-07-31 23:31:51 -07:00
7f8401ff4b fix apollo client 3 initial item load bug
I guess if you return a reference to an object that doesn't exist, it registers as null; and you need to provide the `true` here to declare that it _is_ real and should be treated as an _insufficiently_ defined object?
2020-07-31 23:21:34 -07:00
8211444d67 apollo client 3 initial upgrade
Some bugs remaining… outfit items don't show up at first, and item search and scrolling seems _very_ weird, wearing is broken too…
2020-07-31 23:10:34 -07:00
ffde7172de enable HTTP caching for pet appearances 2020-07-22 23:08:28 -07:00
9f11c83b20 extend the loading delay on homepage preview 2020-07-22 22:15:07 -07:00
5a9d2f6566 show a preview of color/species on the homepage
Using the newly extracted OutfitPreview! I'm really happy with how this turned out :3

It also makes the pageload after clicking Start super smooth, no spinner! Thanks Apollo cache!!
2020-07-22 22:07:45 -07:00