Browse Source

chore: remove unused code

liyasthomas 3 years ago
parent
commit
0cedc9ed51

+ 0 - 5
README.md

@@ -361,7 +361,6 @@ _Add-ons are developed and maintained under **[Official Hoppscotch Organization]
 - History
 - Collections
 - Environments
-- Notes
 
 ✅ **Post-Request Tests β:** Write tests associated with a request that are executed after the request response.
 
@@ -378,10 +377,6 @@ _Add-ons are developed and maintained under **[Official Hoppscotch Organization]
 
 </details>
 
-📝 **Notes** : Instantly jot down notes, tasks or whatever you feel like as they come to your mind.
-
-_Notes are only available for signed-in users_
-
 🌱 **Environments** : Environment variables allow you to store and reuse values in your requests and scripts.
 
 <details>

+ 0 - 62
components/firebase/Feeds.vue

@@ -1,62 +0,0 @@
-<template>
-  <div
-    v-if="currentFeeds && currentFeeds.length !== 0"
-    class="divide-y virtual-list divide-dashed divide-divider"
-  >
-    <ul v-for="feed in currentFeeds" :key="feed.id" class="flex-col">
-      <div data-test="list-item" class="show-on-large-screen">
-        <li class="info">
-          <label data-test="list-label" class="break-all">
-            {{ feed.label || $t("no_label") }}
-          </label>
-        </li>
-        <button class="icon" @click="deleteFeed(feed)">
-          <i class="material-icons">delete</i>
-        </button>
-      </div>
-      <div class="show-on-large-screen">
-        <li data-test="list-message" class="info clamb-3">
-          <label class="break-all">{{ feed.message || $t("empty") }}</label>
-        </li>
-      </div>
-    </ul>
-  </div>
-  <ul v-else class="flex-col">
-    <li>
-      <p class="info">{{ $t("empty") }}</p>
-    </li>
-  </ul>
-</template>
-
-<script>
-import { deleteFeed, currentFeeds$ } from "~/helpers/fb/feeds"
-
-export default {
-  subscriptions() {
-    return {
-      currentFeeds: currentFeeds$,
-    }
-  },
-  methods: {
-    async deleteFeed({ id }) {
-      await deleteFeed(id)
-      this.$toast.error(this.$t("deleted"), {
-        icon: "delete",
-      })
-    },
-  },
-}
-</script>
-
-<style scoped lang="scss">
-.virtual-list {
-  max-height: calc(100vh - 270px);
-}
-
-.clamb-3 {
-  display: -webkit-box;
-  -webkit-line-clamp: 3;
-  -webkit-box-orient: vertical;
-  @apply overflow-hidden;
-}
-</style>

+ 0 - 59
components/firebase/Inputform.vue

@@ -1,59 +0,0 @@
-<template>
-  <div class="flex-col">
-    <div class="show-on-large-screen">
-      <input
-        v-model="message"
-        :aria-label="$t('label')"
-        type="text"
-        autofocus
-        :placeholder="$t('paste_a_note')"
-        class="rounded-t-lg"
-        @keyup.enter="formPost"
-      />
-    </div>
-    <div class="border-b show-on-large-screen border-divider">
-      <input
-        v-model="label"
-        :aria-label="$t('label')"
-        type="text"
-        autofocus
-        :placeholder="$t('label')"
-        @keyup.enter="formPost"
-      />
-      <button
-        class="icon"
-        :disabled="!(message || label)"
-        value="Save"
-        @click="formPost"
-      >
-        <i class="material-icons">add</i>
-        <span>Add</span>
-      </button>
-    </div>
-  </div>
-</template>
-
-<script lang="ts">
-import Vue from "vue"
-import { writeFeed } from "~/helpers/fb/feeds"
-
-export default Vue.extend({
-  data() {
-    return {
-      message: null as string | null,
-      label: null as string | null,
-    }
-  },
-  methods: {
-    formPost() {
-      // TODO: Check this ?
-      if (!(this.message || this.label)) {
-        return
-      }
-      writeFeed(this.label as string, this.message as string)
-      this.message = null
-      this.label = null
-    },
-  },
-})
-</script>

+ 0 - 2
components/firebase/Login.vue

@@ -71,7 +71,6 @@ export default {
                 applySetting("syncHistory", true)
                 applySetting("syncCollections", true)
                 applySetting("syncEnvironments", true)
-                this.$router.push({ path: "/settings" })
                 toastObject.remove()
               },
             },
@@ -144,7 +143,6 @@ export default {
                 applySetting("syncHistory", true)
                 applySetting("syncCollections", true)
                 applySetting("syncEnvironments", true)
-                this.$router.push({ path: "/settings" })
                 toastObject.remove()
               },
             },

+ 0 - 30
components/http/Notes.vue

