Commit graph

934 commits

Author SHA1 Message Date
82c1eefb13 Add a no results message to the item search page 2021-01-21 16:39:43 -08:00
d0f133acda Stop showing clear on item search page when empty
Oops, the old condition depending on `queryFilterText` to implicitly check for filter presence. But now that we always show "Items" as prefix text for the filters on this page, the reset button was always showing!

Use our new util function instead.
2021-01-21 16:38:08 -08:00
11fae604be Fix flash of content when emptying search field
1. Search for something
2. Clear the search bar
3. Quickly start typing something new

Before this change, the results would clear on #2, but then the old results would show up again during #3, before the loading state for the new query.

This matches the logic, right? We hid the results when both the current and debounced query were empty, and, during that time, neither is empty.

Instead, here we update the `useDebounce` hook to have a `forceReset` option, to immediately clear out the value instead of waiting.
2021-01-21 16:03:14 -08:00
701eb33391 Add "Items you own" and "Items you want" filters 2021-01-21 15:58:24 -08:00
8dc97f1e6f Merge branch 'main' of github.com:matchu/impress-2020 into main 2021-01-21 15:14:27 -08:00
2164f06021 Add --resync-existing to cache-asset-manifests
Wowie, looks like all the SVG asset manifests changed format lol! Running this now to update them all. There's a lot of them!
2021-01-21 15:14:23 -08:00
382aa1430e Support new SVG URLs in outfit thumbnails
Huh, I guess TNT changed the folder name from `object` to `items` for new SVGs? Like, some of the old SVGs still are in `objects`, but…

Hmm, I wonder if I should re-run old manifests at some point? I wonder if maybe like, _everything_ changed, and we're just holding onto old URLs now…
2021-01-21 14:59:56 -08:00
81117218a3 Only wait for auth on queries that need it
I switched from my `_NoAuthRequired` opname hack, to a more robust `context` argument, and it's opt-in!

This should make queries without user data faster by default. We'll need to remember to specify this in order to get user data, but it shouldn't be something we'd like, ship without remembering—the feature just won't work until we do!
2021-01-21 14:57:21 -08:00
7f777ed5b3 Add page-reload recovery to *all* code splitting
Still getting some chunk load errors in my Sentry reporting! My hunch is these are the culprit. I hooope that after this the errors are pretty much gone! If not, then I'm missing something about what causes these failures…
2021-01-21 14:34:55 -08:00
ffc697b241 Move our loadable wrapper into util
I wanna use it for other loadables, too!
2021-01-21 14:27:05 -08:00
a65b2fe73f
Merge pull request #2 from matchu/dependabot/npm_and_yarn/immer-8.0.1
Bump immer from 6.0.8 to 8.0.1
2021-01-21 12:57:55 -08:00
2946126d38 Merge branch 'main' of github.com:matchu/impress-2020 into main 2021-01-21 10:38:51 -08:00
79258e11b9 Add --skip-unchanged flag to cache-asset-manifests
I'm not getting cron success _or_ cron failure emails for running this script on our Linode box. I was getting failures back when I had the command wrong, though.

