From 99b9ffd29355efe37cc4b1a29e5cf338db30e959 Mon Sep 17 00:00:00 2001 From: liyasthomas Date: Thu, 2 Dec 2021 10:28:29 +0530 Subject: [PATCH] refactor: clean up boilerplate + init request section --- .../cypress/integration/basic.spec.ts | 20 +-- packages/hoppscotch-embed/locales/en.yml | 3 + packages/hoppscotch-embed/package.json | 1 + packages/hoppscotch-embed/src/components.d.ts | 7 + .../src/components/Footer.vue | 2 +- .../src/components/Request.vue | 37 +++++ .../src/components/RequestOptions.vue | 3 + .../src/components/Response.vue | 3 + .../src/components/Spinner.vue | 3 + .../hoppscotch-embed/src/layouts/default.vue | 5 +- .../hoppscotch-embed/src/layouts/embed.vue | 5 + packages/hoppscotch-embed/src/pages/about.md | 21 --- .../hoppscotch-embed/src/pages/hi/[name].vue | 49 ------ packages/hoppscotch-embed/src/pages/index.vue | 45 +----- .../src/pages/r/[shortCode].vue | 14 ++ packages/hoppscotch-embed/src/styles/main.css | 147 +++++++++++++++++- packages/hoppscotch-embed/vite.config.ts | 8 + packages/hoppscotch-embed/windi.config.ts | 26 ++++ pnpm-lock.yaml | 10 ++ 19 files changed, 279 insertions(+), 130 deletions(-) create mode 100644 packages/hoppscotch-embed/src/components/Request.vue create mode 100644 packages/hoppscotch-embed/src/components/RequestOptions.vue create mode 100644 packages/hoppscotch-embed/src/components/Response.vue create mode 100644 packages/hoppscotch-embed/src/components/Spinner.vue create mode 100644 packages/hoppscotch-embed/src/layouts/embed.vue delete mode 100644 packages/hoppscotch-embed/src/pages/about.md delete mode 100644 packages/hoppscotch-embed/src/pages/hi/[name].vue create mode 100644 packages/hoppscotch-embed/src/pages/r/[shortCode].vue diff --git a/packages/hoppscotch-embed/cypress/integration/basic.spec.ts b/packages/hoppscotch-embed/cypress/integration/basic.spec.ts index 2713ae458..099e21b96 100644 --- a/packages/hoppscotch-embed/cypress/integration/basic.spec.ts +++ b/packages/hoppscotch-embed/cypress/integration/basic.spec.ts @@ -1,28 +1,21 @@ - context("Basic", () => { beforeEach(() => { cy.visit("/") }) it("basic nav", () => { - cy.url() - .should("eq", "http://localhost:3333/") + cy.url().should("eq", "http://localhost:3333/") - cy.contains("[Home Layout]") - .should("exist") + cy.contains("[Home Layout]").should("exist") cy.get("#input") .type("Vitesse{Enter}") .url() - .should("eq", "http://localhost:3333/hi/Vitesse") + .should("eq", "http://localhost:3333/r/Vitesse") - cy.contains("[Default Layout]") - .should("exist") + cy.contains("[Default Layout]").should("exist") - cy.get(".btn") - .click() - .url() - .should("eq", "http://localhost:3333/") + cy.get(".btn").click().url().should("eq", "http://localhost:3333/") }) it("markdown", () => { @@ -31,7 +24,6 @@ context("Basic", () => { .url() .should("eq", "http://localhost:3333/about") - cy.get("pre.language-js") - .should("exist") + cy.get("pre.language-js").should("exist") }) }) diff --git a/packages/hoppscotch-embed/locales/en.yml b/packages/hoppscotch-embed/locales/en.yml index a09974596..16b3fb1f3 100644 --- a/packages/hoppscotch-embed/locales/en.yml +++ b/packages/hoppscotch-embed/locales/en.yml @@ -12,3 +12,6 @@ intro: aka: Also known as whats-your-name: What's your name? not-found: Not found +app: + title: Hoppscotch Embed + description: Embed Hoppscotch instance in your websites diff --git a/packages/hoppscotch-embed/package.json b/packages/hoppscotch-embed/package.json index 706e93db8..1061bdced 100644 --- a/packages/hoppscotch-embed/package.json +++ b/packages/hoppscotch-embed/package.json @@ -44,6 +44,7 @@ "unplugin-icons": "^0.12.22", "unplugin-vue-components": "^0.17.2", "vite": "^2.6.14", + "vite-plugin-fonts": "^0.2.2", "vite-plugin-inspect": "^0.3.11", "vite-plugin-md": "^0.11.4", "vite-plugin-pages": "^0.19.0-beta.6", diff --git a/packages/hoppscotch-embed/src/components.d.ts b/packages/hoppscotch-embed/src/components.d.ts index 5837aa0dd..6734cf835 100644 --- a/packages/hoppscotch-embed/src/components.d.ts +++ b/packages/hoppscotch-embed/src/components.d.ts @@ -5,7 +5,9 @@ declare module "vue" { export interface GlobalComponents { CarbonCampsite: typeof import("~icons/carbon/campsite")["default"] + CarbonCircleDash: typeof import("~icons/carbon/circle-dash")["default"] CarbonDicomOverlay: typeof import("~icons/carbon/dicom-overlay")["default"] + CarbonHome: typeof import("~icons/carbon/home")["default"] CarbonLanguage: typeof import("~icons/carbon/language")["default"] CarbonLogoGithub: typeof import("~icons/carbon/logo-github")["default"] CarbonMoon: typeof import("~icons/carbon/moon")["default"] @@ -14,6 +16,11 @@ declare module "vue" { CarbonWarning: typeof import("~icons/carbon/warning")["default"] Footer: typeof import("./components/Footer.vue")["default"] README: typeof import("./components/README.md")["default"] + Request: typeof import("./components/Request.vue")["default"] + "Request copy": typeof import("./components/Response.vueue")["default"] + RequestOptions: typeof import("./components/RequestOptions.vue")["default"] + Response: typeof import("./components/Response.vue")["default"] + Spinner: typeof import("./components/Spinner.vue")["default"] } } diff --git a/packages/hoppscotch-embed/src/components/Footer.vue b/packages/hoppscotch-embed/src/components/Footer.vue index 0191d7b36..cc6ea5e6a 100644 --- a/packages/hoppscotch-embed/src/components/Footer.vue +++ b/packages/hoppscotch-embed/src/components/Footer.vue @@ -13,7 +13,7 @@ const toggleLocales = () => {