@@ -1,30 +0,0 @@
-<template>
-  <AppSection ref="sync" :label="$t('notes')" no-legend>
-    <div v-if="currentUser">
-      <FirebaseInputform />
-      <FirebaseFeeds />
-    </div>
-    <div v-else>
-      <p class="info">{{ $t("login_first") }}</p>
-      <FirebaseLogin @show-email="showEmail = true" />
-    </div>
-    <FirebaseEmail :show="showEmail" @hide-modal="showEmail = false" />
-  </AppSection>
-</template>
-
-<script>
-import { currentUser$ } from "~/helpers/fb/auth"
-
-export default {
-  subscriptions() {
-    return {
-      currentUser: currentUser$,
-    }
-  },
-  data() {
-    return {
-      showEmail: false,
-    }
-  },
-}
-</script>

+ 0 - 91
helpers/fb/feeds.ts

@@ -1,91 +0,0 @@
-import firebase from "firebase"
-import { BehaviorSubject } from "rxjs"
-import { currentUser$ } from "./auth"
-
-type HoppFeed = firebase.firestore.DocumentData & {
-  id: string
-  label: string
-  message: string
-}
-
-/**
- * An observable subject which is defined as an array of feeds
- * the current user has.
- *
- * Note: If this is null, then it means the user is not signed in
- */
-export const currentFeeds$ = new BehaviorSubject<HoppFeed[] | null>(null)
-
-export function initFeeds() {
-  let snapshotStop: (() => void) | null = null
-
-  currentUser$.subscribe((user) => {
-    if (!user && snapshotStop) {
-      // User has logged out, clean up snapshot listeners
-      snapshotStop()
-      snapshotStop = null
-    } else if (user) {
-      snapshotStop = firebase
-        .firestore()
-        .collection("users")
-        .doc(user.uid)
-        .collection("feeds")
-        .orderBy("createdOn", "desc")
-        .onSnapshot((feedsRef) => {
-          const feeds: HoppFeed[] = []
-
-          feedsRef.forEach((doc) => {
-            const feed = doc.data()
-            feed.id = doc.id
-            feeds.push(feed as HoppFeed)
-          })
-
-          currentFeeds$.next(feeds)
-        })
-    }
-  })
-}
-
-export async function writeFeed(label: string, message: string) {
-  if (currentUser$.value == null)
-    throw new Error("Logged out user cannot write to feeds")
-
-  const dt = {
-    createdOn: new Date(),
-    author: currentUser$.value.uid,
-    author_name: currentUser$.value.displayName,
-    author_image: currentUser$.value.photoURL,
-    message,
-    label,
-  }
-
-  try {
-    await firebase
-      .firestore()
-      .collection("users")
-      .doc(currentUser$.value.uid)
-      .collection("feeds")
-      .add(dt)
-  } catch (e) {
-    console.error("error inserting", dt, e)
-    throw e
-  }
-}
-
-export async function deleteFeed(id: string) {
-  if (currentUser$.value == null)
-    throw new Error("Logged out user cannot delete feed")
-
-  try {
-    await firebase
-      .firestore()
-      .collection("users")
-      .doc(currentUser$.value.uid)
-      .collection("feeds")
-      .doc(id)
-      .delete()
-  } catch (e) {
-    console.error("error deleting", id, e)
-    throw e
-  }
-}

+ 0 - 2
helpers/fb/index.ts

@@ -2,7 +2,6 @@ import firebase from "firebase"
 import { initAuth } from "./auth"
 import { initCollections } from "./collections"
 import { initEnvironments } from "./environments"
-import { initFeeds } from "./feeds"
 import { initHistory } from "./history"
 import { initSettings } from "./settings"
 
@@ -25,5 +24,4 @@ export function initializeFirebase() {
   initCollections()
   initHistory()
   initEnvironments()
-  initFeeds()
 }

+ 0 - 3
lang/bn-BD.json

@@ -263,10 +263,7 @@
   "syncCollections": "সংগ্রহ",
   "syncEnvironments": "এনভায়রনমেন্টসমূহ",
   "turn_on": "চালু করুন",
-  "login_first": "প্রথমে লগিন করুন",
-  "paste_a_note": "একটি মন্তব্য লিপিবদ্ধ করুন",
   "import_from_sync": "সিঙ্ক থেকে ইমপোর্ট করুন",
-  "notes": "মন্তব্য",
   "socketio": "সকেট ইনপুট/আউটপুট",
   "event_name": "ইভেন্টের নাম",
   "mqtt": "এম.কিউ.টি.টি",

+ 0 - 3
lang/de-DE.json

@@ -90,10 +90,7 @@
   "syncEnvironments": "Environments",
   "turn_on": "Anschalten",
   "turn_off": "Ausschalten",
-  "login_first": "Logge dich zuerst ein",
-  "paste_a_note": "Füge eine Notiz hinzu",
   "import_from_sync": "Von Sync importieren",
-  "notes": "Notizen",
   "socketio": "Socket.IO",
   "event_name": "Event Name",
   "mqtt": "MQTT",

+ 0 - 3
lang/en-US.json

@@ -266,10 +266,7 @@
   "syncEnvironments": "Environments",
   "turn_on": "Turn on",
   "turn_off": "Turn off",
-  "login_first": "Login first",
-  "paste_a_note": "Paste a note",
   "import_from_sync": "Import from Sync",
-  "notes": "Notes",
   "socketio": "Socket.IO",
   "event_name": "Event Name",
   "mqtt": "MQTT",

Some files were not shown because too many files changed in this diff