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

Release 17 sep #4743

Merged
merged 22 commits into from
Sep 17, 2024
Merged

Release 17 sep #4743

merged 22 commits into from
Sep 17, 2024

Conversation

mohammadranjbarz
Copy link
Contributor

@mohammadranjbarz mohammadranjbarz commented Sep 17, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Added prompts for users to check their network connection and inform them of Stellar's ineligibility for the current round.
    • Introduced dynamic fetching of allocated GIV tokens to enhance the donation experience.
    • Added support for the Safe wallet, improving security for digital asset management.
  • Improvements

    • Enhanced clarity in donation and GIVbacks messaging across multiple languages.
    • Streamlined user interface by removing unused components and refining rendering logic based on donation methods.
  • Bug Fixes

    • Adjusted spacing and formatting for various labels to ensure consistent user communication.

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 2:06pm

Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Walkthrough

The pull request introduces updates across multiple JSON language files to enhance user communication regarding network eligibility and donation processes. New labels are added to inform users about checking their network connections and Stellar's eligibility for matching rounds. Additionally, several components are modified to improve functionality, including the introduction of a new GraphQL query for fetching allocated GIV tokens and adjustments to donation-related components for better user experience.

Changes

File Change Summary
lang/ca.json, lang/en.json, lang/es.json Added new labels for network checks and Stellar eligibility; modified existing labels for clarity and consistency.
package.json Updated dependency versions for @web3modal/wagmi and wagmi.
src/apollo/gql/gqlGivbacks.ts Introduced a new GraphQL query FETCH_ALLOCATED_GIVBACKS to retrieve data related to allocated GIV tokens.
src/components/GIVeconomyPages/GIVbacks.tsx Removed unused components and enhanced functionality to fetch and display allocated GIV tokens dynamically.
src/components/views/donate/DonateIndex.tsx Added logic to handle different donation types based on whether the donation is made via QR code.
src/components/views/donate/DonationCard.tsx Introduced a variable to check if a project is an Endaoment project, modifying tab activation logic accordingly.
src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx Added a prop for navigation and modified eligibility messages based on donation method.
src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx Enhanced logic for QR donations, including state management and conditional rendering of eligibility messages.
src/components/views/project/ProjectGIVbackToast.tsx Adjusted styling for responsiveness across different screen sizes.
src/content/metatags.ts Modified the description for GIVbacks to simplify the message regarding donor qualifications.
src/wagmiConfigs.ts Added a new wallet connector for Safe, enhancing wallet integration capabilities.

Possibly related PRs

Poem

🐰 In the meadow where GIV tokens play,
New labels hop in to brighten the way.
Check your network, don't miss the chance,
With Stellar's news, let's all dance!
Donations now clearer, a joyful delight,
Together we thrive, in the soft moonlight! 🌙


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.

@mohammadranjbarz mohammadranjbarz changed the base branch from develop to main September 17, 2024 05:00
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post

Actionable comments posted: 1

Outside diff range and nitpick comments (2)
src/components/views/donate/DonationCard.tsx (2)

56-56: LGTM! Remember to uncomment the useEffect hook when the feature is ready.

The isEndaomentProject variable is correctly checking the project's organization label. The variable name is clear and descriptive.

Please remember to uncomment the useEffect hook at lines 99-103 when the feature is ready to be enabled.


97-103: Acknowledge the temporary disabling of the feature.

The comment clearly indicates that this feature needs more refinement. Commenting out the useEffect hook effectively disables the automatic setting of the active tab based on the provided conditions.

Consider creating a GitHub issue to track the refinement of this feature. This will ensure that the feature is not forgotten and can be re-enabled once the necessary refinements are made. Do you want me to open a GitHub issue for this?

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

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

