Commit graph

1435 commits

Author SHA1 Message Date
6652e66af1 Show image preview while movie loads
Movies often have a lot of assets, which are more likely to be cache misses, and take script time to render! So the time until the user sees something is often huge.

Here, we start loading our PNG image at the same time. This is a filesize loading increase, but even in slow connections, it's generally worth it as a _sharp_ improvement in time until you get to see something!

One noteworthy UI weakness here is that we don't show _any_ loading indicator while the image is visible and the movie is still loading. This makes sense from a practical standpoint, but could be a problem when a movie takes a particularly long amount of time. I also want to be cognizant of whether the blink-of-content ever gets annoying! (We could make it fade out 🤔)
2021-06-20 11:54:30 -07:00
92001d514a Refactor crossOrigin handling for image loading
In my last change, I didn't try to change the APIs too much, and kept the concept of `crossOrigin` running through `getBestImageUrlForLayer`.

Now, I've moved the `safeImageUrl` call _outside_ `getBestImageUrlForLayer`, by putting it at the call site: We now call `safeImageUrl` from `loadImage` (which needs to know the `crossOrigin` flag anyway!), and at the `img` tag call site.

This simplifies all of the call sites a lot, I think!
2021-06-20 10:54:03 -07:00
c2535f811f Remove proxy for most images
I've noticed that our Fastly proxy adds a surprising amount of latency on cache misses (500-1000ms). And, while our overall hit ratio of 80% is pretty good, most misses happen at inopportune times, like loading items from search.

But now that the Neopets CDN supports HTTPS, we can safely switch back to theirs for *most* image loads. (Some features, like downloads and movies, still require CORS headers, which our proxy is still reponsible for adding.)

This forgoes some minor performance wins (like the Download button now requires separate network requests), and some potential filesize reduction opportunities (like Fastly's auto-gzip which we're today using for SVGs, and eventually using their Image Optimizer for assets), to decrease latency. We could still potentially do something more powerful for low-power connections someday… but for now, with the cache miss latency being *so* heavy, this seems like the clear win for almost certainly *all* users today.
2021-06-20 10:36:41 -07:00
beb606c6ca Oops, fix alignment in virtualized lists!
Forgot to top-align stuff! And then needed to add some padding to make sure the shadows show up.
2021-06-19 12:52:16 -07:00
be3a162a8a Virtualize item list scrolling
This helps the render time by a lot!
2021-06-19 12:36:19 -07:00
cc4e1f611f Oops, stop cutting off items on list page!
Made a mistake when refactoring to extract ClosetList! It made the full list page only show the preview 😅
2021-06-19 11:49:13 -07:00
eace28839e Highlight trade matches with pretty shadow
This makes scanning the lists WAY easier imo!
2021-06-19 11:43:51 -07:00
01ea733b10 Add right-click hint for how to download images
I have a hunch that people aren't finding the Download button! I'm not 100% sure what to do about that, but to start, I want right-clicking the image to give you a hint about it 😅
2021-06-19 11:30:44 -07:00
4903eb8d21 Show textarea even if description is blank
Now you can add description to a list that doesn't have one yet!
2021-06-19 09:46:53 -07:00
d91492ab66 Editable name/desc on list page
Decided to share the ClosetList component and give it a bit of variance, instead of figuring out how to extract all that edit state!
2021-06-19 09:44:44 -07:00
faf8364aab Rename UserItemsPage
For consistency with what we're calling it, and with `UserItemListPage`!
2021-06-19 09:24:05 -07:00
f8748a2bcd Oops, don't cut off the items for default lists! 2021-06-18 18:43:22 -07:00
97fcebbf91 Add Neomail links to single list page 2021-06-18 18:41:09 -07:00
8dd6633c40 Update homepage June 18 2021-06-18 18:35:53 -07:00
bb05a3e785 Add divider between own/want lists
Very helpful for scanning big pages!
2021-06-18 18:33:33 -07:00
96fdd395e1 Add page titles to item list pages 2021-06-18 18:30:02 -07:00
96d7fb70ff Only show 14 items on list page, then link to full
Woo, it's the big UI experiment! Let's see how it plays for folks 😅

