Implement search for Relays

This commit is contained in:
Angelina Filippova 2021-02-07 01:15:31 +03:00
parent 6921d905dc
commit f02ff602b5
2 changed files with 18 additions and 1 deletions

View file

@ -308,6 +308,12 @@ export const formSearchObject = description => {
key: ':terms_of_services',
label: 'Terms of Services',
search: ['Terms of Services', ':terms_of_services']
}, {
groupKey: 'relays',
groupLabel: 'Relays',
key: ':relays',
label: 'Relays',
search: ['Relays', ':relays']
}]
return processedDescription.concat(searchDataForEditableDocs)
}

View file

@ -1,5 +1,5 @@
<template>
<div v-if="!loading" class="relays-container">
<div v-if="!loading" class="relays-container" data-search="relays">
<div class="follow-relay-container">
<el-input v-model="newRelay" :placeholder="$t('settings.followRelay')" class="follow-relay" @keyup.enter.native="followRelay"/>
<el-button @click.native="followRelay">{{ $t('settings.follow') }}</el-button>
@ -51,10 +51,21 @@ export default {
},
relays() {
return this.$store.state.relays.fetchedRelays
},
searchQuery() {
return this.$store.state.settings.searchQuery
}
},
mounted() {
this.$store.dispatch('FetchRelays')
if (this.searchQuery.length > 0) {
const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`)
if (selectedSetting) {
selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' })
}
this.$store.dispatch('SetSearchQuery', '')
}
},
methods: {
followRelay() {