Files ignored due to path filters (2)
  • public/images/banners/qf-round/giv-palooza.svg is excluded by !**/*.svg
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (13)
  • lang/ca.json (4 hunks)
  • lang/en.json (7 hunks)
  • lang/es.json (2 hunks)
  • package.json (2 hunks)
  • src/apollo/gql/gqlGivbacks.ts (1 hunks)
  • src/components/GIVeconomyPages/GIVbacks.tsx (3 hunks)
  • src/components/views/donate/DonateIndex.tsx (4 hunks)
  • src/components/views/donate/DonationCard.tsx (2 hunks)
  • src/components/views/donate/OnTime/DonateQFEligibleNetworks.tsx (4 hunks)
  • src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx (4 hunks)
  • src/components/views/project/ProjectGIVbackToast.tsx (2 hunks)
  • src/content/metatags.ts (1 hunks)
  • src/wagmiConfigs.ts (2 hunks)
Files skipped from review due to trivial changes (2)
  • lang/ca.json
  • src/content/metatags.ts
Additional context used
Biome
src/components/GIVeconomyPages/GIVbacks.tsx

[error] 274-275: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

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 (36)
src/apollo/gql/gqlGivbacks.ts (1)

1-12: LGTM!

The GraphQL query FETCH_ALLOCATED_GIVBACKS is well-defined and follows the correct syntax. It fetches relevant fields related to allocated givbacks and provides an optional refreshCache parameter to control the caching behavior.

The query can be used to fetch and display the necessary data to the user, enhancing the user experience by providing accurate and up-to-date information about givbacks.

src/wagmiConfigs.ts (2)

2-2: LGTM!

The import statement for the safe connector is syntactically correct and aligns with the PR objective of enhancing wallet integration capabilities.


31-33: LGTM!

The configuration for the safe connector is correct and the allowedDomains property is effectively used to restrict its usage to the Safe application domain. This enhances security by preventing unauthorized usage of the connector.

package.json (2)

38-38: LGTM!

Updating the @web3modal/wagmi dependency to version ^5.1.7 is a good practice to keep the project up to date with the latest changes in the package.


75-75: LGTM!

Updating the wagmi dependency to version ^2.12.10 is a good practice to keep the project up to date with the latest changes in the package.

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

20-22: LGTM!

The type definition for TDonateQFEligibleNetworksProps is correctly defined with an optional goBack prop of type function.


24-26: LGTM!

The DonateQFEligibleNetworks component is correctly defined as a functional component (FC) with TypeScript typing for its props. The goBack prop is correctly destructured from the props object.


31-32: LGTM!

The useRouter hook is correctly used to access the router object, and the isQRDonation variable is correctly set based on the chain query parameter in the URL.


48-50: LGTM!

The goBackToNetworkSelection function correctly invokes the goBack prop function using the optional chaining operator ?. to avoid errors if the prop is not provided.


62-105: LGTM!

The component correctly renders different donation eligibility messages based on the donation method (QR code or not). The "Go back and check network" link and the "Switch Network" option are appropriately shown based on the condition. The modal for switching networks is correctly displayed only for non-QR donations.

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

330-330: LGTM!

Changing the button width to 100% improves the responsiveness of the layout by allowing it to adapt to the width of the parent container. This is a good change that enhances the flexibility of the component across different screen sizes.


357-357: LGTM!

Changing the media query breakpoint from tablet to laptopL for the Wrapper component is a good adjustment. It means the component's flex direction will switch from column to row at a higher screen width, potentially improving the layout for users on laptops or larger devices. This change aligns with the goal of enhancing the user interface on bigger screens.

src/components/GIVeconomyPages/GIVbacks.tsx (5)

47-48: LGTM!

The import statements are syntactically correct and the imported entities are likely used for fetching data in the component.


152-160: LGTM!

The interface GivbackAllocations is correctly defined and the state variable givbackAllocations is correctly typed using the interface. The initial value of null indicates that the data is not available initially.


162-171: LGTM!

The useEffect hook is correctly defined to fetch allocated GIVbacks data using the FETCH_ALLOCATED_GIVBACKS query and update the givbackAllocations state. The fetchPolicy is set to 'no-cache' to ensure that the data is always fetched from the server.


274-277: LGTM!

The conditional rendering logic is correctly defined to render the allocated GIV tokens or a placeholder '?' based on the availability of givbackAllocations data. The optional chaining operator ?. is correctly used to handle the case when givbackAllocations is not available.

Tools
Biome

[error] 274-275: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


274-275: Skipping the static analysis hint.

The code segment at line range 274-275 already uses the optional chaining operator ?. correctly to handle the case when givbackAllocations is not available. The static analysis hint is a false positive and can be safely ignored.

Tools
Biome

[error] 274-275: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

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

83-83: LGTM!

The isQRDonation constant is correctly set based on the chain query parameter to determine if the current donation is being made via the Stellar blockchain. This will be useful for conditionally rendering components specific to QR code donations.


Line range hint 233-241: LGTM!

The AlreadyDonatedWrapper component is now conditionally rendered based on both the alreadyDonated state and the isQRDonation variable. This ensures that the "already donated" message is not shown for QR code donations, improving the user experience for users making donations via QR code.


243-246: LGTM!

The PassportBanner component's visibility is now also conditional on the isQRDonation variable. This ensures that the PassportBanner component is not shown for QR code donations, in addition to the existing conditions, aligning with the PR objective of tailoring the interface based on the type of donation being made.


272-274: LGTM!

The logic for rendering the QFSection component has been adjusted to exclude the isQRDonation condition. This ensures that the QFSection component is only shown when the donation is not a QR donation, not recurring, and there is an active QF round, aligning with the PR objective of tailoring the interface based on the type of donation being made.

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

42-42: LGTM!

The import statement looks good.


66-66: LGTM!

The isQRDonation variable is correctly set based on the current query chain.


74-74: LGTM!

The hasActiveQFRound prop is correctly added and destructured from the useDonateData hook.


154-160: LGTM!

The code correctly handles the case when the draft donation status is 'matched' by updating the QR donation status and draft donation data.


164-169: LGTM!

The code correctly marks the draft donation as failed, updates the state, and navigates back with the updated router query.


172-175: LGTM!

The code correctly sets isQRDonation to false and navigates back with the updated router query.


339-341: LGTM!

The code correctly renders the DonateQFEligibleNetworks component based on the presence of an active QF round and QR donation.

lang/en.json (6)

182-182: LGTM!

The new label clearly communicates that Stellar is not eligible for matching in the current round.


341-341: Looks good!

The new label provides a clear call-to-action for users to check their network connection.


358-358: Enhancements look good!

The label changes improve clarity by:

  • Specifying "GIVbacks Rewards"
  • Mentioning the reward dependency on the donation amount
  • Stating the maximum reward amount of 1 million GIV

This sets the right expectations for users regarding the GIVbacks round rewards.


439-439: Nice update!

The label change enhances clarity and incentive by:

  • Specifying the minimum donation amount of $5 to qualify for GIV
  • Stating that donors qualify to get GIV for donating to eligible projects

This provides a clear and attractive value proposition to potential donors.


484-484: Good terminology update!

Changing the label to "GIVbacks Rewards" aligns it with the overall branding and makes it more specific and clear compared to the previous generic text.


1156-1156: Nice simplification!

The label change simplifies the text, makes it more concise, and adds emphasis with the exclamation mark. This improves readability and engagement.

lang/es.json (2)

341-341: LGTM!

The new label is clear, grammatically correct, and will help guide users to check their network connection when needed.


342-342: Looks good!

The new label clearly communicates that Stellar is not eligible for the current round, providing transparency to users.

Comments failed to post (1)
src/components/views/donate/OnTime/SelectTokenModal/QRCodeDonation/QRDonationCard.tsx (1)

142-149: Avoid using spread syntax on accumulators for better performance.

The updateQuery function uses the spread syntax on the accumulator object in the reduce callback. This can cause a time complexity of O(n^2) and impact performance.

Consider using Object.assign or Object.fromEntries instead:

-  return key !== excludeKey
-    ? { ...acc, [key]: prevQuery[key] }
-    : acc;
+  return key !== excludeKey
+    ? Object.assign(acc, { [key]: prevQuery[key] })
+    : acc;

or

-  }, {});
+  }, Object.fromEntries(
+    Object.entries(prevQuery).filter(([key]) => key !== excludeKey)
+  ));
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

		const prevQuery = router.query;

		const updateQuery = (excludeKey: string) =>
			Object.keys(prevQuery).reduce((acc, key) => {
				return key !== excludeKey
					? Object.assign(acc, { [key]: prevQuery[key] })
					: acc;
			}, {});
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)

@RamRamez RamRamez merged commit 9aa5086 into main Sep 17, 2024
3 checks passed
@RamRamez RamRamez deleted the release_17_sep branch September 17, 2024 14:53
@coderabbitai coderabbitai bot mentioned this pull request Sep 25, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: QA
Development

Successfully merging this pull request may close these issues.

2 participants