Skip to content

Commit 296f686

Browse files
committed
feat(faq): Allow searching FAQs
1 parent 5883a96 commit 296f686

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

pages/faq.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
<v-row justify="center" align="center">
44
<v-col cols="10" sm="8">
55
<h1 class="headline">Frequently Asked Questions</h1>
6-
<div v-for="faq in faqs" :key="faq.question" class="mt-5">
6+
<v-text-field
7+
append-icon="mdi-magnify"
8+
class="mt-2 mb-4"
9+
v-model="searchQuery"
10+
label="Search questions..."/>
11+
<div v-for="faq in filteredFaqs" :key="faq.question" class="mt-5">
712
<v-card class="mb-5 mr-5" rounded>
813
<v-card-title
914
style="cursor: pointer"
@@ -24,6 +29,9 @@
2429
</v-expand-transition>
2530
</v-card>
2631
</div>
32+
<div v-if="filteredFaqs.length === 0">
33+
<h2>No FAQs found for your search query</h2>
34+
</div>
2735
</v-col>
2836
</v-row>
2937
<v-row justify="center" align="center">
@@ -49,7 +57,8 @@
4957
export default {
5058
name: 'DownloadPage',
5159
data() {
52-
return {
60+
const ret = {
61+
searchQuery: '',
5362
faqs: [
5463
{
5564
question: 'Which browsers are supported by floccus?',
@@ -130,7 +139,7 @@ If you are missing some toplevel folders on a browser, try setting a different l
130139
After two hours of trying floccus should override the lock and finally start syncing again. If this doesn't happen for you, please have a look at the issues section on the floccus github repository and perhaps file a new issue there.`,
131140
},
132141
{
133-
question: "I'm seeing 'Failed to map parentId' errors . What can I do?",
142+
question: "I'm seeing 'Failed to map parentId' errors. What can I do?",
134143
answer: `This error indicates that something went wrong during the sync. The developers are aware of these errors and are working on fixing all instances of them. In the meantime you can try to trigger a sync from scratch in the settings of the profile that errored. Make sure you have a backup of your bookmarks before you do this, and check your bookmarks for deleted bookmarks that may have come back. You can be sure that nothing will be deleted in this step, though.`,
135144
},
136145
{
@@ -143,6 +152,18 @@ After two hours of trying floccus should override the lock and finally start syn
143152
},
144153
].map(faq => ({...faq, show: false})),
145154
}
155+
ret.filteredFaqs = ret.faqs
156+
return ret
157+
},
158+
watch: {
159+
searchQuery() {
160+
if (this.searchQuery.trim() === '') {
161+
this.filteredFaqs = this.faqs
162+
return
163+
}
164+
const queries = this.searchQuery.split(' ')
165+
this.filteredFaqs = this.faqs.filter(faq => queries.every(query => faq.question.includes(query)) || queries.every(query => faq.answer.includes(query)))
166+
}
146167
},
147168
head: {
148169
title: 'Frequently Asked Questions',

0 commit comments

Comments
 (0)