From 474c06738ddc97d9e7efdfc937bfe49c8714f94a Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Fri, 20 Nov 2020 13:35:03 -0600 Subject: [PATCH] Enable filtering by status --- components/search.vue | 33 +++++++++++++++++++++++++++++++-- helpers/build-app-list.js | 8 ++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/components/search.vue b/components/search.vue index a729f27..8377c82 100644 --- a/components/search.vue +++ b/components/search.vue @@ -135,6 +135,18 @@ export default { quickButtons: { type: Array, default: () => [ + { + label: '✅ Full Native Support', + query: 'status:native' + }, + { + label: '✳️ Rosetta', + query: 'status:rosetta' + }, + { + label: '🚫 Unsupported', + query: 'status:no' + }, { label: 'Music Tools', query: 'Music' @@ -166,6 +178,7 @@ export default { titleStartsWithResults: [], titleContainsResults: [], sectionContainsResults: [], + statusResults: [], // store: overlayStore.state } }, @@ -176,7 +189,8 @@ export default { return [ ...this.titleStartsWithResults, ...this.titleContainsResults, - ...this.sectionContainsResults + ...this.sectionContainsResults, + ...this.statusResults ] }, hasSearchInputText () { @@ -221,6 +235,19 @@ export default { } return matches }, + statusIs (query, app) { + if (!query.includes('status:')) return + + const [_, status] = query.split(':') + + const matches = app.status.includes(status) + + if (matches) { + this.statusResults.push(app) + } + + return matches + }, // Search tools pluck (array, index) { const pluckedItem = array[index] @@ -238,6 +265,7 @@ export default { this.titleStartsWithResults = [] this.titleContainsResults = [] this.sectionContainsResults = [] + this.statusResults = [] // Snap results scroll position back to top @@ -257,7 +285,8 @@ export default { const matchers = [ this.titleStartsWith, this.titleContains, - this.sectionContains + this.sectionContains, + this.statusIs ] // Run through our search priorities diff --git a/helpers/build-app-list.js b/helpers/build-app-list.js index df41cde..4e466b9 100644 --- a/helpers/build-app-list.js +++ b/helpers/build-app-list.js @@ -7,10 +7,10 @@ import slugify from 'slugify' const md = new MarkdownIt() -const statuses = { - '✅': 'yes', - '✳️': 'yes-but', - '⏹': 'in-progress', +export const statuses = { + '✅': 'native', + '✳️': 'rosetta', + '⏹': 'no-in-progress', '🚫': 'no' }