Skip to content
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

Donate page new design #4745

Closed
wants to merge 1 commit into from
Closed

Donate page new design #4745

wants to merge 1 commit into from

Conversation

RamRamez
Copy link
Collaborator

@RamRamez RamRamez commented Sep 17, 2024

#4731

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced user interface messages related to donations and network eligibility.
    • Added guidance for users to check their network connection before proceeding with donations.
    • Introduced support for QR donations specifically for Stellar addresses.
    • Integrated the Safe wallet for improved security in wallet connections.
  • Bug Fixes

    • Corrected instructions regarding donations with Stellar to clarify wallet connectivity requirements.
  • Style

    • Improved responsiveness and layout adaptability across different screen sizes.
  • Chores

    • Updated dependencies to enhance application functionality and performance.

Copy link

vercel bot commented Sep 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
giveth-dapps-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 7:52am

Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Walkthrough

The changes encompass updates to localization files (lang/ca.json, lang/en.json, lang/es.json) to improve user interface messages and donation instructions. Modifications in several TypeScript components enhance the handling of donations, particularly with QR codes and wallet connections. Additionally, the package.json file reflects updates to dependency versions, and a new wallet connector is introduced in the wagmiConfigs.ts file.

Changes

File(s) Change Summary
lang/ca.json, lang/en.json, lang/es.json Added and modified labels to clarify donation instructions, eligibility, and network checks across all three language files.
src/components/views/donate/DonateIndex.tsx, src/components/views/donate/DonateToGiveth.tsx, src/components/views/donate/DonationCard.tsx, src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx, src/components/views/donate/OnTime/OneTimeDonationCard.tsx, src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx, src/components/views/donate/Recurring/RecurringDonationCard.tsx Introduced new state variables and modified component logic to manage donation types, wallet connections, and conditional rendering based on donation methods.
package.json Updated dependency versions for @web3modal/wagmi and wagmi.
src/wagmiConfigs.ts Added a new wallet connector for Safe, enhancing wallet connection options.

Possibly related PRs

🐇 In the meadow where bunnies play,
New words sprout bright, guiding the way!
Donations flow with a hop and a cheer,
Wallets connect, spreading joy far and near.
With every change, our hearts take flight,
A world of giving, oh what a delight! 🌼


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9020bb9 and c8078ba.

Files ignored due to path filters (3)
  • public/images/banners/qf-round/giv-palooza.svg is excluded by !**/*.svg
  • public/images/logo/stellar.svg is excluded by !**/*.svg
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (13)
  • lang/ca.json (5 hunks)
  • lang/en.json (4 hunks)
  • lang/es.json (3 hunks)
  • package.json (2 hunks)
  • src/components/views/donate/DonateIndex.tsx (4 hunks)
  • src/components/views/donate/DonateToGiveth.tsx (4 hunks)
  • src/components/views/donate/DonationCard.tsx (6 hunks)
  • src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx (4 hunks)
  • src/components/views/donate/OnTime/OneTimeDonationCard.tsx (7 hunks)
  • src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx (4 hunks)
  • src/components/views/donate/Recurring/RecurringDonationCard.tsx (4 hunks)
  • src/components/views/project/ProjectGIVbackToast.tsx (2 hunks)
  • src/wagmiConfigs.ts (2 hunks)
Additional context used
Biome
src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx

[error] 147-147: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

Additional comments not posted (49)
src/wagmiConfigs.ts (2)

2-2: LGTM!

The import statement for the safe connector is syntactically correct and aligns with the goal of supporting the Safe wallet, as mentioned in the AI-generated summary.


31-33: Great addition for enhanced security!

The inclusion of the safe connector in the wagmiConfig configuration expands the application's capabilities to support the Safe wallet. The allowedDomains property, configured with a regular expression to restrict the connector's usage to the Safe application domain, is a commendable security measure. This ensures that the safe connector can only be used within the specified domain, enhancing the overall security of the application.

package.json (2)

38-38: LGTM!

The version upgrade of @web3modal/wagmi is unlikely to cause any issues. It may include bug fixes, performance improvements, or new features.


75-75: LGTM!

The version upgrade of wagmi is unlikely to cause any issues. It may include bug fixes, performance improvements, or new features.

src/components/views/donate/DonateToGiveth.tsx (4)

18-19: LGTM!

The imports are correctly named and the file paths are valid. The useGeneralWallet and useDonateData hooks are used to access the wallet connection state and selected donation token, which is necessary for the functionality introduced in this component.


