diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 5d4c517..bf30eaa 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -7,6 +7,9 @@ "": { "name": "frontend", "version": "0.0.0", + "dependencies": { + "fuse.js": "^7.0.0" + }, "devDependencies": { "@sveltejs/vite-plugin-svelte": "^3.1.2", "@tsconfig/svelte": "^5.0.2", @@ -890,6 +893,14 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/fuse.js": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-7.0.0.tgz", + "integrity": "sha512-14F4hBIxqKvD4Zz/XjDc3y94mNZN6pRv3U13Udo0lNLCWRBUsrMv2xwcF/y/Z5sV6+FQW+/ow68cHpm4sunt8Q==", + "engines": { + "node": ">=10" + } + }, "node_modules/is-reference": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index 83601b9..ebb9abc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -21,5 +21,7 @@ "vite": "^5.4.10", "prettier": "^3.3.3" }, - "dependencies": {} + "dependencies": { + "fuse.js": "^7.0.0" + } } diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index d8e5668..9410636 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -6,6 +6,7 @@ import type {FullCrate, Indexes} from "./crate-db"; import Filter from "./lib/Filter.svelte"; import ForkMe from "./lib/ForkMe.svelte"; + import TextFilter from "./lib/TextFilter.svelte"; export let BUILD_DATE: string; @@ -16,6 +17,7 @@ let selected_l: number[][] = []; let selected_r: number[][] = []; let selected_i: number[][] = []; + let selected_f: number[][] = []; function combine_filters(crate_length: number, selected: any): number[] { let selected_crates = Array.from({length: crate_length}, (_, i) => i + 1); @@ -39,7 +41,7 @@ } } - $: selected_crates = combine_filters(t_crates.length, [selected_d, selected_l, selected_r, selected_i]); + $: selected_crates = combine_filters(t_crates.length, [selected_d, selected_l, selected_r, selected_i, selected_f]); @@ -49,8 +51,8 @@

{selected_crates.length} awesome drivers waiting for you!

-
+ diff --git a/frontend/src/lib/TextFilter.svelte b/frontend/src/lib/TextFilter.svelte new file mode 100644 index 0000000..d5ef970 --- /dev/null +++ b/frontend/src/lib/TextFilter.svelte @@ -0,0 +1,32 @@ + + +
+ +
\ No newline at end of file