From 835e030c65b94b3480e74c8a28814c246f09bf5f Mon Sep 17 00:00:00 2001 From: NBTX Date: Sat, 24 Aug 2019 15:51:03 +0100 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=94=8C=20Add=20websocket=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/styles.scss | 11 +- layouts/default.vue | 47 +++++++++ pages/index.vue | 2 +- pages/websocket.vue | 225 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 282 insertions(+), 3 deletions(-) create mode 100644 pages/websocket.vue diff --git a/assets/css/styles.scss b/assets/css/styles.scss index ed3e08281..05e894ed2 100644 --- a/assets/css/styles.scss +++ b/assets/css/styles.scss @@ -70,6 +70,12 @@ footer { justify-content: space-between; } +nav { + a:not(:last-of-type) { + margin-right: 15px; + } +} + body.sticky-footer footer { position: fixed; bottom: 0; @@ -104,7 +110,7 @@ legend { cursor: pointer; } -fieldset textarea { +fieldset textarea, fieldset pre { resize: vertical; } @@ -163,7 +169,8 @@ fieldset.response legend { select, input, option, -textarea { +textarea, +pre { margin: 4px; padding: 8px 16px; width: calc(100% - 8px); diff --git a/layouts/default.vue b/layouts/default.vue index 6a17733d9..d3f92bedc 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -7,6 +7,11 @@

Lightweight API request builder

+ + @@ -41,6 +46,43 @@ margin: 0 auto; max-width: 1200px; } + + header { padding-right: 0; } + + nav { + a { + display: inline-block; + position: relative; + padding: 8px 16px; + + &.nuxt-link-exact-active { + color: black; + &:before { width: 100%; height: 100% } + } + + &:before { + content: ""; + position: absolute; + bottom: 0; + left: 0; + right: 0; + z-index: -1; + + background-color: var(--ac-color); + border-radius: 4px; + margin: auto; + } + + &:not(.nuxt-link-exact-active):hover:before { + animation: linkHover 0.3s forwards ease-in-out; + } + + @keyframes linkHover { + 0% { width: 0; height: 2px; } + 100% { width: 100%; height: 2px; } + } + } + } From 70126748fd271ed24e8f267b5fb27731a5d4dc04 Mon Sep 17 00:00:00 2001 From: NBTX Date: Sat, 24 Aug 2019 17:20:19 +0100 Subject: [PATCH 2/6] Set up travis for GitHub Pages deployment --- .travis.yml | 47 +++++++++++++++++++++++++++++++++++++++++++---- nuxt.config.js | 20 +++++++++++++++++++- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a533aa377..0f3db1b22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,47 @@ +# == INSTRUCTIONS FOR SETTING UP TRAVIS (and GitHub Pages) == +# +# 1. Find this repository in your Travis-CI dashboard. +# open settings and add an environment variable called +# GITHUB_ACCESS_TOKEN and set it to your personal access token.addons: +# See: https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line +# +# **DO NOT TURN ON 'Display value in build log'!!!!** +# +# 2. Push the code to the repository. +# 3. Profit! + + + language: node_js node_js: - - "node" + - "12" + +env: + - MY_VAR=EverythignIsAwesome + - NODE_ENV=TEST + - DEPLOY_ENV=GH_PAGES + +cache: + directories: + - "node_modules" + +branches: + only: + - "master" + +install: + - "npm install" + - "npm run generate" + notifications: webhooks: https://www.travisbuddy.com -env: -- MY_VAR=EverythignIsAwesome -- NODE_ENV=TEST \ No newline at end of file + +deploy: + provider: pages + skip_cleanup: true + # Refer to: https://docs.travis-ci.com/user/deployment/pages/#Setting-the-GitHub-token + github_token: $GITHUB_ACCESS_TOKEN + target-branch: gh-pages + local_dir: dist + on: + branch: master \ No newline at end of file diff --git a/nuxt.config.js b/nuxt.config.js index 3bb5ff8bb..394f7527d 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,3 +1,4 @@ + // Some helpful application constants. // TODO: Use these when rendering the pages (rather than just for head/meta tags...) const meta = { @@ -6,6 +7,18 @@ const meta = { description: "The Postwoman API request builder helps you create your requests faster, saving you precious time on your development." }; +// Sets the base path for the router. +// Important for deploying to GitHub pages. + +// -- Travis includes the author in the repo slug, +// so if there's a /, we need to get everything after it. +let repoName = process.env.TRAVIS_REPO_SLUG.split('/').pop() || ''; +const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? { + router: { + base: `/${repoName}/` + } +} : {}; + export default { mode: 'spa', /* @@ -134,5 +147,10 @@ export default { */ generate: { fallback: true - } + }, + + /* + ** Router configuration + */ + ...routerBase } From d095b355cc30d9fc4b1db02882f200d5b105db70 Mon Sep 17 00:00:00 2001 From: NBTX Date: Sat, 24 Aug 2019 17:21:53 +0100 Subject: [PATCH 3/6] Remove unnecessary envs (for some reason, they create extra build stages) --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f3db1b22..bdad84522 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,6 @@ node_js: - "12" env: - - MY_VAR=EverythignIsAwesome - - NODE_ENV=TEST - DEPLOY_ENV=GH_PAGES cache: From 424df8c1aeed9912a796ae82fc2cc44b1c58654c Mon Sep 17 00:00:00 2001 From: NBTX Date: Sat, 24 Aug 2019 17:27:46 +0100 Subject: [PATCH 4/6] Fix icon locations --- .travis.yml | 5 ++--- nuxt.config.js | 18 +++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index bdad84522..46a545351 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,8 @@ # **DO NOT TURN ON 'Display value in build log'!!!!** # # 2. Push the code to the repository. -# 3. Profit! - - +# 3. Set the GitHub Pages source in the GitHub repository settings to the +# gh-pages branch. language: node_js node_js: diff --git a/nuxt.config.js b/nuxt.config.js index 394f7527d..852c87c9c 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -34,7 +34,7 @@ export default { { name: 'X-UA-Compatible', content: "IE=edge, chrome=1" }, { itemprop: "name", content: `${meta.name} \u2022 ${meta.shortDescription}` }, { itemprop: "description", content: meta.description }, - { itemprop: "image", content: "/icons/icon-192x192.png" }, + { itemprop: "image", content: "icons/icon-192x192.png" }, // Add to homescreen for Chrome on Android. Fallback for PWA (handled by nuxt) { name: 'application-name', content: meta.name }, @@ -55,7 +55,7 @@ export default { { property: 'og:type', content: 'website' }, { property: 'og:title', content: `${meta.name} \u2022 ${meta.shortDescription}` }, { property: 'og:description', content: meta.description }, - { property: 'og:image', content: '/icons/icon-144x144.png' }, + { property: 'og:image', content: `${routerBase.router.base}/icons/icon-144x144.png` }, // Twitter { name: 'twitter:card', content: "summary" }, @@ -64,18 +64,18 @@ export default { { name: 'twitter:url', content: "https://liyasthomas.github.io/postwoman" }, { name: 'twitter:title', content: meta.name }, { name: 'twitter:description', content: meta.shortDescription }, - { name: 'twitter:image', content: '/icons/icon-144x144.png' }, + { name: 'twitter:image', content: `${routerBase.router.base}/icons/icon-144x144.png` }, ], link: [ { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, // Home-screen icons (iOS) - { rel: 'apple-touch-icon', href: '/icons/icon-48x48.png' }, - { rel: 'apple-touch-icon', sizes: '72x72', href: '/icons/icon-72x72.png' }, - { rel: 'apple-touch-icon', sizes: '96x96', href: '/icons/icon-96x96.png' }, - { rel: 'apple-touch-icon', sizes: '144x144', href: '/icons/icon-144x144.png' }, - { rel: 'apple-touch-icon', sizes: '192x192', href: '/icons/icon-192x192.png' }, + { rel: 'apple-touch-icon', href: `${routerBase.router.base}/icons/icon-48x48.png` }, + { rel: 'apple-touch-icon', sizes: '72x72', href: `${routerBase.router.base}/icons/icon-72x72.png` }, + { rel: 'apple-touch-icon', sizes: '96x96', href: `${routerBase.router.base}/icons/icon-96x96.png` }, + { rel: 'apple-touch-icon', sizes: '144x144', href: `${routerBase.router.base}/icons/icon-144x144.png` }, + { rel: 'apple-touch-icon', sizes: '192x192', href: `${routerBase.router.base}/icons/icon-192x192.png` }, ] }, /* @@ -119,7 +119,7 @@ export default { for(let size of sizes){ icons.push({ - "src": `/icons/icon-${size}x${size}.png`, + "src": `${routerBase.router.base}/icons/icon-${size}x${size}.png`, "type": "image/png", "sizes": `${size}x${size}` }); From d86b2c410fa68410678df3f500091fcd50d6645c Mon Sep 17 00:00:00 2001 From: NBTX Date: Sat, 24 Aug 2019 18:01:57 +0100 Subject: [PATCH 5/6] Tidy up paths --- layouts/error.vue | 11 ++++++++++- nuxt.config.js | 32 ++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/layouts/error.vue b/layouts/error.vue index 89090039f..0cd146735 100644 --- a/layouts/error.vue +++ b/layouts/error.vue @@ -4,7 +4,7 @@

{{ error.message }}


-

Reload

+

Reload

@@ -22,8 +22,17 @@