Commit graph

114 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
aa6ce12bbe add Neopets ID to layer support modal 2020-08-14 22:09:52 -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
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
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
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
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
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
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
9164d89240 extract OutfitPreview into a shared component
I wanna use it in some other places soon, like a outfit-sharing page, and on the homepage to preview stuff
2020-07-22 21:29:57 -07:00
d30c3fc1b5 a cute new hanger spinner ^w^ 2020-07-20 22:18:39 -07:00
1cc7b3cbe1 more directory structure inside app 2020-07-20 21:41:26 -07:00