Skip to content

Commit

Permalink
Added feature of searchable profiles and presets in the filter sectio…
Browse files Browse the repository at this point in the history
…n. Filter section is toggled by default
  • Loading branch information
elsoazemelet committed Jan 24, 2024
1 parent 5267c40 commit 2cdba3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/routes/EditorLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
let configTypeSelector: "profile" | "preset" = "profile";
let isSearchSortingShows = false;
let isSearchSortingShows = true;
async function editorMessageListener(event: MessageEvent) {
if (event.data.messageType == "localConfigs") {
Expand Down
19 changes: 11 additions & 8 deletions src/routes/Filter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@
}
let searchSuggestions: string[] = [
"Profile",
"Preset",
"BU16",
"EF44",
"EN16",
"PBF4",
"PO16",
"button",
"encoder",
"potentiometer",
"fader",
"system"
"Button",
"Encoder",
"Potentiometer",
"Fader",
"System"
];
enum SortFieldType {
Expand All @@ -55,11 +57,12 @@
const arrayOfSearchTerms = searchString.trim().toLowerCase().split(" ");
const filtered = array.filter((config) => {
const currentProfileSearchable =
config.name.toLowerCase() + " " + config.type.toLowerCase();
const currentProfileSearchable = String(
`${config.name} ${config.type} ${config.configType}`
).toLocaleLowerCase();
for (const searchTerm of arrayOfSearchTerms) {
if (currentProfileSearchable.indexOf(searchTerm) === -1) {
if (currentProfileSearchable.indexOf(searchTerm.toLocaleLowerCase()) === -1) {
return false;
}
}
Expand Down

0 comments on commit 2cdba3a

Please sign in to comment.