38-40: LGTM!

The destructured variables selectedOneTimeToken and isConnected are used to determine the disabled state of the Container component. The variable names are descriptive and the destructuring is done correctly.


54-57: LGTM!

The code logic ensures that if the givethDonationAmount is zero, the donationToGiveth is also set to zero. This maintains the integrity of the donation process by disabling percentage amount for minimal allowed main donation amount. The code logic is correct and the comments provide clear explanation.


60-60: LGTM!

The disabled prop is set based on the wallet connection state and selected one-time token. The opacity of the Container is adjusted based on the disabled state, providing visual feedback to the user. The code logic is correct and the styling is implemented correctly.

Also applies to: 148-148

src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx (5)

9-9: LGTM!

The FC type import from react is necessary for the changes made to the DonateQFEligibleNetworks component.


12-12: LGTM!

The useRouter hook import from next/router is necessary for accessing the router's query parameters to determine if the current donation is a QR donation.


20-26: LGTM!

The addition of the goBack prop to the DonateQFEligibleNetworks component enhances its functionality by allowing for a callback function to be passed in for navigation purposes. The changes to the component's type and destructuring of the goBack prop are implemented correctly.


31-32: LGTM!

The changes to the component's logic to determine if the current donation is a QR donation based on the router's query parameters are implemented correctly. This allows for conditional rendering of different content based on the donation type.


Line range hint 48-143: LGTM!

The changes to the component's rendering logic enhance its functionality by providing conditional rendering based on the donation type. The implementation of the goBackToNetworkSelection function, the message for QR donations, and the conditional rendering of the modal for switching networks are all handled correctly. The styling update to StyledCaption also improves the visual consistency of the component.

src/components/views/donate/DonationCard.tsx (7)

1-15: LGTM!

The imports are well-organized, follow a consistent structure, and include relevant dependencies for the component's functionality.


77-79: LGTM!

The check for the presence of a Stellar address is implemented correctly using the some method. The variable name hasStellarAddress clearly conveys the purpose of the check.


81-93: LGTM!

The handleQRDonation function is implemented correctly. It sets the appropriate state and updates the router's query parameters to handle the QR donation flow.


135-147: LGTM!

The conditional rendering of the QRToastLink component based on the presence of a Stellar address is implemented correctly. The link provides a clear call-to-action for users to initiate a QR donation using Stellar. The handleQRDonation function is properly attached to the onClick event.


240-255: LGTM!

The QRToastLink styled component is well-defined using the styled function from styled-components. The CSS styles are applied directly to the component, ensuring a consistent appearance. The styles are well-organized and follow a logical structure.


269-269: LGTM!

The color of the Title component is set correctly using the neutralColors.gray[800] value, which likely represents a dark gray color. The !important declaration ensures that the color style takes precedence. The text alignment is properly set to left.


287-287: LGTM!

The Tab component's font weight is correctly set to 500 when it is selected, using the !important declaration to ensure it takes precedence. The conditional CSS block based on the $selected prop applies additional styles to visually differentiate the selected tab, such as changing the color and border bottom color.

src/components/views/project/ProjectGIVbackToast.tsx (2)

330-330: LGTM!

The change to set the button's width to 100% is a good improvement for responsiveness. It allows the button to adapt to the width of its parent container, which is beneficial for varying screen sizes.


357-357: Looks good!

Changing the media query to target laptopL screens instead of tablet screens is a reasonable adjustment. It indicates that the layout will switch from a column to a row orientation at a larger screen size, which can potentially improve the user experience on larger devices.

src/components/views/donate/DonateIndex.tsx (4)

83-84: LGTM!

The code correctly derives the isQRDonation constant by checking if the chain query parameter matches the Stellar chain type. The logic and syntax are accurate.


Line range hint 233-242: LGTM!

The conditional rendering of the AlreadyDonatedWrapper component based on alreadyDonated and isQRDonation is implemented correctly. It ensures that the component is not shown for QR-based donations. The logic and syntax are accurate.


243-246: LGTM!

The conditional rendering of the PassportBanner component based on multiple conditions, including isQRDonation, is implemented correctly. It ensures that the component is not shown for QR-based donations or when other specific criteria are not met. The logic and syntax are accurate.


Line range hint 272-280: LGTM!

The updated rendering logic for the QFSection component based on isQRDonation, the active tab, and network eligibility is implemented correctly. It ensures that the component is not shown for QR-based donations and is displayed based on the specified conditions. The logic and syntax are accurate.

