From 0632e82a4b309601532164eaed5a75e8acb16f19 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Fri, 8 Apr 2022 14:07:39 +0100 Subject: [PATCH] Squashed commit of the following: commit 09bed349469032c3e86b6077faa7e8aa88a6066c Author: James Ritchie Date: Fri Apr 8 14:03:50 2022 +0100 Fixed the layout of a search list item commit 90126d43ad4ee81cab8ec1c797f9ed1f280b9703 Author: Eric Allam Date: Fri Apr 1 17:25:13 2022 +0100 Insanely complicated path search results highlighitng and truncating commit a4bbd5521e1cd3ad8a086bfe263622067736a650 Author: James Ritchie Date: Fri Apr 1 14:05:01 2022 +0100 Improved the title editing in the header commit 5814053968363b2faa25f621e8b080350844ccd5 Author: James Ritchie Date: Fri Apr 1 13:38:33 2022 +0100 Improved text highlight colour commit 110de372423efaed8e173de759c6b6379d7ed696 Author: James Ritchie Date: Fri Apr 1 13:36:57 2022 +0100 Icon hover state now uses isHighlighted commit fb6da943d9448a894156b352239f3e82bdfdf5fe Author: James Ritchie Date: Fri Apr 1 13:31:11 2022 +0100 Light mode styling commit 2c378d51587396c55736f57442e2f08b4669abcc Author: James Ritchie Date: Fri Apr 1 12:24:43 2022 +0100 Spacing between search items no longer a hack commit 85d90bb0ae4cdc3e1ae0c53be508643e85235cec Author: Eric Allam Date: Fri Apr 1 12:19:10 2022 +0100 Added ellipsis to search matches if they are windowed commit 91f3e70676ae7c1462c3b9c8d035642488cce501 Author: Eric Allam Date: Fri Apr 1 12:08:00 2022 +0100 Fixed search item icons commit e384c87c6fdc4280c15ed1c5aac4dd27a2559da5 Author: James Ritchie Date: Fri Apr 1 11:52:58 2022 +0100 Improved hover state commit f4681edc078f726c729cf1dba75f422c00f43dd5 Author: James Ritchie Date: Fri Apr 1 11:47:33 2022 +0100 Removed focus state on button commit faa2d0663cb0c8d29d2a0812b0a0c3f668a2244c Author: Eric Allam Date: Fri Apr 1 11:26:42 2022 +0100 made the search palette a little bigger commit df8bd521fe716317443e74c2c7233762dbc56410 Author: Eric Allam Date: Fri Apr 1 11:26:14 2022 +0100 Remove onOverlayClick prop commit ecd046b3b22014760e4fac52cb954e7fbc5ebe09 Author: Eric Allam Date: Fri Apr 1 11:18:46 2022 +0100 Close search when the overlay is clicked commit fba330b5d955919fa407ad7055bbbb2edf471413 Author: Eric Allam Date: Fri Apr 1 11:10:35 2022 +0100 hitting esc when search input is focused and empty should close the search commit fc2fe8ae6f2c9f978b63d9e4c4806f1c9135b4e0 Author: Eric Allam Date: Fri Apr 1 11:00:08 2022 +0100 Highlight the window of the best search match in the search results commit 45193ec92ccbbea68fba6bca6579fb055eb89cb5 Author: James Ritchie Date: Fri Apr 1 10:45:01 2022 +0100 Now you can arrow down to the last item in the list commit 0de5fef7e9947bfda1ec35362fb1d0ff0a59c0af Author: James Ritchie Date: Fri Apr 1 10:37:20 2022 +0100 Added a hacky margin between items and remove the transition to make it feel snappier commit 167b548343f7bd084c3b048985bcdc8a926ec781 Author: Eric Allam Date: Fri Apr 1 09:30:33 2022 +0100 WIP implementing search commit 5655631f1254385e9f9e71386737ff7cccbdcebe Author: James Ritchie Date: Fri Mar 25 15:28:19 2022 +0000 Build and styled search modal commit e368db81c8f7d22dddd93dd7aad90c9951974044 Author: Eric Allam Date: Fri Mar 25 14:42:03 2022 +0000 Implement JSON search through fuse.js + web worker + react hook commit 8caa11ba1ce888d808fb56aaf2ccca31279bff50 Author: Eric Allam Date: Wed Mar 23 10:21:33 2022 +0000 Start of the Command Palette using radix-ui Dialog commit 904b64d7810815ae853a17bb782e6effeacf457d Author: Eric Allam Date: Wed Mar 23 09:58:52 2022 +0000 Uncommented out the search bar field --- .gitignore | 3 +- app/components/DocumentTitle.tsx | 34 +- app/components/Icons/ArrowKeysUpDownIcon.tsx | 23 + app/components/Icons/LoadingIcon.tsx | 27 + app/components/JsonView.tsx | 2 +- app/components/SearchBar.tsx | 76 ++- app/components/SearchPalette.tsx | 428 +++++++++++++ app/components/UI/Dialog.tsx | 30 + app/entry.worker.ts | 66 ++ app/hooks/useJsonSearch.tsx | 258 ++++++++ app/hooks/useJsonTree.tsx | 2 +- app/routes/j/$id.tsx | 51 +- app/useColumnView/index.ts | 4 +- app/utilities/formatter.ts | 17 +- app/utilities/icons.ts | 154 +++++ app/utilities/jsonColumnView.ts | 153 +---- app/utilities/search.ts | 577 +++++++++++++++++ package-lock.json | 214 ++++++- package.json | 14 +- tailwind.config.js | 8 +- tests/search.test.ts | 618 +++++++++++++++++++ 21 files changed, 2521 insertions(+), 238 deletions(-) create mode 100644 app/components/Icons/ArrowKeysUpDownIcon.tsx create mode 100644 app/components/Icons/LoadingIcon.tsx create mode 100644 app/components/SearchPalette.tsx create mode 100644 app/components/UI/Dialog.tsx create mode 100644 app/entry.worker.ts create mode 100644 app/hooks/useJsonSearch.tsx create mode 100644 app/utilities/icons.ts create mode 100644 app/utilities/search.ts create mode 100644 tests/search.test.ts diff --git a/.gitignore b/.gitignore index 086306b..235185c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ node_modules /dist .mf /meta.json -/stats.html \ No newline at end of file +/stats.html +public/entry.worker.js \ No newline at end of file diff --git a/app/components/DocumentTitle.tsx b/app/components/DocumentTitle.tsx index b8bdbbf..91c6a9e 100644 --- a/app/components/DocumentTitle.tsx +++ b/app/components/DocumentTitle.tsx @@ -27,26 +27,24 @@ export function DocumentTitle() { className="flex justify-center items-center w-full" title={doc.title} > - setEditedTitle(e.target.value)} - /> + {match(editedTitle) - .with(doc.title, () => ( - - )) + .with(doc.title, () =>

Save

) .with("", () => (