feat(assets-table): enhance search functionality and UI
What is the purpose of the change
In the Assets Page, user should see the top five relevant tokens on focus of the search input.
ClickUp Task
Brief Changelog
When the user actually inputs text into the search, the defaults should disappear and be replaced by normal search items using existing logic.
- [x] Set special computed state derived from the input focus/blur state and the search query.
- [x] Add key shortcuts to get and exit search.
Testing and Verifying
Once the search input in the asset page is focused the user should see only the top 5 tokens:
OSMO ATOM USDC DYM TIA
User should not see the load more button.
Summary by CodeRabbit
- New Features
- Enhanced the
AssetsTableV1component to display only favorite assets when the search box is focused and contains no query. - Added keyboard interaction improvements for focusing and blurring the search box in the
AssetsTableV1component.
- Enhanced the
Walkthrough
The recent updates aim to refine the asset management interface, focusing on interactivity and visual consistency. Enhancements include new hooks and improved state management for the search box, with a spotlight on efficiently displaying the top 5 assets. Width adjustments in asset-related table cells ensure a cleaner, more uniform layout across components.
Changes
| File Path | Changes Summary |
|---|---|
.../table/assets-table-v1.tsx |
Added new imports, introduced search hooks, updated top asset display logic. |
.../cells/asset-name.tsx.../cells/balance.tsx |
Adjusted width using w-48 class for consistent layout appearance. |
.../hooks/use-web-search-box-input-state.tsx |
Created useWebSearchBoxInputState hook for managing search box input state. |
Poem
🐰✨
In the realm of code, where changes bloom,
A rabbit danced, dispelling gloom.
With tweaks so fine, and widths in line,
Top assets now in a spotlight shine.
Cheers to clean design, a sight so supreme,
Thanks to these updates, a developer's dream!
🌟🐇
Recent Review Details
Configuration used: CodeRabbit UI
Commits
Files that changed from the base of the PR and between 58bb5db1678882b521598a61fbf11a5eda1b2e4b and 8e9e5ad1e4b2b6d15bec886d953937ba1afa9941.Files selected for processing (1)
- packages/web/components/table/assets-table-v1.tsx (13 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/web/components/table/assets-table-v1.tsx
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai generate interesting stats about this repository and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
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 as PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@Amosel I believe if you merge in stage the build should be fixed
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| osmosis-frontend | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 10, 2024 7:32pm |
| osmosis-frontend-dev | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 10, 2024 7:32pm |
| osmosis-testnet | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 10, 2024 7:32pm |
FYI this page is being rebuilt and will be replaced by assets-page-v2 in the near future.
Perhaps we could also port this functionality to the v2 side as well?
Deploying osmosis-frontend-new with
Cloudflare Pages
| Latest commit: |
94ea253
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4e6c7944.osmosis-frontend-new.pages.dev |
| Branch Preview URL: | https://amos-five-tokens-search.osmosis-frontend-new.pages.dev |
~~@Amosel approved. Let's get QA to take a quick look cc @kamal-sutra @CryptoAssassin1~~
@Amosel actually, I think this still needs some work. The interaction is weird. On focus, the whole page shifts.
@MaxMillington e2fa5c0 this fixes search input shifting the layout of the table header.
If the search state is disabled, and no new cells are populating the table, the table will not shift.
e.g shouldShowTop5 = false on line 391, the table's columns layout will not shift.
The tables columns layout still shifts when different cell results populate it, like on various search results.
If the search state is disabled, and no new cells are populating the table, the table will not shift:
https://github.com/osmosis-labs/osmosis-frontend/assets/61532/e93bf225-8efe-4c52-b4fc-4d7bd1fa7d47
When search changes the results, the column layout will start shifting based on the result:
https://github.com/osmosis-labs/osmosis-frontend/assets/61532/79ce5bad-ca38-4e15-88ca-75401f978903
Closing this PR as it needs design support and building a typeahead/dropdown is not quick work, so it will be moved into a separate effort.