My hypothesis is that the script output is too long to email, because of some limit somewhere along the way. I'll update the cron job to use `--skip-unchanged`, in hopes that it helps me get the emails! (I'm not suuure it's running, is the thing... though hey, here's a way to check: as of now, 512,624 of 521,896 assets are converted. If that changes eventually without a manual script run, then the cron is working!)
2021-01-21 10:38:47 -08:00
Matt Dunn-Rankin
4e5cb38068
Add LICENSE.md
I'm being a bit contrarian and using a noncommercial-only license! :O
2021-01-21 05:55:57 -08:00
dependabot[bot]
d9c89cef39
Bump immer from 6.0.8 to 8.0.1
Bumps [immer](https://github.com/immerjs/immer) from 6.0.8 to 8.0.1.
- [Release notes](https://github.com/immerjs/immer/releases)
- [Commits](https://github.com/immerjs/immer/compare/v6.0.8...v8.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-21 07:31:25 +00:00
353f90dcac Fix /conversion styles on mobile 2021-01-20 10:56:09 -08:00
f40ccf0b21 Fix bug where we weren't recognizing new SVGs
So, we've been behind the latest conversion data for a while anyway, because I don't run the sync very often. But I ran the sync today and noticed that the newly converted SVGs weren't showing up in DTI!

This is because TNT changed the asset manifest structure they use for SVG-only assets. Now, we support both!

To test, I checked the Blue Acara (old-style SVG manifest), the Blue Chia (new-style SVG manifest), and the Floating Negg Faerie Doll (animated clip).
2021-01-20 10:44:32 -08:00
275d1d62ab Add secret HTML5 conversion page at /conversion
A lil page for us to keep track of Neopets's HTML5 conversion progress!
2021-01-20 10:44:29 -08:00
6da2ddb453 Perf & feedback upgrades to cache-asset-manifests
I want to start running this on a regular cron, and making the script faster (stop sending redundant queries) and clearer (# actually updated) is super useful for that!
2021-01-20 09:49:05 -08:00
ccd4885aad Add "New updates" / "Coming soon" to homepage
Not really sure how to scale these over time, I feel like some amount of history + blog cuteness could be fun? And like, the ability to catch up if you come back after a couple weeks could be nice. But this seems like a really useful at-a-glancer for folks!
2021-01-19 15:46:21 -08:00
61d60170f3 Fix console error in SearchToolbar on add filter 2021-01-19 14:34:30 -08:00
0333b47c05 Leave search suggestions open on blur
Someone wrote in how, when your search query ends with a string that creates Advanced Search suggestions, clicking on items in the list requires two clicks: one to blur and dismiss the suggestions, and one to actually click the item.

Here, I'm experimenting with just leaving the suggestions open. It doesn't feel _great_, but it definitely feels _better_ than before on this edge case, and I thiiink this only affects this edge case in practice? We'll see if it feels goofy in some cases I forgot tho!
2021-01-19 14:27:55 -08:00
94efb80e65 Handle bugs in neopets username data
Huh, looks like it's possible for a user's NeopetsConnection record to be missing, despite having the ID on their User record!

Here, we handle that case.
2021-01-19 13:55:25 -08:00
8aa644a031 Stop sending client-side nav transaction to Sentry
Oops, we hit our Sentry transaction limit after 3 days!

This is in part because we selected a 100% sample rate to start, but also because our app has a lot of client-side navs that don't represent real navigation, and are just to update the state in the URL.

I'm not using most of Sentry's performance tracing features, though! I don't have logging that helps us understand once the page is really done, and I'm only really able to use Web Vitals right now - which only applies to first-time pageload events, anyway. So, that's now all we track!
2021-01-18 16:31:02 -08:00
b39914976b Add an /items/search page, and search box on Home
Woo, it's looking pretty good, I think!

I didn't bother with pagination yet, since I feel like that'll be a bit of a design and eng lift unto itself... but I figured people would appreciate the ability to look up individual items, even if the rest isn't ready yet 😅
2021-01-18 15:56:24 -08:00
9e5dfd1c84 Move "Log out" button into the nav menu
When actually using mobile, I was like "oh, it's maybe not great that the menu button is tiny and the Log out button is huge". Awkward click targets!
2021-01-18 13:51:52 -08:00
6e33132881 Load homepage faster for logged-in users
When building the code to await auth before sending _any_ GraphQL queries, I didn't realize that auth might be kinda slow. So, I've added a hack to let me mark queries with no user-specific data to skip auth, and applied that to the main queries on the homepage.

I think this is a hint that we might want to change our strategy - e.g. to flip it to hackily mark that auth _is_ required, or to create wrappers or option-builder helpers for logged-in queries, etc.

I also notice that SSR would have resolved this particular case...
2021-01-18 07:15:00 -08:00
154046695f Avoid alt text flash of content for item thumbnail 2021-01-18 06:51:23 -08:00
b78cede939 Add brief delay before Latest Items loading state
This UI generally loads very fast, thanks to the CDN cache, so the flash of skeleton content is more distracting than anything else! We still show it quickly after 300ms, but good network connections should reliably get it loaded before then.
2021-01-18 06:46:18 -08:00
f3633f5ab6 Privacy policy copy tweak 2021-01-18 06:44:07 -08:00
334d89c101 Add Latest Items section to homepage 2021-01-18 06:31:27 -08:00
934dd829c6 Fix ChunkLoadError crashes after deploys
Our host, Vercel, doesn't keep old build files on its CDN after a deploy for very long. This means that, after a deploy that changes a page's bundle, existing sessions that attempt to navigate to it for the first time will fail on the dynamic `import`, because the filename hash has changed.

The best fix I'm aware of for this is to just, reload the page when this happens!

To test this, I did the following:
1. Use `yarn build` to build a prod copy of the site.
2. Use `serve -s build` to start serving it on its own port. (API endpoints won't work, and that's okay!)
3. Don't touch the open copy of the site yet.
4. Make a change to `PrivacyPolicyPage.js`, and `yarn build` again. This simulates a deploy under similar circumstances.
5. Open the Console, tick the "Persist Logs" option, and try to navigate to Privacy Policy. Observe that it logs a ChunkLoadError in the console, and smoothly reloads the page to show you the updated Privacy Policy page.
6. Undo your change 😅
2021-01-18 05:17:14 -08:00
0f61d59917 Add "From" to feedback email body
This is just a convenience to make it easier to see at a glance in my inbox whether I should reply to the email, or whether it just goes nowhere 😅
2021-01-18 05:11:17 -08:00
ca088f3310 Group Sentry stats by route 2021-01-17 08:48:22 -08:00
753305dd11 Fix "Untitled outfit" on open outfit in new window
Previously, when you navigated directly to an outfit by typing the URL into the browser or following an external link, the name would stay as "Untitled outfit", even after the outfit loaded.

This was because, when you render an `Editable` Chakra component with `value={undefined}`, it permanently enters "uncontrolled" mode, and providing a value later doesn't change that.

But tbh passing `undefined` down from outfit state wasn't my intention! But yeah, turns out the `?.` operator returns `undefined` rather than `null`, which I guess makes sense!

So, I've fixed this on both ends. I'm now passing more `null`s down via outfit state, because I think that's a more expected value in general.

But also, for the `Editable`, I'm making a point of passing in an empty string as `value`, so that this component will be resilient to upstream changes in the future. (It's pretty brittle to _depend_ on the difference between `null` and `undefined`, as we saw here 😅)
2021-01-17 08:19:47 -08:00
9b0a99e2ae Mention starred outfits in "Your outfits" WIP 2021-01-17 08:05:05 -08:00
e149d53595 Back links to Your Outfits, *if* it's yours
Previously, when you clicked on a saved outfit from Your Outfits, the back button would take you back to the homepage, which was confusing for scanning through stuff! Now, it goes back to Your Outfits if it's yours.

I'm not suuure this is the behavior we want? But it seems intuitive enough!
2021-01-17 08:04:21 -08:00
2dbed8b8c4 Use default values for plain /outfits/new URLs
Previously, if you navigated to /outfits/new without a species or color in the query string, we'd show a blank outfit page, with the species/color picker hidden. Now, we default to a Blue Acara instead!

We don't do anything to handle _invalid_ species/color IDs, but I don't super mind that, because in practice that would require some call site to malform the URL, and I don't super expect that.

This resolves more of the _cause_ of Sentry issue IMPRESS-2020-8, but I'm still wondering how a user got to the URL `/outfits/new?[object+Object]=&objects[]=35185&objects[]=67084`. I'm wondering if the pet loader on the homepage has a bug in Safari? I feel like I heard something like that from the feedback form, too...
2021-01-17 07:43:08 -08:00
f1dd3bffa6 Hide species/color on wardrobe page when not ready
If the species/color of the current outfit aren't available yet (e.g. a saved outfit is still loading in), hide the picker altogether. This is because the picker can't handle change events during that time, and it's easier to just hide all this than to add special case handlers like disabled states! (And, while placeholders are often helpful, I'm not sure the placeholder dropdowns are any better than empty space in this case.)

This can also happen when the user loads a page without a species/color ready, like just going straight to `/outfits/new`. I think I might want to add a handler for that, though.

Resolves the direct cause of Sentry issue IMPRESS-2020-8, though I'm not sure how the user got to the URL `/outfits/new?[object+Object]=&objects[]=35185&objects[]=67084` in the first place...
2021-01-17 07:24:54 -08:00
33ee4455a7 Gracefully handle unexpected SWF URLs
Fixing our support for our "Totally Legit DTI Graffiti" item 😅

In addition to this change, I also uploaded the images to the correct URLs: the old site was doing the folder algorithm in a surprising way, yielding https://impress-asset-images.s3.amazonaws.com/object/000/000/0-1/-1/600x600.png, whereas the new site was doing the (imo clearer) https://impress-asset-images.s3.amazonaws.com/object/000/000/000/-1/600x600.png. I copied the files to the new location.

I also noticed that the thumbnail URL for that item has been broken for a while, so I created a new copy at https://impress-asset-images.s3.amazonaws.com/object/000/000/000/-1/80x80.png, and updated the database record to point to it.

This should resolve Sentry error IMPRESS-2020-6.
2021-01-17 05:16:53 -08:00
7393991046 log search result errors
We showed an error to the user, but nothing in the console! Now we have it :)
2021-01-17 04:47:11 -08:00
f6ce8611b2 Clearer errors when image download fails
Two fixes in here, for when image downloads fail!

1) Actually catch the error, and show UI feedback
2) Throw it as an actual exception, so the console message will have a stack trace

Additionally, debugging this was a bit trickier than normal, because I didn't fully understand that the image `onerror` argument is an error _event_, not an Error object. So, Sentry captured the uncaught promise rejection, but it didn't have trace information, because it wasn't an Error. Whereas now, if I forget to catch `loadImage` calls in the future, we'll get a real trace! both in the console for debugging, and in Sentry if it makes it to prod :)
2021-01-17 04:42:35 -08:00
cfb5504341 Add hidden command to send test error to Sentry
I haven't seen anything come in from prod yet, and it's hard to trigger one, maybe because the integration is React-specific? Or maybe it's... not working :p

I can send errors from dev! But just haven't _seeeen_ a prod error come in yet.

Maybe we're just squeaky clean tho :3
2021-01-16 12:01:28 -08:00
675c6310fc Fix GitHub Action for Sentry, attempt 6
Ohh, this isn't a list, got it

Yeesh, I didn't understand what I was writing at ALL
2021-01-16 11:27:26 -08:00
e0ff89420b Fix GitHub Action for Sentry, attempt 5
Hmmmmmm are they upset about the comma? Idk anymore
2021-01-16 11:26:28 -08:00
b8baf7f88e Fix GitHub Action for Sentry, attempt 4
Ahh ok, can't have conflicting names I guess? Got a new "syntax error" on line 9, so...
2021-01-16 11:24:51 -08:00
942f1e44ae Fix GitHub Action for Sentry, attempt 3
lmao
2021-01-16 11:23:07 -08:00
1c7d027465 Fix GitHub Action for Sentry, attempt 2
Lol I missed a lot of the steps, huh?
2021-01-16 11:22:35 -08:00
d7a4ddb907 Fix syntax error in new GitHub Action for Sentry
oops, I missed a node!
2021-01-16 11:18:56 -08:00
f4810aa2f4 Add Sentry GitHub Action
this shouuuld create a record in Sentry every time we push, to help it correlate new errors to releases 🤞
2021-01-16 11:15:22 -08:00