-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add select token modal #4358
Add select token modal #4358
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Warning Rate limit exceeded@MohammadPCh has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 30 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe update covers various refinements and features across multiple files. It introduces adjustments to type interfaces, improvements in UI components, and enhancements in modal functionality. A significant portion involves increased customization options for modal components and improved token handling in the donation context. Additionally, new utility functions and hooks have been added to better manage cryptocurrency formatting and Solana balance fetching. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Modal
participant TokenModal
participant AmountInput
participant DonateContext
participant SolanaBalance
User->>+Modal: Interact with Modal
Modal-->>-User: Render Modal with footer
User->>+TokenModal: Open SelectTokenModal
TokenModal-->>-User: Display TokenInfo
User->>+AmountInput: Enter amount
AmountInput-->>-User: Validate and display amount
User->>+DonateContext: Select Token
DonateContext-->>-User: Token Selected
DonateContext->>+SolanaBalance: Fetch Balance
SolanaBalance-->>-DonateContext: Return Balance
DonateContext-->>-User: Display Balance
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration 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: 6
Outside diff range and nitpick comments (22)
src/hooks/useSolanaBalance.ts (1)
14-19
: Improve error logging for missing address.Consider adding more context to the error message for missing address.
- console.error('No address provided'); + console.error('No address provided for fetching Solana balance');src/components/views/donate/OnTime/SelectTokenModal/TokenInfo.tsx (6)
1-18
: Ensure consistent import style and remove unused imports.
- The imports look consistent, but ensure all imported modules are used.
- The
IWrapper
interface is declared but not used in this section.Consider removing unused imports or interfaces to keep the code clean.
20-26
: Use meaningful variable names.The variable
visible
could be renamed to something more descriptive, such asisVisible
, to improve readability.- const [visible, setVisible] = useState(false); + const [isVisible, setIsVisible] = useState(false);
27-32
: Ensure proper naming conventions for functions.The function
onVisible
could be renamed tohandleVisibilityChange
to better reflect its purpose.- const onVisible = () => { + const handleVisibilityChange = () => {
43-46
: Optimize conditional checks.The condition in
address: !isEvm && visible ? address || undefined : undefined
can be simplified.- address: !isEvm && visible ? address || undefined : undefined, + address: !isEvm && visible ? address : undefined,
48-48
: Use optional chaining for balance.The
balance
variable assignment could use optional chaining for better readability.- const balance = isEvm ? evmBalance?.value : solanaBalance; + const balance = isEvm ? evmBalance?.value : solanaBalance?.value;
95-122
: Ensure consistent naming for styled components.The styled components are well-defined but ensure naming consistency across the project.
No changes needed, just a reminder to maintain consistency.
src/components/views/userProfile/donationsTab/recurringTab/StreamRow.tsx (4)
Line range hint
1-15
: Ensure consistent import style and remove unused imports.
- The imports look consistent, but ensure all imported modules are used.
- The
ModifySuperTokenModal
import is new and should be checked for usage.Consider removing unused imports or interfaces to keep the code clean.
Line range hint
16-19
: Ensure proper type annotations for props.The
tokenStream
prop should have a more descriptive name, such assuperfluidStreams
, to improve readability.- interface IStreamRowProps { - tokenStream: ISuperfluidStream[]; - } + interface IStreamRowProps { + superfluidStreams: ISuperfluidStream[]; + }
Line range hint
21-22
: Use meaningful variable names.The variable
showModifyModal
could be renamed toisModifyModalVisible
to improve readability.- const [showModifyModal, setShowModifyModal] = useState(false); + const [isModifyModalVisible, setIsModifyModalVisible] = useState(false);
Line range hint
55-55
: Ensure consistent naming for styled components.The styled components are well-defined but ensure naming consistency across the project.
No changes needed, just a reminder to maintain consistency.
src/components/views/donate/DonationCard.tsx (2)
8-9
: Ensure consistent import style and remove unused imports.
- The imports look consistent, but ensure all imported modules are used.
- The
RecurringDonationCard
andOneTimeDonationCard
imports are new and should be checked for usage.Consider removing unused imports or interfaces to keep the code clean.
Line range hint
22-23
: Use meaningful variable names.The variable
tab
could be renamed toselectedTab
to improve readability.- const [tab, setTab] = useState( + const [selectedTab, setSelectedTab] = useState(src/components/views/donate/Recurring/SelectTokenModal/StreamInfo.tsx (4)
Line range hint
1-10
: Ensure consistent import style and remove unused imports.
- The imports look consistent, but ensure all imported modules are used.
- The
TokenIconWithGIVBack
import is new and should be checked for usage.Consider removing unused imports or interfaces to keep the code clean.
Line range hint
12-15
: Ensure proper type annotations for props.The
stream
prop should have a more descriptive name, such assuperfluidStreams
, to improve readability.- interface IStreamInfoProps { - stream: ISuperfluidStream[]; - balance: bigint; - disable: boolean; - onClick: () => void; - isSuperToken: boolean; - } + interface IStreamInfoProps { + superfluidStreams: ISuperfluidStream[]; + balance: bigint; + disable: boolean; + onClick: () => void; + isSuperToken: boolean; + }
Line range hint
17-18
: Use meaningful variable names.The variable
disable
could be renamed toisDisabled
to improve readability.- disable, + isDisabled,
Line range hint
51-51
: Ensure consistent naming for styled components.The styled components are well-defined but ensure naming consistency across the project.
No changes needed, just a reminder to maintain consistency.
src/components/views/donate/OnTime/EstimatedMatchingToast.tsx (4)
Line range hint
14-30
: Ensure consistent import style and remove unused imports.
- The imports look consistent, but ensure all imported modules are used.
- The
IProjectAcceptedToken
import is new and should be checked for usage.Consider removing unused imports or interfaces to keep the code clean.
37-37
: Use meaningful variable names.The variable
amount
could be renamed todonationAmount
to improve readability.- amount, + donationAmount,
57-59
: Use meaningful variable names.The variable
amountInUsd
could be renamed todonationAmountInUsd
to improve readability.- const amountInUsd = + const donationAmountInUsd =
Line range hint
66-66
: Ensure consistent naming for styled components.The styled components are well-defined but ensure naming consistency across the project.
No changes needed, just a reminder to maintain consistency.
src/components/views/donate/OnTime/DonateModal.tsx (1)
Line range hint
109-122
: Refactor Balance Fetching LogicThe balance fetching logic for EVM and Solana tokens is duplicated. Consider refactoring this logic into a reusable hook or function to improve maintainability.
const { data: balance, refetch, isRefetching } = useTokenBalance({ token: selectedOneTimeToken, address, walletChainType, });
...nts/views/userProfile/donationsTab/recurringTab/ModifyStreamModal/ModifyStreamInnerModal.tsx
Show resolved
Hide resolved
src/components/views/donate/Recurring/RecurringDonationModal/RecurringDonationModal.tsx
Show resolved
Hide resolved
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.
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.
Thanks @MohammadPCh
Summary by CodeRabbit
New Features
Enhancements
Modal
component to support a customizable footer section.AmountInput
to handle parsing and invalid input more effectively.Bug Fixes
AmountInput
to prevent changing0.000
to0
.Chores
QF_MATCHING_CAP_PERCENTAGE
constant.WhyContent
component by removing unnecessary props.New Hooks
useSolanaBalance
hook to fetch Solana balances for native SOL or specified SPL tokens.Refactor