src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx (5)

42-42: LGTM!

The import statement for DonateQFEligibleNetworks looks good.


66-66: LGTM!

The logic to determine isQRDonation based on the router query looks correct.


74-74: LGTM!

The addition of the hasActiveQFRound property to the useDonateData hook looks good.


142-177: LGTM!

The modifications to the goBack function to update the router query parameters look good. The logic correctly handles different scenarios and ensures that the application maintains the correct state during navigation.

The static analysis hint about avoiding the spread syntax on accumulators is not applicable here, as the spread syntax is used to create a new object and not on an accumulator.

Tools
Biome

[error] 147-147: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)


339-341: LGTM!

The conditional rendering of the DonateQFEligibleNetworks component based on the presence of an active QF round and the donation being a QR donation looks good. It enhances the user experience by providing relevant information based on the current donation context.

src/components/views/donate/OnTime/OneTimeDonationCard.tsx (3)

395-401: Improved user experience with the ConnectWallet component.

The addition of the ConnectWallet component provides clear guidance to users to connect their wallets before proceeding with donations. This improves the user experience by simplifying the donation flow and focusing on wallet connectivity.


Line range hint 403-447: Enhanced user interface with the FlexStyled component.

Extending the Flex component to FlexStyled and incorporating a disabled state based on the wallet connection state enhances the user interface. It visually indicates when certain actions, such as selecting tokens or interacting with donation options, are unavailable due to the wallet not being connected. This prevents confusion and improves the overall user experience.


584-587: Improved logic for the DonateAnonymously option.

Updating the DonateAnonymously component to disable the option when the wallet is not connected or a token is not selected ensures that users can only interact with this feature when appropriate. This prevents potential errors or inconsistencies and enhances the user experience.

src/components/views/donate/Recurring/RecurringDonationCard.tsx (3)

58-58: LGTM!

The import statement for useGeneralWallet hook is correctly added.


119-119: LGTM!

The isConnected state is correctly destructured from the useGeneralWallet hook.


284-284: LGTM!

The changes to the SelectTokenWrapper styled component and its conditional disabling based on the isConnected state are implemented correctly. This improves the user experience by preventing interactions when the wallet is not connected.

Also applies to: 816-817

lang/en.json (3)

182-182: LGTM!

The new label provides clear information to users about Stellar's ineligibility for the current round. The JSON syntax is correct.


341-341: Looks good!

The new label provides helpful guidance to users, prompting them to verify they are connected to the correct network. The JSON syntax is valid.


1245-1245: Nice update!

The label text has been improved to provide clearer instructions about donating with Stellar, specifying that wallet connection is not required. The typo in the label key has also been fixed.

lang/es.json (3)

341-341: LGTM!

The new label provides a clear message in Spanish to guide users to verify their network connection. The label key is descriptive and follows the naming convention.


342-342: Looks good!

The new label provides a clear message in Spanish to inform users that Stellar is not eligible for the specific matching round. The label key is descriptive and follows the naming convention.


1240-1240: Nice catch!

The label key typo is fixed and the message is updated with additional helpful information to clarify that connecting a wallet is not needed when donating with Stellar. The change improves clarity for users.

lang/ca.json (6)

280-280: New label looks good!

The added label provides a helpful instruction for users to double-check they are connected to the correct network. This can prevent errors and improve the user experience.


281-281: New label provides important eligibility information.

The added label helpfully informs users that Stellar is not eligible for matching in the current round. This sets the right expectations and avoids confusion.


1241-1241: Good catch on the typo fix.

The label text has been corrected, fixing the typo in "with". The updated label provides clear instructions that users can donate with Stellar without needing to connect their wallet.


1307-1307: Label text reformatting looks good.

The label text informing project owners they can't donate to their own project has been reformatted, likely for consistency with other labels. The reformatting does not alter the label's meaning.


1632-1632: Label text clarification is an improvement.

The updated label text now clearly specifies that Ethereum donations to GIVbacks eligible projects earn GIV rewards. The added encouragement to boost the project to increase rewards and visibility is also helpful. Overall the changes make the label clearer and more informative.


1705-1705: Review complete, no issues found.

The review of all the changed code segments in this file is now complete. The JSON syntax looks good and no problems were found with any of the changes.


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?

Share
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 @coderabbitai in 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 @coderabbitai in 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 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 pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant