-
Notifications
You must be signed in to change notification settings - Fork 411
OK-38195, OK-38191, OK-38159: Add dApp results to universal search #7372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rch capabilities with new result type and rendering logic
…or enhanced website handling
…nd improving Google search item logic
…versalSearch for improved code clarity
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
WalkthroughThis update adds Dapp search support to the universal search feature. It introduces types, logic, and UI for Dapp search results. The update also centralizes some constants, adds a shortcut key for universal search, and ensures search results have bottom padding. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UniversalSearchPage
participant ServiceUniversalSearch
participant ServiceDiscovery
User->>UniversalSearchPage: Enter search query
UniversalSearchPage->>ServiceUniversalSearch: universalSearch({ types: [Dapp, ...], input })
ServiceUniversalSearch->>ServiceDiscovery: searchDapp(input)
ServiceDiscovery-->>ServiceUniversalSearch: Dapp results
ServiceUniversalSearch-->>UniversalSearchPage: Aggregated search results (including Dapp)
UniversalSearchPage->>User: Display Dapp search results in section
Assessment against linked issues
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (6)
packages/kit-bg/src/services/ServiceUniversalSearch.ts
(5 hunks)packages/kit/src/views/Discovery/hooks/useSearchModalData.ts
(1 hunks)packages/kit/src/views/Shortcuts/pages/ShortcutsPreview.tsx
(1 hunks)packages/kit/src/views/UniversalSearch/pages/UniversalSearch.tsx
(18 hunks)packages/shared/src/consts/discovery.ts
(1 hunks)packages/shared/types/search.ts
(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/kit-bg/src/services/ServiceUniversalSearch.ts (3)
packages/shared/types/search.ts (1)
IUniversalSearchDappResult
(57-59)packages/kit-bg/src/apis/BackgroundApi.ts (1)
serviceDiscovery
(281-289)packages/shared/src/consts/discovery.ts (2)
SEARCH_ITEM_ID
(1-1)GOOGLE_LOGO_URL
(2-3)
packages/shared/types/search.ts (1)
packages/shared/types/discovery.ts (1)
IDApp
(51-68)
🔇 Additional comments (10)
packages/kit/src/views/Shortcuts/pages/ShortcutsPreview.tsx (1)
19-22
: LGTM: Global search shortcut added correctlyThe global search shortcut entry fits well with existing shortcuts pattern. Good placement in the global_general section.
packages/kit/src/views/Discovery/hooks/useSearchModalData.ts (1)
7-10
: Good refactoring: Constants now centralizedMoving these constants to a shared location improves code maintainability. Constants are now imported instead of being defined locally.
packages/shared/src/consts/discovery.ts (1)
1-7
: Well-structured constants fileClean organization of discovery-related constants and utility function. The Google search item identification function adds clarity to code that checks for this special case.
packages/shared/types/search.ts (6)
3-3
: Proper type importCorrect import of the IDApp type needed for the new Dapp search functionality.
11-11
: Good enum extensionClean addition of Dapp to the universal search types enum.
38-41
: Well-defined type structureThe IUniversalSearchDapp type properly follows the established pattern of other search types.
46-47
: Correct union type integrationProperly extended the union type to include the new Dapp search type.
57-59
: Consistent result type definitionThe IUniversalSearchDappResult type matches the pattern used by other search result types.
65-65
: Complete batch result extensionCorrectly added Dapp results to the batch result interface.
packages/kit/src/views/UniversalSearch/pages/UniversalSearch.tsx (1)
31-32
:✅ Verification successful
Double-check
isGoogleSearchItem
exportThe helper is imported from
@onekeyhq/shared/src/consts/discovery
, but the shared snippet only shows constants.
If the function isn’t actually exported, the build will fail.
🏁 Script executed:
#!/bin/bash # Confirm the symbol exists in the expected module rg --json "export .*isGoogleSearchItem" | jq -r '.data.path'Length of output: 233
All good:
isGoogleSearchItem
is exported
I found three export statements forisGoogleSearchItem
in packages/shared/src/consts/discovery.ts. Your import is valid—no changes needed.
…7372) * fix: Add footer components for UniversalSearchList * feat: Enhance UniversalSearch with section footer and data slicing functionality * feat: Add UniversalSearch shortcut to ShortcutsPreview for improved accessibility * feat: Add Dapp search functionality to UniversalSearch, enhancing search capabilities with new result type and rendering logic * feat: Integrate DiscoveryBrowserProviderMirror into UniversalSearch for enhanced website handling * feat: Refactor search modal data handling by centralizing constants and improving Google search item logic * refactor: Remove console logs and clean up renderSectionFooter in UniversalSearch for improved code clarity
…7372) * fix: Add footer components for UniversalSearchList * feat: Enhance UniversalSearch with section footer and data slicing functionality * feat: Add UniversalSearch shortcut to ShortcutsPreview for improved accessibility * feat: Add Dapp search functionality to UniversalSearch, enhancing search capabilities with new result type and rendering logic * feat: Integrate DiscoveryBrowserProviderMirror into UniversalSearch for enhanced website handling * feat: Refactor search modal data handling by centralizing constants and improving Google search item logic * refactor: Remove console logs and clean up renderSectionFooter in UniversalSearch for improved code clarity
…7372) * fix: Add footer components for UniversalSearchList * feat: Enhance UniversalSearch with section footer and data slicing functionality * feat: Add UniversalSearch shortcut to ShortcutsPreview for improved accessibility * feat: Add Dapp search functionality to UniversalSearch, enhancing search capabilities with new result type and rendering logic * feat: Integrate DiscoveryBrowserProviderMirror into UniversalSearch for enhanced website handling * feat: Refactor search modal data handling by centralizing constants and improving Google search item logic * refactor: Remove console logs and clean up renderSectionFooter in UniversalSearch for improved code clarity
* fix: Add footer components for UniversalSearchList * feat: Enhance UniversalSearch with section footer and data slicing functionality * feat: Add Dapp search functionality to UniversalSearch, enhancing search capabilities with new result type and rendering logic * feat: Integrate DiscoveryBrowserProviderMirror into UniversalSearch for enhanced website handling * feat: Refactor search modal data handling by centralizing constants and improving Google search item logic * refactor: Remove console logs and clean up renderSectionFooter in UniversalSearch for improved code clarity * feat: Add "Show More" functionality to section footer in UniversalSearch for improved user interaction * OK-38195, OK-38191, OK-38159: Add dApp results to universal search (#7372) * fix: Add footer components for UniversalSearchList * feat: Enhance UniversalSearch with section footer and data slicing functionality * feat: Add UniversalSearch shortcut to ShortcutsPreview for improved accessibility * feat: Add Dapp search functionality to UniversalSearch, enhancing search capabilities with new result type and rendering logic * feat: Integrate DiscoveryBrowserProviderMirror into UniversalSearch for enhanced website handling * feat: Refactor search modal data handling by centralizing constants and improving Google search item logic * refactor: Remove console logs and clean up renderSectionFooter in UniversalSearch for improved code clarity * fix: Add footer components for UniversalSearchList * feat: Enhance UniversalSearch with section footer and data slicing functionality * feat: Add Dapp search functionality to UniversalSearch, enhancing search capabilities with new result type and rendering logic * feat: Refactor search modal data handling by centralizing constants and improving Google search item logic * feat: Enhance UniversalSearch with account avatar rendering and improved address validation logic * feat: switch to select account * feat: Add accountsValue * feat: Introduce UniversalSearchDappItem component for improved Dapp rendering in UniversalSearch * feat: Refactor UniversalSearchDappItem to use getSearchInput and streamline website handling logic * feat: Add UniversalSearchAccountAssetItem component for rendering account asset details in UniversalSearch * feat: Add UniversalSearchMarketTokenItem component for rendering market token details in UniversalSearch * feat: Add UniversalSearchAddressItem component for rendering address details in UniversalSearch * feat: Refactor UniversalSearchAddressItem to improve account value rendering and address shortening logic
Summary by CodeRabbit
New Features
Improvements