feat: 1ct review modal
What is the purpose of the change:
This PR introduces a new call to action (CTA) for the "1-click trading" feature within the Swap modal in the Osmosis frontend. The goal is to increase user engagement and conversion for this feature by adding a more visible and accessible CTA. Additionally, this PR includes functionality to track and display the length of a session, as required by the acceptance criteria in the provided Figma design.
Linear Task
- ?
Brief Changelog
-1-click trading CTA feature on Review Trade Modal. -Improve functionallity and performance in 1CT hook. -Feature of modifying 1ct session on Review Trade Modal.
Testing and Verifying
Tested locally
Use cases covered:
If the user does NOT have an active 1CT session:
- The 1CT call to action appears with a switcher. The entire 1CT panel is clickable to activate or deactivate 1CT.
- When activated, a session duration summary appears along with the option to "Change".
- If the user clicks "Change", the 1CT configuration modal opens, and upon returning, they can proceed to confirm the transaction.
- The ‘Confirm’ button first triggers the 1CT activation transaction.
If the user has an active 1CT session:
- The current value of the limit is displayed, considering the next operation, and shows the limits.
- Clicking limit value text navigates to 1CT settings screen in the same modal - back button from there returns to the review modal.
- If the value exceeds the limit, "Exceeded" is displayed along with an "Edit" button.
- Clicking "Edit" shows the 1CT settings options within the same modal.
- All functionality has been verified and behaves as expected.
@Kyatros is attempting to deploy a commit to the OsmoLabs Team on Vercel.
A member of the Team first needs to authorize it.
Walkthrough
This pull request introduces several new React components related to one-click trading functionality, including OneClickTradingRemainingAmount, OneClickTradingCallToAction, OneClickTradingInReviewModal, and OneClickTradingLimitRemaining. It also modifies existing components like OneClickTradingSettings and ProfileOneClickTradingSettings to enhance state management and user interaction. The useOneClickTradingParams and useOneClickTradingSession hooks are updated for improved data fetching and session management. Additionally, the ReviewOrder component is enhanced to integrate one-click trading settings and user feedback mechanisms.
Changes
| File Path | Change Summary |
|---|---|
packages/web/components/one-click-trading/one-click-remaining-amount.tsx |
New component OneClickTradingRemainingAmount added to display remaining spending limit or session expiration message. |
| `packages/web/components/one-click-trading/one-click-trading-call-to-action.tsx | New component OneClickTradingCallToAction added, enabling users to toggle one-click trading and log events. |
| `packages/web/components/one-click-trading/one-click-trading-in-review-modal.tsx | New component OneClickTradingInReviewModal added for managing transaction reviews, incorporating session management and error handling. |
| `packages/web/components/one-click-trading/one-click-trading-limit-remaining.tsx | New component OneClickTradingLimitRemaining added to show remaining limits and allow edits if exceeded. |
| `packages/web/components/one-click-trading/one-click-trading-settings.tsx | Updated OneClickTradingSettings to add optional prop resetTransaction1CTParams, modify onClose prop, and simplify state management. |
| `packages/web/components/one-click-trading/profile-one-click-trading-settings.tsx | Updated ProfileOneClickTradingSettings to refine boolean expressions and add resetTransaction1CTParams prop to OneClickTradingSettings. |
packages/web/hooks/one-click-trading/use-one-click-trading-params.ts |
Updated useOneClickTradingParams hook to replace useEffect with useQuery for data fetching and state management, adding scopeKey parameter. |
packages/web/hooks/one-click-trading/use-one-click-trading-session.ts |
Enhanced useOneClickTradingSession hook to include new queries for amount spent and session expiration logic, adding methods for calculating remaining limits. |
| `packages/web/modals/review-order.tsx | Modified ReviewOrder component to integrate one-click trading settings and manage transaction triggering, including new state variables and updated rendering logic. |
Possibly related PRs
- #3843: This PR includes updates related to one-click trading, specifically enabling Ledger signing for one-click trading, which is relevant to the session management and user feedback aspects of the main PR.
- #3861: Although primarily focused on removing old assets and dead code, this PR indirectly relates to the overall cleanup and restructuring of the codebase, which may impact components like
OneClickTradingRemainingAmountthat rely on a streamlined architecture.
Suggested reviewers
- MaxMillington
- DavideSegullo
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>, please review it.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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@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.@coderabbitai help me debug CodeRabbit configuration file.
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)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration 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.
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 | Oct 21, 2024 9:03pm |
@Kyatros translation is missing
On mobile 1click trading is not getting enabled even after signed tx
Going to review once changes are made from prior reviews
@Kyatros looks like we still have some bugs on this feature. Are you able to come up with a working solution?