From 0014991e41c41f69af09769eb6b71180185f3d5a Mon Sep 17 00:00:00 2001 From: Frank Rousseau Date: Wed, 27 Sep 2023 17:40:25 +0200 Subject: [PATCH] [projects] Allow to search in projects --- src/components/pages/OpenProductions.vue | 37 ++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/components/pages/OpenProductions.vue b/src/components/pages/OpenProductions.vue index 866416b619..af8cfe2b67 100644 --- a/src/components/pages/OpenProductions.vue +++ b/src/components/pages/OpenProductions.vue @@ -25,6 +25,14 @@ class="open-productions-box" v-if="!isOpenProductionsLoading && openProductions.length > 0" > +
+ +
+
import { mapGetters, mapActions } from 'vuex' -import colors from '@/lib/colors.js' +import { buildNameIndex } from '@/lib/indexing' + +import colors from '@/lib/colors' import EditProductionModal from '@/components/modals/EditProductionModal' +import SearchField from '@/components/widgets/SearchField' import Spinner from '@/components/widgets/Spinner' export default { @@ -103,11 +114,14 @@ export default { components: { EditProductionModal, + SearchField, Spinner }, data() { return { + filteredProductions: [], + search: '', errors: { edit: false }, @@ -120,6 +134,12 @@ export default { } }, + mounted() { + this.$refs['search-field'].focus() + this.filteredProductions = this.openProductions + this.productionIndex = buildNameIndex(this.openProductions) + }, + computed: { ...mapGetters([ 'isCurrentUserAdmin', @@ -196,6 +216,15 @@ export default { hideNewModal() { this.modals.isNewDisplayed = false + }, + + onSearchChange(search) { + console.log(search) + if (search === '') { + this.filteredProductions = this.openProductions + } else { + this.filteredProductions = this.productionIndex[search] + } } }, @@ -385,6 +414,10 @@ a.secondary:hover { } } +.search-area { + justify-content: center; +} + @media screen and (max-width: 768px) { .title { margin-top: 1em;