Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scryfall links/popups #107

Merged
merged 5 commits into from
Sep 14, 2018
Merged

Scryfall links/popups #107

merged 5 commits into from
Sep 14, 2018

Conversation

NilsEnevoldsen
Copy link
Contributor

Fixes #94

Copy link
Owner

@glacials glacials left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow nice! Great work. Couple blocking UX issues in addition to the comments:

  1. After mouseover but before the image loads, it's impossible to tell there's support for hover images. We should have some visual indication that something's happening, or people won't notice that an image would have appeared if they waited another couple of seconds.
  2. On mobile, the card images can get cut off on the side of the page (left side for me).

And a couple nice-to-haves, totally not blocking but we can at least make GitHub issues for them if they're not addressed here:

  1. On mobile it's hard to see the card images or know that we have them, since there's no mouseover. You can kind of see them by longpressing, but it doesn't feel supported and it's not a well-known behavior.
  2. Can we precache the card images? We should be able to pass a staticFileGlobs option into sw-precache, which generates our service worker that already precaches everything else on the site.

js/cardpopup.js Outdated
const queryURI = new URL( target.href ),
directURI = new URL( data.scryfall_uri ),
utmSource = queryURI.searchParams.get( 'utm_source' );
directURI.searchParams.set( 'utm_source', utmSource );
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble finding any documentation about utm_source in the Scryfall API docs; do they ask consumers to set this? And if so can you include that reason as a comment here, with a link to where they do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a written policy. @csuhta requests this on an individual basis.

Copy link

@csuhta csuhta Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there: I'm a member of the @scryfall team. Please set utm_source=whatsinstandard for any traffic you send our way. ❤️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: In a subsequent commit I just hardcoded the utm_source. (We should still set it manually on each homepage link in case clientside javascript is disabled.)

service-worker.js Outdated Show resolved Hide resolved
js/cardpopup.js Outdated Show resolved Hide resolved
package.json Outdated
@@ -40,6 +40,7 @@
"npm-font-open-sans": "^1.1.0",
"popper.js": "^1.14.3",
"sw-precache": "^5.2.1",
"tippy.js": "^2.6.0",
Copy link
Owner

@glacials glacials Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already using vue-tippy, is there a way we can reuse that instead of having two separate tippys included?

EDIT: Just saw your comment over on #94; imo we should definitely consolidate into one of the two tippys. Requiring both seems wasteful and liable to create complications down the road.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll wrestle with it until I figure out how it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the vanilla tippy.js dependency, although I'm still just using the tippy.js that's itself a dependency of VueTippy. I didn't "vue-ify" my code.

Remove unused eslint command. Hardcode utm_source for this site. Combine two calls into one.
Also removes vanilla Tippy
@tooomm
Copy link
Contributor

tooomm commented Sep 11, 2018

The vue-tippy dependencies we require is heavily outdated by the way.

0.2.8 vs. 2.0.19

@NilsEnevoldsen
Copy link
Contributor Author

@tooomm I updated them in e4fbb3c.

"vue-tippy": "^0.2.8"
"underscore": "^1.9.1",
"vue": "^2.5.17",
"vue-tippy": "^2.0.19"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@NilsEnevoldsen
Copy link
Contributor Author

Responded to inline comments individually.

W.r.t other comments:

  1. After mouseover but before the image loads, it's impossible to tell there's support for hover images.

Added progress cursor in 9ae81fe.

  1. On mobile, the card images can get cut off on the side of the page (left side for me).

For me, at the moment, mobile is so nonfunctional (on iOS) that I can't get them to show. See next item.

  1. On mobile it's hard to see the card images or know that we have them, since there's no mouseover.

See NilsEnevoldsen/ScryfallLinks#11. I worked on this last year, but I just don't know how to implement the behavior I want on mobile. Mobile browsers seemed finicky. Help appreciated.

  1. Can we precache the card images?

Absolutely, but I don't know how. In fact, on a page like this, we don't need the client to fetch data from Scryfall at all; the appropriate HTML and blobs could all be delivered to the client by the WhatsInStandard server. I don't know how to "preprocess" that, short of requiring the human developer to enter it all manually. There's probably a "node" way to do it?

@glacials
Copy link
Owner

Cool, this is in a good state to merge imo 👍 the part about requiring a human developer to do stuff for precaching is on point. So let's punt on precaching until we have bans in the API, which will make doing it programmatically easier. I can add some runtime caching myself later, that shouldn't block this branch because we never had it with Deckbox previews either, same for my comment about mobile.

If you're curious in general about that stuff, look up service workers. You can actually turn off your internet and still load whatsinstandard.com from a new tab :P

Thanks for your hard work!

@glacials glacials merged commit 979a17e into glacials:master Sep 14, 2018
@NilsEnevoldsen NilsEnevoldsen deleted the scryfall-popups branch September 14, 2018 18:17
@tooomm
Copy link
Contributor

tooomm commented Sep 14, 2018

This works very well and looks gooood, thank you @NilsEnevoldsen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants