Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

:sparkles: Moved inputform and feed to index

Liyas Thomas493180405607
diff --git a/components/firebase/inputform.vue b/components/firebase/inputform.vue
index 5f5e040ab..3b5e8f2c7 100644
--- a/components/firebase/inputform.vue
+++ b/components/firebase/inputform.vue
@@ -1,7 +1,7 @@
<template>
<form @submit.prevent="formPost">
<input type="text" autofocus ref="inputMessage" v-model="message" />
- <input :disabled="!this.message" type="submit" value="DUNK!" />
+ <input :disabled="!this.message" type="submit" value="Save" />
</form>
</template>
diff --git a/components/firebase/login.vue b/components/firebase/login.vue
index 7b0198437..7f4890433 100644
--- a/components/firebase/login.vue
+++ b/components/firebase/login.vue
@@ -1,8 +1,43 @@
<template>
- <div>
- <button @click.prevent="signInWithGoogle">Log in with Google</button>
- <button @click.prevent="signInWithGithub">Log in with GitHub</button>
- </div>
+ <v-popover>
+ <button class="icon" v-tooltip="$t('login_with')">
+ <i class="material-icons">vpn_key</i>
+ </button>
+ <template slot="popover">
+ <div>
+ <button class="icon" @click="signInWithGoogle" v-close-popover>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ class="material-icons"
+ >
+ <path
+ d="M12.24 10.285V14.4h6.806c-.275 1.765-2.056 5.174-6.806 5.174-4.095 0-7.439-3.389-7.439-7.574s3.345-7.574 7.439-7.574c2.33 0 3.891.989 4.785 1.849l3.254-3.138C18.189 1.186 15.479 0 12.24 0c-6.635 0-12 5.365-12 12s5.365 12 12 12c6.926 0 11.52-4.869 11.52-11.726 0-.788-.085-1.39-.189-1.989H12.24z"
+ />
+ </svg>
+ <span>Google</span>
+ </button>
+ </div>
+ <div>
+ <button class="icon" @click="signInWithGithub" v-close-popover>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ class="material-icons"
+ >
+ <path
+ d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"
+ />
+ </svg>
+ <span>GitHub</span>
+ </button>
+ </div>
+ </template>
+ </v-popover>
</template>
<script>
@@ -15,14 +50,22 @@ export default {
firebase
.auth()
.signInWithPopup(provider)
- .catch(err => alert(err.message || err));
+ .catch(err => {
+ this.$toast.show(err.message || err, {
+ icon: "error"
+ });
+ });
},
signInWithGithub() {
const provider = new firebase.auth.GithubAuthProvider();
firebase
.auth()
.signInWithPopup(provider)
- .catch(err => alert(err.message || err));
+ .catch(err => {
+ this.$toast.show(err.message || err, {
+ icon: "error"
+ });
+ });
}
}
};
diff --git a/functions/store.js b/functions/store.js
index de02e6fce..bddd16e20 100644
--- a/functions/store.js
+++ b/functions/store.js
@@ -52,12 +52,10 @@ ballsCollection
ball.id = doc.id;
balls.push(ball);
});
- console.log("Received Balls feed:", balls);
store.ballsInFeed = balls;
});
// When a user logs in or out, save that in the store
firebase.auth().onAuthStateChanged(user => {
- console.log("Logged in as:", user);
store.currentUser = user;
});
diff --git a/lang/en-US.js b/lang/en-US.js
index 906fb0602..725c3ebf9 100644
--- a/lang/en-US.js
+++ b/lang/en-US.js
@@ -249,5 +249,8 @@ export default {
extensions: "Extensions",
extensions_info1: "Browser extension that simplifies access to Postwoman",
extensions_info2: "Get Postwoman browser extension!",
- installed: "Installed"
+ installed: "Installed",
+ login_with: "Login with",
+ logged_out: "Logged out",
+ logout: "Logout"
};
diff --git a/layouts/default.vue b/layouts/default.vue
index e2088b376..fd1e5f0d0 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -288,6 +288,12 @@
>
<i class="material-icons">offline_bolt</i>
</button>
+ <login v-if="!store.currentUser" />
+ <span v-if="store.currentUser">
+ <button class="icon" @click="logout" v-tooltip="$t('logout')">
+ <i class="material-icons">exit_to_app</i>
+ </button>
+ </span>
<v-popover>
<button class="icon" v-tooltip="$t('more')">
<i class="material-icons">more_vert</i>
@@ -345,13 +351,6 @@
</template>
</v-popover>
</span>
-
- <login v-if="!store.currentUser" />
- <div v-else>
- <button @click="logout">Log out</button>
- <inputform />
- <ballsfeed />
- </div>
</div>
</header>
<nuxt />
@@ -641,9 +640,7 @@ export default {
components: {
logo: () => import("../components/logo"),
modal: () => import("../components/modal"),
- login: () => import("../components/firebase/login"),
- inputform: () => import("../components/firebase/inputform"),
- ballsfeed: () => import("../components/firebase/feeds")
+ login: () => import("../components/firebase/login")
},
methods: {
@@ -658,7 +655,14 @@ export default {
firebase
.auth()
.signOut()
- .catch(err => alert(err.message || err));
+ .catch(err => {
+ this.$toast.show(err.message || err, {
+ icon: "error"
+ });
+ });
+ this.$toast.info(this.$t("logged_out"), {
+ icon: "vpn_key"
+ });
}
},
diff --git a/pages/index.vue b/pages/index.vue
index 71926504f..3771d84e1 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -846,6 +846,14 @@
<collections />
</pw-section>
</div>
+ <span v-if="store.currentUser">
+ <input id="auth-tab" type="radio" name="side" />
+ <label for="auth-tab">{{ $t("history") }}</label>
+ <div class="tab">
+ <inputform />
+ <ballsfeed />
+ </div>
+ </span>
</section>
</aside>
@@ -1136,6 +1144,7 @@ import parseTemplateString from "../functions/templating";
import AceEditor from "../components/ace-editor";
import { tokenRequest, oauthRedirect } from "../assets/js/oauth";
import { sendNetworkRequest } from "../functions/network";
+import { store } from "../functions/store";
const statusCategories = [
{
@@ -1200,7 +1209,9 @@ export default {
autocomplete: () => import("../components/autocomplete"),
collections: () => import("../components/collections"),
saveRequestAs: () => import("../components/collections/saveRequestAs"),
- Editor: AceEditor
+ Editor: AceEditor,
+ inputform: () => import("../components/firebase/inputform"),
+ ballsfeed: () => import("../components/firebase/feeds")
},
data() {
return {
@@ -1370,12 +1381,12 @@ export default {
],
showRequestModal: false,
editRequest: {},
-
urlExcludes: {},
responseBodyText: "",
responseBodyType: "text",
responseBodyMaxLines: 16,
- activeSidebar: true
+ activeSidebar: true,
+ store
};
},
watch: {