Scrolling through a big lists page right now, I think this is a _huge_ improvement, I can get a sense of the lists and what's in them fast, and see matches fast, and dive quickly and with no extra load time when I want more. I'm pleased tbh!
2021-06-18 18:23:50 -07:00
482d710fd1 Share ClosetListContents between pages
Extracted this into a shared component for both the lists page and the single list page!
2021-06-18 17:56:01 -07:00
edb4ad7a3c Add trade matching to list page
I changed my mind and just went for the same sorting solution as before! Maybe we'll upgrade this later, or maybe not!
2021-06-18 17:53:17 -07:00
cf456c761c Remove stray code for not-in-a-list
I'm not actually sure we're gonna support pulling these out into pages? I might just have them be straggly dangling old less-optimized :p
2021-06-18 17:43:43 -07:00
01000c84f1 Cache ClosetList in Apollo
Now, when you click from the user's lists page to a specific list, we'll share the  data instead of showing a full loading screen!
2021-06-18 17:29:44 -07:00
f20c68ea81 Add description to list page
Pulled MarkdownAndSafeHTML into a shared component, and use it on the single list page now too!

I also simplified some of the logic for the item list, because I figure we'll have to give the trade matching stuff its own pass, y'know?
2021-06-18 17:26:21 -07:00
3cd0ffd764 Fix private lists page
Oops, I pulled `currentUserId` from the wrong place, so it was always acting as if you're logged in! Now, you can see the list page for your own private list!
2021-06-18 17:25:05 -07:00
d386ccfad8 Show placeholder when item description is blank
I'm not sure real item data "should" ever do this? Our "Written Word Shower" had a blank description, but I think that was an error on our end.

Anyway, it's clearer than showing infinite loading, so!
2021-06-17 21:31:04 -07:00
6ae22d171b Fix previews with large source images
Oops, okay, I guess I didn't test the new preview centering stuff with 1200x1200 images, like the Usul's Damask Markings.

Now, I apply a max size to the whole-ass container, and make the parent responsible for centering it.
2021-06-17 15:37:01 -07:00
0de5a5efff Update browser list
`npx browserslist@latest --update-db`
2021-06-17 15:32:13 -07:00
70a31c794e Fix dependencies for prod
Hmm, prod builds weren't happy with how I specified the version here

…do prod builds not listen to the lockfile? Suspicious :p
2021-06-16 18:28:40 -07:00
75ceeba6e2 Bundle CreateJS, instead of loading async
So I finally started looking into the race condition that makes item previews sometimes fail to load, and as expected, it was that we were trying to load the movie before CreateJS had necessarily loaded. Usually the timing worked out, esp after a reload, but not under certain circumstances!

Anyway, I've been wanting for a while to just bundle them instead. That'll help us more eagerly load them when we need them, and not depend on external CDNs, and remove a bunch of loading state!

So yeah, I had to learn how the `easeljs` and `tweenjs` NPM packages did their bundling, and how to use `imports-loader` to let them just register straight onto `window`! But we got there and it's pretty nice tbh!
2021-06-16 18:00:25 -07:00
bb5ec56752 Pause animation when FPS gets too low
Woof, the "Swirl of Power Effect" item tanks my CPU waaay too much

