Commit Graph

179 Commits

Author SHA1 Message Date
Sanne de Vries
12791f54e6 Fixed scroll bar bug 2022-07-06 12:08:37 +02:00
Naz
b6ecad0488 Removed local storage caching
refs https://github.com/TryGhost/Team/issues/1665

- This is a premature optimization that's causing loads of roadblocks while everyone is cracking on the feature (the data format changes, etc.)
- Once we are set on the format and need a performance boost we should design a suitable caching mechanism (the current one does not take resource updates into account, so can cause stale content)
2022-07-06 11:42:06 +02:00
Rishabh
9460875638 Added hash link for opening search
refs https://github.com/TryGhost/Team/issues/1665

- adds custom hash url for opening sodo search on site - `/#/sodo-search
- closes the search popup by default
2022-07-06 11:41:54 +02:00
Naz
21a9a4eaba 🐛 Fixed broken index when API returns no results
refs https://github.com/TryGhost/Team/issues/1665

- The search index should be initialized regardless, even if there are no items to put into it the index should be an empty one.
2022-07-06 11:31:23 +02:00
Naz
cc87eb4bc9 Cleaned up initialization test
refs https://github.com/TryGhost/Team/issues/1665

- There is no need to return any data for the initialization test
2022-07-06 11:27:29 +02:00
Naz
8b59245893 Added urls to search resources
refs https://github.com/TryGhost/Team/issues/1665

- We need a way to visit the resource found through search. It should not be included in searchable fields though
2022-07-06 11:26:12 +02:00
Sanne de Vries
b0afdaba10 Increased clickable area for search input 2022-07-06 11:24:22 +02:00
Rishabh
2e8dca570d Fixed display flicker missing class name
refs https://github.com/TryGhost/Team/issues/1665
2022-07-06 11:18:41 +02:00
Rishabh
1f0a6859d8 Removed css load flicker on opening search
refs https://github.com/TryGhost/Team/issues/1665

- removes the flicker caused by lag in css load with inline css override
- adds search close on clicking outside the popup
2022-07-06 11:11:02 +02:00
Rishabh
9fe12641cf v0.1.1 2022-07-06 11:10:03 +02:00
Naz
592e051485 Connected tags to the search index
refs https://github.com/TryGhost/Team/issues/1665

- Tags should be searchable. This change hooks up the Tags Content API with the search index
2022-07-06 10:56:16 +02:00
Naz
dfc5b1c33d Connected authors to the search index
refs https://github.com/TryGhost/Team/issues/1665

- Authors should be searchable. This change hooks up the Authors Content API with the search index
2022-07-06 10:38:00 +02:00
Djordje Vlaisavljevic
906f96827c Fixed position on larger screens 2022-07-06 10:25:01 +02:00
Djordje Vlaisavljevic
b3bbb03c79 Fixed the svg icon flicker 2022-07-06 10:25:01 +02:00
Rishabh
e6c7d66553 Updated package json for publishing upstream
- cleans up package json for publish to npm
2022-07-06 10:17:05 +02:00
Rishabh
d9f7534169 Updated css bundle logic for iframe
refs https://github.com/TryGhost/Team/issues/1665

- css bundle is fetched from an external url, which is different for development and production
- updates bundle to be fetched via unpkg for production using app version
- extracts version information from script tag in root
2022-07-06 10:17:05 +02:00
Djordje Vlaisavljevic
31cb31d5ad Fixed conflicts 2022-07-06 10:16:49 +02:00
Djordje Vlaisavljevic
d15fa439d1 Updated mobile design 2022-07-06 10:13:45 +02:00
Djordje Vlaisavljevic
7e247102f3 Added the close icon 2022-07-06 10:10:22 +02:00
Djordje Vlaisavljevic
7de1877d36 Added max-height for results 2022-07-06 10:10:22 +02:00
Sanne de Vries
b3e8da4df1 Updated search box placeholder 2022-07-06 09:59:39 +02:00
Sanne de Vries
ea21196fa2 Updated clear search results button 2022-07-06 09:57:06 +02:00
Rishabh
36aa8d7558 Updated posts data to use new collection data
- search results are now broken into separate collections for posts, authors and tags
2022-07-05 17:43:52 +02:00
Rishabh
c429b90c11 Fixed empty search result causing UI crash 2022-07-05 17:37:51 +02:00
Naz
df03c47ac1 Search results returning posts as separate attribute
refs https://github.com/TryGhost/Team/issues/1665

- The search results will be handling authors and tags searches as a next step - this change is a groundwork before making this move.
2022-07-05 17:35:29 +02:00
Rishabh
34a3e4ade7 Added redirect for post on search click
- allows click on post result to open it on click when searched
- adds `slug` to content api for data
2022-07-05 17:34:43 +02:00
Sanne de Vries
31b64c032e Updated search box and result spacing 2022-07-05 17:33:56 +02:00
Djordje Vlaisavljevic
a1ed73808a Added background blur when the modal is open 2022-07-05 17:10:02 +02:00
Rishabh
3c0a5c8081 Updated search result to use real posts data
- uses elasticlunr to compare search result with real site post data
2022-07-05 17:01:17 +02:00
Djordje Vlaisavljevic
4243959ac9 Updated clear button 2022-07-05 16:51:29 +02:00
Rishabh
d952c38a7f Removed empty tag section in search
- if no tags match the search, removes the section
2022-07-05 16:44:02 +02:00
Rishabh
98a7b77760 Added no results box to search result 2022-07-05 16:41:05 +02:00
Naz
b77fee0735 Added post properties to search results
refs https://github.com/TryGhost/Team/issues/1665

- The npm package for elasticlunr does not contain the latest changes (no way to include document properties in search results). This hack adds document properties manually.
- Long term we should think about either helping the maintainer with releases of the library or weight out alternatives like fuse.js (https://fusejs.io)
2022-07-05 16:38:37 +02:00
Rishabh
72aa270282 Updated search behavior with local data
- removes section on no search result
- updates clear to remove search string
- updates authors and tags with correct matching data
2022-07-05 16:34:15 +02:00
Djordje Vlaisavljevic
ef921843f4 Added empty results state 2022-07-05 16:29:43 +02:00
Rishabh
5b97a43982 Updated search with local data 2022-07-05 16:25:49 +02:00
Sanne de Vries
84881524d7 Updated placeholder content 2022-07-05 16:21:07 +02:00
Djordje Vlaisavljevic
f44a43c1e9 Made tracking on section headings wider 2022-07-05 16:02:31 +02:00
Djordje Vlaisavljevic
fd1e87a037 Added AuthorAvatar component to handle placeholder avatars 2022-07-05 15:56:56 +02:00
Djordje Vlaisavljevic
bf2166b818 Added placeholder author avatars 2022-07-05 15:51:51 +02:00
Sanne de Vries
3b968ff8a5 Updated search result spacing 2022-07-05 15:38:06 +02:00
Sanne de Vries
e7c9013ffd Added tag items to search results 2022-07-05 15:33:04 +02:00
Djordje Vlaisavljevic
e72cf1a267 Added font antialiasing 2022-07-05 15:18:35 +02:00
Djordje Vlaisavljevic
5f08da04b0 Switched gray to neutral 2022-07-05 15:18:09 +02:00
Djordje Vlaisavljevic
86822e7e6d Added placeholder author results 2022-07-05 15:12:17 +02:00
Rishabh
21b621c4fa Deleted main.css from git 2022-07-05 15:11:51 +02:00
Sanne de Vries
aace61e6f3 Created search box component 2022-07-05 14:44:12 +02:00
Rishabh
093fd604ed Updated search components 2022-07-05 14:39:33 +02:00
Rishabh
0a347e112f Added basic search 2022-07-05 14:39:33 +02:00
Peter Zimon
e5049229c5 Added main.css to gitignore 2022-07-05 14:31:34 +02:00
Djordje Vlaisavljevic
c50a5a14f2 Added placeholder posts 2022-07-05 14:13:01 +02:00
Sanne de Vries
f61dbad9aa Updated search bar design 2022-07-05 13:49:10 +02:00
Peter Zimon
db8aa33dfb Cleaned up Portal styles 2022-07-05 12:26:41 +02:00
Sanne de Vries
4c6cf330c4 Added search input field 2022-07-05 12:22:13 +02:00
Rishabh
905f4ba964 Fixed App test 2022-07-05 12:21:29 +02:00
Naz
ca4a3dc8d0 Added test coverage for search index
refs https://github.com/TryGhost/Team/issues/1665

- Added a test case for NOT matching text when searching in the search index
2022-07-05 12:13:14 +02:00
Sanne de Vries
2c4c1cac5c Added clear icon to search bar 2022-07-05 12:11:05 +02:00
Rishabh
3be7c57bd6 Added tailwind CSS setup
refs https://github.com/TryGhost/Team/issues/1665

- adds tailwind css to dev and build modes
- updates dev mode to watch changes for tailwind
- updates build mode to write tailwind css file in public folder
2022-07-05 11:48:03 +02:00
Naz
d9e9d451c9 Refactored search-index module to use class syntax
refs https://github.com/TryGhost/Team/issues/1665

- The class syntax allows to use constructor DI pattern that helps with unit testing and abstracting away the dependencies
- It wasn't possible to test the internals without having access to the localStorage in tests (you couls access it but that's kind of leaky for tests to know what mechanism is used in the module intenally)
2022-07-05 11:39:11 +02:00
Naz
ce4206e91f Added basic test coverage for the search index module
refs https://github.com/TryGhost/Team/issues/1665

- As with all the code we should be aiming for 100% test coverage :) This is a groundwork for testing code that uses HTTP requests
- nock was used as it's a library we use in the rest of the projects already
2022-07-05 11:38:54 +02:00
Naz
f6838e2113 Added search index functionality
refs https://github.com/TryGhost/Team/issues/1665
refs 402e54987e/packages/ease/assets/js/main.js (L16-L127)

- This is a React adaptation of the referenced sodo-search functionality
- The module exposes two methods: init and search. Init requires an API URL parameter and an API key; search requires a text value and returns matching search results
2022-07-05 11:38:51 +02:00
Naz
55e3bf3885 Renamed App test
no issue

- Just a minor cleanup
2022-07-05 11:38:24 +02:00
Naz
686e53bc88 Refactored App into a class component
refs https://github.com/TryGhost/Team/issues/1665

- We need to hook into react element lifecycle events to initialize the search incdex (powered by elasticlunr).
2022-07-05 11:38:21 +02:00
Naz
fa26b56c17 Removed dead code
no issue
2022-07-05 11:36:52 +02:00
Naz
caffa12db6 Renamed root element name to match sodo-search-*
refs https://github.com/TryGhost/Team/issues/1665

- All search-related names were decided to have `sodo-search` prefix
2022-07-05 11:36:52 +02:00
Naz
ec3d0b27cd Fixed search script element detection
refs https://github.com/TryGhost/Team/issues/1665
refs b996eadbd4

- The search script injected by Ghost will be identified by `data-sodo-search` data attribute.
2022-07-05 11:36:52 +02:00
Sanne de Vries
4a65cc6833 Added search icon to search bar 2022-07-05 11:35:41 +02:00
Djordje Vlaisavljevic
791971c6fd Removed a bunch of leftover icons from portal 2022-07-05 10:59:24 +02:00
Djordje Vlaisavljevic
7787d8f2c4 Added icons 2022-07-05 10:59:14 +02:00
Sanne de Vries
bca286632f Created standalone search component 2022-07-05 10:49:11 +02:00
Rishabh
27e5cde85a Added basic modal for search
refs https://github.com/TryGhost/Team/issues/1665

- Adds basic UI components to add first version of search modal
2022-07-05 10:23:55 +02:00
Naz
c55a641fa6 Fixed search script element detection
refs https://github.com/TryGhost/Team/issues/1665

- The `data-ghost` attribute is used to detect portal script element. The search script will be identified by `data-ghost-search` data attribute (and probably so should the portal script in the futute)
2022-07-04 15:59:08 +02:00
Rishabh
76bc1a8c07 Fixed tests 2022-07-04 15:57:19 +02:00
Rishabh
ac43c86c2e Fixed tests 2022-07-04 15:55:30 +02:00
Rishabh
506cf49beb Updated yarn test default script 2022-07-04 15:55:24 +02:00
Rishabh
7cd9a81c5a Updated default dev port to avoid conflict
refs https://github.com/TryGhost/Team/issues/1665

- updates default dev mode port to 2370 to avoid conflict with other local scripts
2022-07-04 15:44:29 +02:00
Rishabh
e2294ace22 Added custom build for minified script
refs TryGhost/Team#1665

- overrides webpack config to generate single script for publishing
- adds custom scripts for dev and production mode
2022-07-04 15:41:14 +02:00
Rishabh
67f27f1027 Initial commit 2022-07-04 15:36:49 +02:00
Rishabh
737ae2f101 Initialize project using Create React App 2022-07-04 15:27:40 +02:00