From 279234a081e5ea772978732ae5d2e45d8adcd741 Mon Sep 17 00:00:00 2001 From: Zephyrrus Date: Wed, 22 Jul 2020 02:14:06 +0300 Subject: feat: add new search input For now, it clones the autocomplete from buefy, untill a PR or resolution to the opened issue about not being able to manipulate how the suggestions are applied is found --- src/site/components/search-input/SearchInput.vue | 516 +++++++++++++++++++++++ src/site/components/search/Search.vue | 119 ++++++ src/site/pages/dashboard/index.vue | 21 +- src/site/store/images.js | 1 + 4 files changed, 646 insertions(+), 11 deletions(-) create mode 100644 src/site/components/search-input/SearchInput.vue create mode 100644 src/site/components/search/Search.vue (limited to 'src') diff --git a/src/site/components/search-input/SearchInput.vue b/src/site/components/search-input/SearchInput.vue new file mode 100644 index 0000000..abc433a --- /dev/null +++ b/src/site/components/search-input/SearchInput.vue @@ -0,0 +1,516 @@ + + + diff --git a/src/site/components/search/Search.vue b/src/site/components/search/Search.vue new file mode 100644 index 0000000..57226a9 --- /dev/null +++ b/src/site/components/search/Search.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/src/site/pages/dashboard/index.vue b/src/site/pages/dashboard/index.vue index d623b5c..cfd68ba 100644 --- a/src/site/pages/dashboard/index.vue +++ b/src/site/pages/dashboard/index.vue @@ -16,17 +16,7 @@
- - -

- - Search - -

-
+
@@ -68,11 +58,13 @@ import { mapState, mapGetters, mapActions } from 'vuex'; import Sidebar from '~/components/sidebar/Sidebar.vue'; import Grid from '~/components/grid/Grid.vue'; +import Search from '~/components/search/Search.vue'; export default { components: { Sidebar, Grid, + Search, }, middleware: ['auth', ({ store }) => { store.commit('images/resetState'); @@ -82,6 +74,7 @@ export default { return { current: 1, isLoading: false, + search: '', }; }, computed: { @@ -98,6 +91,9 @@ export default { watch: { current: 'fetchPaginate', }, + created() { + this.filteredHints = this.hints; // fixes the issue where on pageload, suggestions wont load + }, methods: { ...mapActions({ fetch: 'images/fetch', @@ -107,6 +103,9 @@ export default { await this.fetch(this.current); this.isLoading = false; }, + onSearch(query) { + this.searc = query; + }, }, }; diff --git a/src/site/store/images.js b/src/site/store/images.js index be04c8a..4737c26 100644 --- a/src/site/store/images.js +++ b/src/site/store/images.js @@ -8,6 +8,7 @@ export const getDefaultState = () => ({ limit: 30, totalFiles: 0, }, + search: '', albumName: null, albumDownloadEnabled: false, fileExtraInfoMap: {}, // information about the selected file -- cgit v1.2.3