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

Animated loading screen #281

Merged
merged 2 commits into from
Dec 3, 2017
Merged

Conversation

xavxyz
Copy link
Contributor

@xavxyz xavxyz commented Nov 30, 2017

Fixes #250

Initial draft

This shows an animated loading screen when opening the /playground route.

The playground UI code is still loaded via a CDN.

The loading UI code has been generated and slightly modified for readability from the output of the codepen prototype (+ a jest snapshot mill). It may get minified in the future?

There is a flag to disable it in local dev by looking for "localhost" in the headers. What would be a better way (no such thing as process.env.NODE_ENV)?

The render-playground-page.ts has been extracted in its own module, only used for Express at the moment.

How to test

My process so far below. Is there another way (with less context switching)?

# install, build & symlink the html render function
cd packages/graphql-playground-html
yarn
yarn build
yarn link

# do the same thing with the express middleware: it depens on the graphql-playground-html pkg
cd ../graphql-playground-middleware-express
yarn
yarn link graphql-playground-html
yarn build
yarn link

# well, repeat for the express middleware example
cd examples/basic
yarn link graphql-playground-middleware-express
yarn 
yarn start
# 🎉

@CLAassistant
Copy link

CLAassistant commented Nov 30, 2017

CLA assistant check
All committers have signed the CLA.

@morajabi
Copy link
Collaborator

Wow this graphql-playground-html will make the code a lot cleaner! Great job @xavcz, will test it.

const middlewareOptions: MiddlewareOptions = {
...options,
version,
isLocal: req.headers.host.includes('localhost'),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

set isLocal to false to have a glimpse of the flashy loading component in local mode

@timsuchanek
Copy link
Member

Thanks for the PR @xavcz!
In the meantime I started with the graphql-playground-middleware component where I added some more logic to the render-playground-page file.
But I like the name graphql-playground-html more, so we can just rename it and add your changes.
Do you think you could adjust from the latest master branch and rename graphql-playground-middleware to graphql-playground-html? Sorry for making you the double effort!
I will look into the PR in depth in the weekend :)

This shows an animated loading screen when opening the `/playground` route.

There is a flag to disable it in local dev (looking for "localhost" in the headers 🙄)

The `render-playground-page.ts` has been extracted in its own module, only used for Express at the moment.
Copy link
Member

@timsuchanek timsuchanek left a comment

Choose a reason for hiding this comment

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

Thanks a lot! I even want bad internet connection now

@timsuchanek timsuchanek merged commit 4ddd58c into graphql:master Dec 3, 2017
cgxxv pushed a commit to cgxxv/graphql-playground that referenced this pull request Mar 25, 2022
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