(I bet it's those 7000x7000 PNGs lolol 😬)

Anyway, before thinking about optimizing specific issues, I'm just adding this emergency switch: if we detect FPS < 2 on any layer, we just pause the whole outfit, until the user decides to unpause.
2021-06-16 16:26:24 -07:00
307ab932c8 Add FPS logging to OutfitMovieLayer
This is a precursor to adding an emergency brake if the FPS gets too low lol
2021-06-16 16:06:34 -07:00
25376a8fa8 Register images, to fix movies like Swirl of Power
Oh hey, turns out I was missing a step in movie clip stuff! Images aren't just for sprite sheets, but also sometimes they just want the raw images!

Here, we register them, uwu

Items like "Swirl of Power Effect" and probably others work correctly now!

That said, Swirl of Power takes WAY too much CPU lmao, I want to maybe add some kind of automatic kill switch lol
2021-06-16 15:49:56 -07:00
617ffd9a38 Add --upsert option to auth0 script 2021-06-16 08:24:59 -07:00
5a18a1d041 Oops, fix outfit page SSR title
Untitled outfits need a fallback, or else they show "null"!
2021-06-15 22:49:29 -07:00
5c5bdb11ff Oops, fix Lists page links!
Right, oops, the redirect works when you navigate directly to a URL, but not client-side! Fixed a bunch of 'em 😅
2021-06-15 22:46:43 -07:00
cf30b25be0 First draft of UserItemListPage
A lot is missing! No descriptions, no support for the "Not in a list" case, no scroll performance windowing, no editing!

But it's a start :3
2021-06-12 04:45:23 -07:00
232e35e062 Add not-found case to MajorErrorMessage
Like the previous change, we can use this for a lot of resource loading failure stuff!
2021-06-12 03:25:01 -07:00
468e662a32 Add network error support to MajorErrorMessage
Now we can use this for more of our like, GraphQL failures!
2021-06-12 03:19:09 -07:00
02d7cf73bb Support HTTPS asset URLs
There are a couple spots where we parse SWF URLs to get the ID out! Most visibly, our Support tools were crashing on it. And internally, manifest loading wasn't working. (I'm not sure if this got caught or if it caused crashes in user space? I didn't see them when wearing a failing item)

Anyway, fixed now!
2021-06-12 02:29:30 -07:00
9e222f3bf8 Change item list URL to /user/:userId/lists
This is because it's the terminology I'm using elsewhere ("Items" and "Closet" are too overloaded in the UI), and because I want to start putting specific lists at like `/user/:userId/lists/:listId`!

I also create a redirect from the old URL, and also from the DTI Classic variant of the URL
2021-06-11 19:06:12 -07:00
ddd562b672 Oops, I broke valids!
Ah right, React state batching doesn't always work how I expect it to. The separate state caused the hook to return and cache `{loading: false, error: null, data: null}`, and then on a _later_ tick the data value showed up, but only _after_ the response was already cached!

This broken a bunch of species/color picker stuff, now it's fixed!
2021-06-11 08:31:01 -07:00
eaa4fbb575 Improve item page perf by caching valids in client
Okay, so getting the initial render down time for these faces is annoying, though I might come back to it…

But actually, the _worst_ part isn't the _initial_ render, which just kinda gets processed as part of the page navigation, right?

The _worst_ part is that we render it slowly _twice_: once on page load, as we send the `useAllValidPetPoses` fetch request; and then again when the fetch request ~instantly comes back from the network cache.

The fact that this requires a double-render, instead of just rendering with the cached valids data in the first place (like how our GraphQL client does), causes a second and highly-visible render of a slow-to-render UI!

So, here we update `useAllValidPetPoses` to cache its response in JS memory, similar in principle to how Apollo Client does. That way, we can return the valids instantly on the first render, if you already loaded them from the homepage or the wardrobe page or another item page!
2021-06-11 07:37:49 -07:00
caf0a8b815 Extract SpeciesFacesPicker to a new file
I wanna refactor how we do styles in it for perf reasons, and it's enough added complexity that I want it in its own file!
2021-06-11 06:58:12 -07:00
ab2dbeb02a Item page perf: memoize species faces
This is a pretty easy change, that makes re-renders faster when something about the item preview state changes!

That said, the initial render is still pretty slow, too, and that's the one that's bothering me more lol
2021-06-11 06:45:11 -07:00
07bf555a02 Oops, fix a perf regression in Hi-Res Mode!
Ah oops, because I forgot to set `hiResMode` here in the image preloader, we would preload the PNG, and _then_ load the SVG separately.

This doubled the effective image loading time in Hi-Res Mode!

Now, the image preloader respects hi-res mode, and will preload the SVG in the SVG case, and the PNG in the PNG case.
2021-06-11 05:52:53 -07:00
2375669cdf Only show SVG glitch message in hi-res mode
If you're not in hi-res mode, then you don't care about broken SVGs, because you wouldn't have seen them anyway!

We also update the message to reference Hi-Res Mode.
2021-06-08 08:32:30 -07:00
bed525d3ff Add hi-res mode setting, default off
We're just having too many glitchy SVGs for my taste, esp since TNT seems to just be using PNGs for now?

This change defaults us to using PNGs for users by default, with the option to use SVGs as a new "hi-res mode" setting.

This is our first ever setting, wow!

I'm also envisioning that like, if we get Fastly Image Optimizer set up, this could be a way to tune the quality of the incoming images.

We could also consider a setting to turn off animations altogether—like, just download the PNG instead of the movie, whereas right now we download the movie on the assumption that you might play it at any time.
2021-06-08 08:27:45 -07:00
efa8a4d499 Oops, don't show UC conflict glitch while loading
The way we were checking for UC compatibility issues, was also triggering while the appearance was still loading, so items didn't have any appearance layers yet!

Now, we check for loading before testing for that glitch.
2021-06-08 07:23:13 -07:00
277b8df838 Fix caching for homepage Latest Items
Oh right, adding user data to this query makes it uncacheable!

Split the query into the main public data, which will cache; and the user data, which will load in later.
2021-06-08 01:59:56 -07:00
a0be9942fb Add extra flair to trade matches
I refactor the hide-badge thing into 3 "trade matching modes". Then, the logic for whether to hide specific badges moves into the component, and we use that same flag to decide whether to show the big word "match"!
2021-06-08 01:23:31 -07:00
b762e11331 Add owns/wants badges on SquareItemCard
Boom, cute owns/wants badges on "Latest items", and the item search page, and trade matches!

I'm gonna add some additional flair to the trade match case, too!
2021-06-08 01:03:09 -07:00