feat(autocomplete): add two complete widget examples#542
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 102 |
| Duplication | 2 |
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull request overview
This PR adds two new “advanced” autocomplete code samples (federated two-column autocomplete, and headless “@mentions”) for both React InstantSearch and InstantSearch.js, and wires them into CI so they build alongside existing samples.
Changes:
- Added a React InstantSearch federated autocomplete sample using
EXPERIMENTAL_Autocomplete. - Added a React InstantSearch headless mentions sample using the
useAutocompleteconnector. - Added equivalent InstantSearch.js (vanilla) samples and updated CircleCI to build the new projects.
Reviewed changes
Copilot reviewed 43 out of 51 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| react-instantsearch/autocomplete/yarn.lock | Adds locked dependencies for the new React federated autocomplete sample. |
| react-instantsearch/autocomplete/vite.config.js | Vite dev/build configuration for the new sample. |
| react-instantsearch/autocomplete/src/index.jsx | React entry point mounting the app. |
| react-instantsearch/autocomplete/src/index.css | Base page font + reset styling. |
| react-instantsearch/autocomplete/src/App.jsx | Federated two-column autocomplete example implementation. |
| react-instantsearch/autocomplete/src/App.css | Styling for the federated panel layout, products, and quick-access cards. |
| react-instantsearch/autocomplete/README.md | Usage instructions + sample description. |
| react-instantsearch/autocomplete/package.json | Declares sample deps and Vite scripts. |
| react-instantsearch/autocomplete/index.html | Vite HTML entry with #root mount. |
| react-instantsearch/autocomplete/.gitignore | Ignores node/build artifacts for the sample. |
| react-instantsearch/autocomplete-mentions/yarn.lock | Adds locked dependencies for the React mentions sample. |
| react-instantsearch/autocomplete-mentions/vite.config.js | Vite dev/build configuration for the mentions sample. |
| react-instantsearch/autocomplete-mentions/src/index.jsx | React entry point mounting the mentions app. |
| react-instantsearch/autocomplete-mentions/src/index.css | Base page font + reset styling. |
| react-instantsearch/autocomplete-mentions/src/App.jsx | Headless mentions textarea example using useAutocomplete. |
| react-instantsearch/autocomplete-mentions/src/App.css | Styling for textarea + suggestion panel. |
| react-instantsearch/autocomplete-mentions/README.md | Usage instructions + sample description. |
| react-instantsearch/autocomplete-mentions/package.json | Declares sample deps (incl. textarea-caret) and scripts. |
| react-instantsearch/autocomplete-mentions/index.html | Vite HTML entry with #root mount. |
| react-instantsearch/autocomplete-mentions/.gitignore | Ignores node/build artifacts for the sample. |
| instantsearch.js/autocomplete/src/index.css | Base page font + reset styling (vanilla sample). |
| instantsearch.js/autocomplete/src/app.js | Federated autocomplete widget implementation (InstantSearch.js). |
| instantsearch.js/autocomplete/src/app.css | Styling for federated panel layout + results. |
| instantsearch.js/autocomplete/README.md | Usage instructions + sample description. |
| instantsearch.js/autocomplete/package.json | Parcel-based build/lint scripts for the sample. |
| instantsearch.js/autocomplete/manifest.webmanifest | PWA manifest for the sample. |
| instantsearch.js/autocomplete/index.html | Vanilla HTML page loading Algolia + InstantSearch via CDN. |
| instantsearch.js/autocomplete/.prettierrc | Prettier configuration for the sample. |
| instantsearch.js/autocomplete/.gitignore | Ignores node/build artifacts for the sample. |
| instantsearch.js/autocomplete/.eslintrc.js | ESLint config for the sample. |
| instantsearch.js/autocomplete/.eslintignore | ESLint ignore list for build artifacts. |
| instantsearch.js/autocomplete/.editorconfig | EditorConfig for consistent formatting. |
| instantsearch.js/autocomplete-mentions/src/index.css | Base page font + reset styling (mentions sample). |
| instantsearch.js/autocomplete-mentions/src/app.js | Headless mentions implementation using connectAutocomplete. |
| instantsearch.js/autocomplete-mentions/src/app.css | Styling for textarea + suggestion panel (vanilla). |
| instantsearch.js/autocomplete-mentions/README.md | Usage instructions + sample description. |
| instantsearch.js/autocomplete-mentions/package.json | Parcel-based build/lint scripts for the mentions sample. |
| instantsearch.js/autocomplete-mentions/manifest.webmanifest | PWA manifest for the mentions sample. |
| instantsearch.js/autocomplete-mentions/index.html | Vanilla HTML page for mentions sample loading CDN scripts. |
| instantsearch.js/autocomplete-mentions/.prettierrc | Prettier configuration for the mentions sample. |
| instantsearch.js/autocomplete-mentions/.gitignore | Ignores node/build artifacts for the mentions sample. |
| instantsearch.js/autocomplete-mentions/.eslintrc.js | ESLint config for the mentions sample. |
| instantsearch.js/autocomplete-mentions/.eslintignore | ESLint ignore list for build artifacts. |
| instantsearch.js/autocomplete-mentions/.editorconfig | EditorConfig for consistent formatting. |
| .circleci/config.yml | Adds build steps for the new React and vanilla autocomplete samples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Haroenv
left a comment
There was a problem hiding this comment.
looks good. What prevents the rules from being set?
| @@ -0,0 +1,203 @@ | |||
| /* global instantsearch algoliasearch */ | |||
|
|
|||
| const { connectAutocomplete } = instantsearch.connectors; | |||
There was a problem hiding this comment.
this isn't using the autocomplete widget, but I guess that doesn't hurt? I don't think we have many users of this pattern anyway
| // Quick-access cards. In production these come from an Algolia Rule that | ||
| // returns custom JSON on `results.userData`. The public demo index has no such | ||
| // Rule, so this constant stands in for that data. |
There was a problem hiding this comment.
why don't you add it to the rules?
| // Quick-access cards. In production these come from an Algolia Rule that | ||
| // returns custom JSON on `results.userData`. The public demo index has no such | ||
| // Rule, so this constant stands in for that data. | ||
| const QUICK_ACCESS = [ |
This PR adds examples for autocomplete widget based on the two advanced examples for the older standalone autocomplete.