From fb8cd8aa895d2b7ee609bb84f23ab52c37d4a01f Mon Sep 17 00:00:00 2001
From: jdlugosz963 <jdlugosz963@gmail.com>
Date: Tue, 14 Dec 2021 09:06:45 +0100
Subject: clean up project tree

---
 src/components/Searcher.vue | 157 --------------------------------------------
 1 file changed, 157 deletions(-)
 delete mode 100644 src/components/Searcher.vue

(limited to 'src/components/Searcher.vue')

diff --git a/src/components/Searcher.vue b/src/components/Searcher.vue
deleted file mode 100644
index df6dd9e..0000000
--- a/src/components/Searcher.vue
+++ /dev/null
@@ -1,157 +0,0 @@
-<template>
-  <div id="searcher">
-    <input 
-      type="text" 
-      v-model='search' 
-      ref='input' 
-      @keydown="hotkeys" 
-      @blur="close()"
-      placeholder="Search!"
-    />
-
-    <Sugestion 
-      v-for="sugestion in sugestions" 
-      :key="sugestion[0]"
-      :sugestion="sugestion"
-      :class="{selected: sugestion[0] === current[0]}"
-    />
-  </div>
-</template>
-
-<script>
-import CommandsService from '@/services/CommandsService'
-import Sugestion from '@/components/Sugestion.vue'
-
-export default {
-  data() {
-    return {
-      commands: CommandsService,
-      search: '',
-      sugestions: [],
-      current: []
-    }
-  },
-
-  methods: {
-    set_sugestions() {
-      const sugestions = []
-      let is_current_set = false
-
-      Object.entries(this.commands).forEach((element) => {
-        if(element[0].startsWith(this.search) && element[1] instanceof Function) {
-          sugestions.push(element)
-          if(!is_current_set){ 
-            this.current = element
-            is_current_set = true;
-          }
-        }
-      });
-      this.sugestions = sugestions
-    },
-
-    close() {
-      this.$emit('close')
-    },
-
-    change_current(a=1) {
-      let index = this.sugestions.findIndex(element => element===this.current)
-      let new_current = this.sugestions[index+a]
-
-      if (new_current) this.current = new_current 
-      else this.current = this.sugestions[0]
-    },
-
-    async execute_current() {
-      let out = await this.current[1](this)
-
-      if(out instanceof Object) {
-        this.search = ''
-        this.commands = out
-      }
-    },
-
-    hotkeys(e) {
-      switch(e.code) {
-        case 'Escape':
-          e.preventDefault()
-          this.close()
-          break
-        case 'ArrowDown':
-          e.preventDefault()
-          this.change_current(1)
-          break
-        case 'ArrowUp':
-          e.preventDefault()
-          this.change_current(-1)
-          break
-        case 'Tab':
-          e.preventDefault()
-          this.change_current(1)
-          break
-        case 'Enter':
-          e.preventDefault()
-          this.execute_current()
-          break
-        case 'ShiftLeft':
-          e.preventDefault()
-          this.commands = CommandsService
-          break
-      }
-    },
-  },
-
-  watch: {
-    search() {
-      this.set_sugestions()
-    },
-
-    commands() {
-      this.set_sugestions()
-    }
-  },
-
-  computed: {
-    
-  },
-
-  components: {
-    Sugestion
-  },
-
-  created() {
-    this.set_sugestions()
-
-    this.$nextTick(function () {
-      this.$refs.input.focus()
-    })
-  }
-}
-</script>
-
-<style scoped>
-  #searcher {
-    position: absolute;
-    width: 30%;
-    height: 80%;
-    top: 50%;
-    left: 50%;
-    background-color: #202020;
-    padding: 20px;
-    border-radius: 10px;
-    transform: translate(-50%, -50%);
-  }
-
-  #searcher input {
-    width: 100%;
-    margin-bottom: 20px;
-    padding: 10px;
-    padding-right: 0px;
-    height: 20px;
-    border: none;
-    background-color: #303030;
-  }
-
-  .selected {
-    background-color: #505050;
-  }
-</style>
-- 
cgit v1.2.3

